android: collapse the roster identity block into a dropdown #146

Merged
sirius merged 2 commits from onionwire/t_d62da406-android-roster-collapse-the-identity-blo into main 2026-09-22 04:31:23 +00:00
Owner

Goal

The roster's identity card ate the top of the page: Mono(fingerprint) is a 64-hex string that wraps to several lines on a phone, and the full onion is a second block under it. Collapse the block into a disclosure, closed by default.

What changed

android/app/src/main/java/com/siriusdevops/onionwire/ui/RosterScreen.kt

  • var identityExpanded by rememberSaveable { mutableStateOf(false) } — closed by default, survives a rotation, never written to the store.
  • The disclosure header is one clickable Row: Label("YOU (stable forever)") + Mono(shortId(fingerprint)) + a trailing chevron (▸ closed / ▾ open).
  • Expanded, the card shows exactly today's content in today's order: Mono(fingerprint), Label("ONION (locator — rotates)"), Mono(onion). The raw ready.fingerprint / ready.onion values pass through untouched — nothing is truncated in the expanded state.
  • The sdk … line and keepAliveNote stay outside the disclosure. The keep-alive denial is the only place that note appears, so hanging it off a collapsed block would make the denial invisible.
  • New pure top-level function shortId(id: String, head: Int = 6, tail: Int = 4): head characters + U+2026 + tail characters, returned unchanged when id.length < head + tail + 1 (so empty stays empty).

android/app/src/test/java/com/siriusdevops/onionwire/ui/RosterIdTest.kt (new)

Seven JVM cases: the 64-hex fingerprint (9f2c41…6a49), head and tail are literal slices of the input, custom head/tail, the head + tail + 1 boundary from both sides, shorter-than-abbreviation unchanged, empty unchanged, single U+2026 (not three dots).

No other file touched. Label / Mono / ConfirmStrip signatures are unchanged.

Evidence

Unit test (CI does not run Kotlin unit tests — .forgejo/workflows/android-ci.yml assembles :sdk + :app only):

$ ./gradlew :app:testDebugUnitTest --tests '*RosterIdTest*' :app:assembleDebug -Ponionwire.abis=x86_64
> Task :app:compileDebugUnitTestKotlin
> Task :app:testDebugUnitTest
BUILD SUCCESSFUL in 14s
68 actionable tasks: 25 executed, 4 from cache, 39 up-to-date
<testsuite name="com.siriusdevops.onionwire.ui.RosterIdTest" tests="7" skipped="0" failures="0" errors="0" time="0.017">

Device evidence: -Ponionwire.abis=x86_64 slice installed on AVD ow35b (x86_64, google_apis API 35), collapsed and expanded uiautomator dumps are pasted in the task card. CI does not cover the pixels; the dumps do.

## Goal The roster's identity card ate the top of the page: `Mono(fingerprint)` is a 64-hex string that wraps to several lines on a phone, and the full onion is a second block under it. Collapse the block into a disclosure, closed by default. ## What changed `android/app/src/main/java/com/siriusdevops/onionwire/ui/RosterScreen.kt` - `var identityExpanded by rememberSaveable { mutableStateOf(false) }` — closed by default, survives a rotation, never written to the store. - The disclosure header is one clickable `Row`: `Label("YOU (stable forever)")` + `Mono(shortId(fingerprint))` + a trailing chevron (`▸` closed / `▾` open). - Expanded, the card shows exactly today's content in today's order: `Mono(fingerprint)`, `Label("ONION (locator — rotates)")`, `Mono(onion)`. The raw `ready.fingerprint` / `ready.onion` values pass through untouched — nothing is truncated in the expanded state. - The `sdk …` line and `keepAliveNote` stay *outside* the disclosure. The keep-alive denial is the only place that note appears, so hanging it off a collapsed block would make the denial invisible. - New pure top-level function `shortId(id: String, head: Int = 6, tail: Int = 4)`: `head` characters + U+2026 + `tail` characters, returned unchanged when `id.length < head + tail + 1` (so empty stays empty). `android/app/src/test/java/com/siriusdevops/onionwire/ui/RosterIdTest.kt` (new) Seven JVM cases: the 64-hex fingerprint (`9f2c41…6a49`), head and tail are literal slices of the input, custom `head`/`tail`, the `head + tail + 1` boundary from both sides, shorter-than-abbreviation unchanged, empty unchanged, single U+2026 (not three dots). No other file touched. `Label` / `Mono` / `ConfirmStrip` signatures are unchanged. ## Evidence Unit test (CI does **not** run Kotlin unit tests — `.forgejo/workflows/android-ci.yml` assembles `:sdk` + `:app` only): ``` $ ./gradlew :app:testDebugUnitTest --tests '*RosterIdTest*' :app:assembleDebug -Ponionwire.abis=x86_64 > Task :app:compileDebugUnitTestKotlin > Task :app:testDebugUnitTest BUILD SUCCESSFUL in 14s 68 actionable tasks: 25 executed, 4 from cache, 39 up-to-date ``` ``` <testsuite name="com.siriusdevops.onionwire.ui.RosterIdTest" tests="7" skipped="0" failures="0" errors="0" time="0.017"> ``` Device evidence: `-Ponionwire.abis=x86_64` slice installed on AVD `ow35b` (x86_64, google_apis API 35), collapsed and expanded `uiautomator` dumps are pasted in the task card. CI does not cover the pixels; the dumps do.
android: collapse the roster identity block into a dropdown
All checks were successful
android-ci / android (pull_request) Successful in 12m26s
b6447f76d6
The identity card's full fingerprint wraps to several lines on a phone and
pushes the friend list off the first screen. Collapse it: one line by
default (label + `shortId(fingerprint)` + chevron), the full fingerprint and
the full onion behind a tap, in the order they already had.

The `sdk …` line and `keepAliveNote` stay outside the disclosure — the
keep-alive denial is the only place that note appears, so hanging it off a
collapsed block would hide it.

`shortId` is a pure top-level function (`head … tail`, unchanged when the
value is no longer than the abbreviation, empty stays empty) so the collapsed
line is a slice of the value shown expanded, not a parallel encoding. The
expand state is `rememberSaveable`: a rotation keeps what the user chose, and
nothing about it belongs in the store.

RosterIdTest covers the abbreviation on the JVM (7 cases: the 64-hex
fingerprint, the head/tail boundary, custom head/tail, shorter-than-input,
empty, single-char ellipsis).
Merge branch 'main' into onionwire/t_d62da406-android-roster-collapse-the-identity-blo
All checks were successful
android-ci / android (pull_request) Successful in 12m1s
181c13647a
sirius merged commit 573bf4bf8d into main 2026-09-22 04:31:23 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!146
No description provided.