android: saved-wallets screen (list, select, back up the open wallet) #147
Loading…
Reference in a new issue
No description provided.
Delete branch "onionwire/t_cf7e07f9-android-saved-wallets-screen-list-select"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The app could hold several wallets and show none of them. This adds the screen that lists the store's catalogue, marks the one the wallet child has open, switches to another on a tap, and — for the open one only — shows its recovery phrase and private keys.
What the screen decides
Everything secret here belongs to the file the child currently has open:
query_keyis answered by that file and no other, so the seed card and the keys card hang offactive_wallet_filename(), not off a row. On a row that is not the open one both actions are dead and say why (open this wallet to view its backup) instead of opening it under the user — switching wallets is a deliberate tap, becauseopen_walletstops and restarts a running child.SeedBackupCard, widened fromprivatetointernalrather than copied, so the gate constants are still the oneSeedBackupGate(WARNING,CONFIRM_WORD,confirmEnabled) and their values are untouched.view-only wallet — no spend keyin words, becausespend_key == nullis the wallet's own answer and not a failure. Both values are read on an explicit tap, never logged, never persisted, never in atestTag/contentDescription/saved state, and dropped on dispose.No saved wallets yet(empty catalogue) andcould not read the wallet catalogue+ the core's text (read failure) are rendered as the two different states they are.open_wallet(filename), then reloads, so thein usemarker moves. The core's refusal is shown verbatim.Files
ui/WalletManagerScreen.kt(584 lines) — screen + the pure rules it renders fromtest/.../ui/WalletManagerTest.kt(153 lines, 17 cases)ui/WalletScreen.kt—Walletsaction in the existingTopAppBar, newonOpenWalletsparameter,SeedBackupCardprivate→internal(3 changes, 14 lines)WireViewModel.kt—wallets(),activeWalletFilename(),openWallet(filename),walletKeys(), allResult-returning in the file's existing styleMainActivity.kt— thewalletsroute and theWalletScreenwiringNo dependency added;
build.gradle.ktsuntouched. The roster's action row is untouched.Verified
./gradlew :app:testDebugUnitTest --tests '*WalletManagerTest*' --rerun→BUILD SUCCESSFUL, 17 tests / 0 failures / 0 errors (TEST-com.siriusdevops.onionwire.ui.WalletManagerTest.xml). Run with the x86_64 slice, which is what the emulator needs.:app:assembleDebugand:app:assembleReleaseboth green with-Ponionwire.abis=x86_64.ow35, x86_64, API 35,emulator-5560): theWalletsaction on the wallet screen's app bar opens the screen, which rendersSaved walletswithRefreshandBack; an empty catalogue rendersNo saved wallets yetwith its own way back;Create or import a walletreturns to the wallet screen.uiautomatordumps are in the task card.Not verified on device
The list-with-rows / select / phrase / keys paths could not be exercised on the emulator: the wallet child needs
monero-wallet-rpc, this repo ships it arm64-v8a only (android/MONERO_BINARIES.md: "-Ponionwire.abis=x86_64produces an APK with no wallet binary in it"), and every AVD here is x86_64. With no binary the child cannot start,wallet_create/wallet_restoreboth refuse withwallet not configured — open F7 to set it up, or set ONIONWIRE_WALLET_RPC, and the catalogue therefore cannot be given a row from the device. So: no row, no select, and no secret read against a running wallet child were exercised; the list path that was exercised is the real empty-catalogue read.The app could hold several wallets and show none of them. Add the screen that lists the store's catalogue, marks the one the wallet child has open, switches to another on a tap, and — for the open one only — shows its recovery phrase and private keys. Everything secret here belongs to the file the child currently has open: `query_key` is answered by that file and no other, so the seed card and the keys card hang off `active_wallet_filename()`, not off a row. On a row that is not the open one both actions are dead and say why ("open this wallet to view its backup") instead of opening it under the user — switching wallets is a deliberate tap, because `open_wallet` stops and restarts a running child. The phrase keeps the existing treatment: the wallet screen's own `SeedBackupCard`, widened from `private` to `internal` rather than copied, so the gate constants are still the one `SeedBackupGate`. The keys card shows the view key always and the spend key when there is one; a view-only wallet says "view-only wallet — no spend key" in words, because `null` is the wallet's own answer and not a failure. Neither value is logged, persisted, tagged, or held in saved state, and both are dropped on dispose. The catalogue is re-read on entry and on Refresh, never cached from app start, so a wallet created on the wallet screen after this one was first opened shows up without restarting the app. An empty catalogue ("No saved wallets yet") and a read failure ("could not read the wallet catalogue" + the core's text) are rendered as the two different states they are. The gate is pure Kotlin in the new file and `WalletManagerTest` covers it on the JVM (17 cases): the row label's name/blank/whitespace fallback, which child states count as readable, and whether the secret actions are offered for a row.