android: copy the invite with LocalClipboard, not the deprecated LocalClipboardManager #68

Merged
sirius merged 1 commit from wt/t_f495ce39 into main 2026-09-14 05:01:36 +00:00
Owner

androidx.compose.ui.platform.LocalClipboardManager is deprecated in compose ui 1.10, and it was the only warning :app:compileDebugKotlin printed. ShareInviteScreen now uses LocalClipboard:

val clipboard = LocalClipboard.current
val scope = rememberCoroutineScope()
...
Button(onClick = {
    scope.launch {
        clipboard.setClipEntry(ClipEntry(ClipData.newPlainText("onionwire invite", invite!!)))
        copied = true
    }
}) { Text(if (copied) "Copied" else "Copy") }

ClipEntry(ClipData) is the whole surface this compose version ships for plain text — ClipboardExtensions_androidKt only adds firstUriOrNull, so the constructor form is used rather than a convenience that does not exist (verified with javap against ui-android:1.10.0).

Behaviour is unchanged: same invite string, same copied flip and label, no new permission (clipboard writes need none), and PasteInviteScreen is untouched.

Verification

  • :app:assembleDebug (arm64-v8a + x86_64) — BUILD SUCCESSFUL, zero w:/e: lines and zero mentions of InviteScreens.kt in a full --rerun-tasks compile.
  • :app:testDebugUnitTest — 61 tests, 0 failures, 0 errors, 0 skipped.
  • Emulator (AVD ow35, x86_64, API 35), debug APK reinstalled and driven through uiautomator: Invite → Copy flips the label to Copied (the flip happens after the suspend setClipEntry returns) → back → Add → paste into the invite field (input keyevent 279) leaves the field byte-identical to the 346-char string shown on the Invite screen, and Verify decodes it.

Both ABIs build; the shipped arm64 slice is unaffected by this change.

Rebased onto current main (the worktree branched before PR #67 merged), so the diff is this file only.

CI

.forgejo/workflows/ci.yml is Rust-only (src/**, crates/**, tests/**, Cargo.*) and android-release.yml fires on tags, so no CI job covers this PR — it will show no checks. The evidence is the local build/test run and the emulator session described above.

`androidx.compose.ui.platform.LocalClipboardManager` is deprecated in compose ui 1.10, and it was the only warning `:app:compileDebugKotlin` printed. `ShareInviteScreen` now uses `LocalClipboard`: ```kotlin val clipboard = LocalClipboard.current val scope = rememberCoroutineScope() ... Button(onClick = { scope.launch { clipboard.setClipEntry(ClipEntry(ClipData.newPlainText("onionwire invite", invite!!))) copied = true } }) { Text(if (copied) "Copied" else "Copy") } ``` `ClipEntry(ClipData)` is the whole surface this compose version ships for plain text — `ClipboardExtensions_androidKt` only adds `firstUriOrNull`, so the constructor form is used rather than a convenience that does not exist (verified with `javap` against `ui-android:1.10.0`). Behaviour is unchanged: same invite string, same `copied` flip and label, no new permission (clipboard writes need none), and `PasteInviteScreen` is untouched. ## Verification - `:app:assembleDebug` (arm64-v8a + x86_64) — BUILD SUCCESSFUL, zero `w:`/`e:` lines and zero mentions of `InviteScreens.kt` in a full `--rerun-tasks` compile. - `:app:testDebugUnitTest` — 61 tests, 0 failures, 0 errors, 0 skipped. - Emulator (AVD `ow35`, x86_64, API 35), debug APK reinstalled and driven through uiautomator: Invite → Copy flips the label to `Copied` (the flip happens after the suspend `setClipEntry` returns) → back → Add → paste into the invite field (`input keyevent 279`) leaves the field byte-identical to the 346-char string shown on the Invite screen, and Verify decodes it. Both ABIs build; the shipped arm64 slice is unaffected by this change. Rebased onto current `main` (the worktree branched before PR #67 merged), so the diff is this file only. ## CI `.forgejo/workflows/ci.yml` is Rust-only (`src/**`, `crates/**`, `tests/**`, `Cargo.*`) and `android-release.yml` fires on tags, so **no CI job covers this PR** — it will show no checks. The evidence is the local build/test run and the emulator session described above.
LocalClipboardManager is deprecated in compose ui 1.10; the warning was the
only one in :app:compileDebugKotlin. Switch ShareInviteScreen to
LocalClipboard.setClipEntry(ClipEntry(ClipData.newPlainText(...))) on a
rememberCoroutineScope, since the new API is suspend. Same text, same
copied-state flip, same label, no permission change.
sirius merged commit f95e058041 into main 2026-09-14 05:01:36 +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!68
No description provided.