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
@@ -29,12 +29,10 @@ import androidx.lifecycle.repeatOnLifecycle
|
||||
* The app's root: one title, and four views of the backend behind it.
|
||||
*
|
||||
* These were four screens reached by four words in a row under the title, and the row was already
|
||||
* full -- the comment it replaced recorded that a fifth would have to go somewhere else. Tabs say
|
||||
* the same thing in less space and say one more thing besides: that these are places to be rather
|
||||
* than errands to run. Sessions, the machine's importable history, the models on it and the
|
||||
* machines themselves are all *the same backend*, looked at four ways, and none of them is a step
|
||||
* down from another. Settings still is a step down, which is why it stays a pushed screen and keeps
|
||||
* its own Back.
|
||||
* full. Tabs say the same thing in less space and say one more thing besides: that these are places
|
||||
* to be rather than errands to run. Sessions, the machine's importable history, the models on it
|
||||
* and the machines themselves are all *the same backend*, looked at four ways, and none is a step
|
||||
* down from another. Settings still is, which is why it stays a pushed screen with its own Back.
|
||||
*/
|
||||
private enum class MainTab(val label: String) {
|
||||
Sessions("Sessions"),
|
||||
@@ -61,17 +59,12 @@ fun MainScreen(
|
||||
//
|
||||
// What these four draw is a snapshot of a backend they are not connected to, so it is only as
|
||||
// fresh as the last answer -- and a *failed* answer is the one that outstays its welcome. A
|
||||
// phone that was away while the tunnel was down, or that fetched before the network came up,
|
||||
// came back to "Couldn't reach the server" sitting at the top of a list the server would now
|
||||
// answer for perfectly well, and nothing took it off until somebody pressed Refresh. A stale
|
||||
// failure is worse than a stale list: it is a claim about right now.
|
||||
// phone that was away while the tunnel was down came back to "Couldn't reach the server"
|
||||
// sitting at the top of a list the server would now answer for perfectly well. A stale failure
|
||||
// is worse than a stale list: it is a claim about right now.
|
||||
//
|
||||
// Through the same token the Refresh button uses, so this is one instruction the tabs already
|
||||
// understand rather than a second path into each of them -- which is also what makes it cover
|
||||
// all four rather than the one the report came from.
|
||||
//
|
||||
// Not on the first entry: the tab composing already asks, and bumping here would make every
|
||||
// cold start fetch twice.
|
||||
// understand. Not on the first entry: the tab composing already asks.
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
LaunchedEffect(lifecycleOwner) {
|
||||
var opening = true
|
||||
@@ -81,9 +74,8 @@ fun MainScreen(
|
||||
}
|
||||
}
|
||||
|
||||
// A tab the app put over the list has to step back to it rather than fall through to the
|
||||
// system default, which closes the app -- that reads as a crash to somebody who only meant to
|
||||
// get back to their sessions. Nested inside AppRoot's handler, so it wins while it is enabled.
|
||||
// A tab the app put over the list has to step back to it rather than fall through to the system
|
||||
// default, which closes the app. Nested inside AppRoot's handler, so it wins while enabled.
|
||||
BackHandler(enabled = tab != MainTab.Sessions) { tab = MainTab.Sessions }
|
||||
|
||||
Column(Modifier.fillMaxSize()) {
|
||||
@@ -98,20 +90,18 @@ fun MainScreen(
|
||||
)
|
||||
// Glyphs rather than the words they replaced: neither ever changes, both are read
|
||||
// faster than they are spelled, and together they take the width that let the title
|
||||
// keep its own line. They sit on the title's row because they act on the whole
|
||||
// screen -- everything below this row is one tab's business, and a control belongs
|
||||
// with the thing it acts on.
|
||||
// Flush against each other: a glyph button carries its own padding, so two of them
|
||||
// side by side already have two rings between their marks and one ring plus this
|
||||
// row's padding to the screen edge.
|
||||
// keep its own line. They sit on the title's row because they act on the whole screen.
|
||||
//
|
||||
// Flush against each other: a glyph button carries its own padding, so two side by side
|
||||
// already have two rings between their marks.
|
||||
Row {
|
||||
GlyphButton(REFRESH_GLYPH, "Refresh", { refreshToken++ })
|
||||
GlyphButton(SETTINGS_GLYPH, "Settings", onSettings)
|
||||
}
|
||||
}
|
||||
// What is waiting to be attached, and what to do about it. Said here because the list
|
||||
// below is where the choice is made, and a share that arrived with nothing on screen
|
||||
// saying so would read as a tap that did nothing.
|
||||
// What is waiting to be attached, and what to do about it. Said here because the list below
|
||||
// is where the choice is made, and a share that arrived with nothing on screen saying so
|
||||
// would read as a tap that did nothing.
|
||||
share?.let {
|
||||
Text(
|
||||
it.summary() + " -- open the session it belongs in.",
|
||||
@@ -127,8 +117,8 @@ fun MainScreen(
|
||||
.padding(12.dp),
|
||||
)
|
||||
}
|
||||
// Primary rather than the plain TabRow, which is deprecated in favour of the two that
|
||||
// say where they sit: these are the app's top-level destinations.
|
||||
// Primary rather than the plain TabRow, which is deprecated in favour of the two that say
|
||||
// where they sit: these are the app's top-level destinations.
|
||||
PrimaryTabRow(selectedTabIndex = tab.ordinal) {
|
||||
MainTab.entries.forEach { entry ->
|
||||
Tab(
|
||||
@@ -139,10 +129,9 @@ fun MainScreen(
|
||||
}
|
||||
}
|
||||
|
||||
// Refreshing means "ask again about what I am looking at", so the button feeds the tab
|
||||
// that is showing. The token from above means something else already changed what these
|
||||
// show; the two are the same instruction to the tab below, so they are summed rather than
|
||||
// tracked apart -- either one moving moves the sum, which is all a tab watches.
|
||||
// Refreshing means "ask again about what I am looking at", so the button feeds the tab that
|
||||
// is showing. The token from above means something else already changed what these show;
|
||||
// the two are the same instruction, so they are summed rather than tracked apart.
|
||||
val token = reloadToken + refreshToken
|
||||
when (tab) {
|
||||
MainTab.Sessions ->
|
||||
|
||||
Reference in new issue
Block a user