Thin the app's comments
The same pass the server had, on the Kotlin side: comments restating what the code says are gone, and the ones recording a measurement, a constraint or an incident are kept but cut to a few lines each. 6540 comment lines to 5674, and 920 lines off the app. Two doc comments had drifted onto the item above the one they describe -- `contextAfter`'s onto `sessionWorking` in Events.kt, and `UsageMonitor`'s equivalent on the server was fixed in the previous commit. Each is back on its own item, which is the only non-comment line this diff moves. The comments are reflowed to the column limit at their own indentation: several were written wide, and ktfmt re-wrapped them into lines holding a single orphan word. `/tmp` script, not kept -- ktfmt is idempotent over the result, which is the check. Left alone deliberately: this codebase's remaining comment density is high because the comments carry things the code cannot say -- what a null means, what a number was measured against, which bug a guard exists for. Of the 238 one-line doc comments in the app, five were pure restatement of the name and were removed; the rest each say something the signature does not. ktfmtFormat, compileDebugKotlin, lintDebug and testDebugUnitTest pass; cargo test (127), clippy --all-targets and fmt still clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79682f03a7
commit
edc39c7371
68 files changed
+2077
-2997
No files matched your search
@@ -47,15 +47,14 @@ fun SettingsScreen(
|
||||
val context = LocalContext.current
|
||||
var host by remember { mutableStateOf(existing?.host ?: "10.66.0.1") }
|
||||
var port by remember { mutableStateOf((existing?.port ?: 8443).toString()) }
|
||||
// Never pre-filled from the stored token: this screen shouldn't be a
|
||||
// way to read the credential back off the device.
|
||||
// Never pre-filled from the stored token: this screen shouldn't be a way to read the credential
|
||||
// back off the device.
|
||||
var token by remember { mutableStateOf("") }
|
||||
var error by remember { mutableStateOf<String?>(null) }
|
||||
|
||||
val scanLauncher =
|
||||
rememberLauncherForActivityResult(ScanContract()) { result: ScanIntentResult ->
|
||||
// Null contents means the user backed out of the scanner -- not an
|
||||
// error, so nothing to report.
|
||||
// Null contents means the user backed out of the scanner -- not an error.
|
||||
val contents = result.contents ?: return@rememberLauncherForActivityResult
|
||||
val settings = parseEnrollmentUri(contents.toUri())
|
||||
if (settings == null) {
|
||||
@@ -83,8 +82,8 @@ fun SettingsScreen(
|
||||
// left-pointing arrow at the right edge, aimed across the title it sits beside.
|
||||
//
|
||||
// Absent rather than disabled on first run, which is the one place this app lets a
|
||||
// control come and go: there is no screen underneath yet, so a Back here would not be
|
||||
// a capability being withheld but a promise it could not keep.
|
||||
// control come and go: there is no screen underneath yet, so a Back here would not be a
|
||||
// capability being withheld but a promise it could not keep.
|
||||
if (onBack != null) {
|
||||
GlyphButton(BACK_GLYPH, "Back", onBack)
|
||||
Spacer(Modifier.width(GLYPH_BUTTON_MARGIN))
|
||||
@@ -106,14 +105,11 @@ fun SettingsScreen(
|
||||
|
||||
OutlinedButton(
|
||||
onClick = {
|
||||
// Hold the camera permission before the scanner starts.
|
||||
// Letting its activity ask on our behalf is what the
|
||||
// library does by default, and it opens the camera without
|
||||
// waiting for the answer: the first-ever scan comes up as
|
||||
// a live preview with "Sorry, the Android camera
|
||||
// encountered a problem" over it, and works on the second
|
||||
// try. Nothing is wrong with the camera, so nothing should
|
||||
// say there is.
|
||||
// Hold the camera permission before the scanner starts. Letting its activity ask on
|
||||
// our behalf is what the library does by default, and it opens the camera without
|
||||
// waiting for the answer: the first-ever scan comes up as a live preview with
|
||||
// "Sorry, the Android camera encountered a problem" over it, and works on the
|
||||
// second try.
|
||||
if (
|
||||
context.checkSelfPermission(Manifest.permission.CAMERA) ==
|
||||
PackageManager.PERMISSION_GRANTED
|
||||
@@ -187,11 +183,10 @@ fun SettingsScreen(
|
||||
* just been granted.
|
||||
*
|
||||
* MIXED_SCAN is the load-bearing part: ZXing otherwise looks only for a dark code on a light
|
||||
* ground, and ai-server's QR is block characters in the terminal's foreground colour, so on a
|
||||
* dark-themed terminal it comes out as a photographic negative the scanner silently never matches.
|
||||
* Which way round it renders is the terminal's business, not something this app should depend on.
|
||||
* The mixed decoder alternates normal and inverted frames, costing half the frame rate at each
|
||||
* polarity and nothing else.
|
||||
* ground, and ai-server's QR is block characters in the terminal's foreground colour, so on a dark-
|
||||
* themed terminal it comes out as a photographic negative the scanner silently never matches. The
|
||||
* mixed decoder alternates normal and inverted frames, costing half the frame rate at each
|
||||
* polarity.
|
||||
*/
|
||||
private fun enrollmentScanOptions(): ScanOptions =
|
||||
ScanOptions()
|
||||
|
||||
Reference in new issue
Block a user