Merge branch 'main' into onionwire/t_54329f2b-android-profile-screen-nickname-monero-r
All checks were successful
android-ci / android (pull_request) Successful in 12m30s

This commit is contained in:
sirius 2026-09-22 12:09:33 +00:00
commit dc8c3933cd
5 changed files with 806 additions and 2 deletions

View file

@ -42,6 +42,8 @@ import uniffi.onionwire_sdk.SelfProfile
import uniffi.onionwire_sdk.SendState
import uniffi.onionwire_sdk.TransferRow
import uniffi.onionwire_sdk.WalletChildStatus
import uniffi.onionwire_sdk.WalletKeys
import uniffi.onionwire_sdk.WalletRow
import uniffi.onionwire_sdk.Wire
import uniffi.onionwire_sdk.decodeInvite
import java.io.File
@ -647,6 +649,50 @@ class WireViewModel(app: Application) : AndroidViewModel(app) {
suspend fun walletSeed(): Result<String> =
runCatching { requireWire().walletSeed() }
// --- Wallet catalogue, the open wallet, and its secrets ----------------
// The saved-wallets screen's reads. The catalogue is a store read that
// never dials, so it goes to [Dispatchers.IO] like the other store reads in
// this file — a SQLCipher decrypt on the main thread is an ANR waiting for a
// slow device.
/**
* Every wallet this install remembers, oldest first.
*
* A store read: it works with the wallet child stopped or never configured,
* and "no wallets" is an empty list rather than a failure — the caller must
* not render the two alike.
*/
suspend fun wallets(): Result<List<WalletRow>> =
withContext(Dispatchers.IO) { runCatching { requireWire().wallets() } }
/**
* The file name of the wallet the child currently has open, or null when it
* has none. The catalogue's in-use marker is this and nothing else.
*/
suspend fun activeWalletFilename(): Result<String?> =
withContext(Dispatchers.IO) { runCatching { requireWire().activeWalletFilename() } }
/**
* Point the wallet child at a catalogue wallet's file.
*
* Slow on purpose: a live child is stopped and started again onto the new
* file. The core refuses a name the catalogue does not hold, and that
* refusal is surfaced verbatim to the caller.
*/
suspend fun openWallet(filename: String): Result<Unit> =
withContext(Dispatchers.IO) { runCatching { requireWire().openWallet(filename) } }
/**
* The **open** wallet's private keys, for the saved-wallets screen.
*
* Both values are spend secrets: only ever called from an explicit tap,
* never logged, never persisted, and dropped when the screen goes. There is
* deliberately no accessor for another catalogue row's keys — the only way
* to read a saved wallet's keys is to open it first.
*/
suspend fun walletKeys(): Result<WalletKeys> =
withContext(Dispatchers.IO) { runCatching { requireWire().walletKeys() } }
fun spendAuthorityWarning(): String = runCatching {
requireWire().spendAuthorityWarning()
}.getOrElse {