android: profile screen — nickname + Monero receiving address
All checks were successful
android-ci / android (pull_request) Successful in 12m27s
All checks were successful
android-ci / android (pull_request) Successful in 12m27s
The phone's half of the TUI's `/profile`. A `Profile` action on the roster's app bar opens `ui/ProfileScreen.kt`: nickname, bio, and the Monero address friends pay to, all three loaded from the store and written back through the core's own validation. - The address is checked with `uniffi.onionwire_sdk.checkAddress` *before* the write, so a typo is refused with the typed text still in the field instead of surfacing as a store error afterwards. An empty address is allowed and is labelled with its consequence: with no profile address and no running wallet child the core has nothing to hand a payer. - The bio is carried, not owned: a save that did not touch the field writes back the value read from the store immediately before the write, so a bio set in the TUI cannot be blanked from the phone. - On save the profile is pushed to **every** friend in the roster, one-shot and fail-closed per friend like the TUI's `save_profile`. A push failure is not a save failure: the status line always starts with `profile saved` and names the count, with each failure listed by petname (else shortened fingerprint). Every decision the screen makes is a pure function in the new file, covered by `ProfileDraftTest` (21 cases) on the JVM: the save-button rule (dead until the read lands, dead while the form is unchanged), the address branch, the bio rule, label selection and the status-line aggregation. Verified on AVD ow35 (x86_64 slice, emulator-5560): the roster app bar carries `Profile`; nickname/bio/address survive `am force-stop` + relaunch; an invalid address is refused before the write; a save with an empty roster reports `profile saved`; with one (self-)peer in the roster a save reports `profile saved · sent to 1 friend`, and with the emulator's network cut the same save reports `profile saved · sent to 0 of 1 friend · failed: <label>: <tor err>`.
This commit is contained in:
parent
573bf4bf8d
commit
775f2e88be
5 changed files with 736 additions and 0 deletions
|
|
@ -38,6 +38,7 @@ import uniffi.onionwire_sdk.FriendInfo
|
|||
import uniffi.onionwire_sdk.InviteInfo
|
||||
import uniffi.onionwire_sdk.OutboxRow
|
||||
import uniffi.onionwire_sdk.RotateOutcome
|
||||
import uniffi.onionwire_sdk.SelfProfile
|
||||
import uniffi.onionwire_sdk.SendState
|
||||
import uniffi.onionwire_sdk.TransferRow
|
||||
import uniffi.onionwire_sdk.WalletChildStatus
|
||||
|
|
@ -570,6 +571,33 @@ class WireViewModel(app: Application) : AndroidViewModel(app) {
|
|||
|
||||
suspend fun decode(invite: String): InviteInfo = decodeInvite(invite)
|
||||
|
||||
// --- This identity's own profile ---------------------------------------
|
||||
// The phone's half of the TUI's `/profile`. `setSelfProfile` only writes
|
||||
// locally; friends keep showing the old profile until `pushSelfProfile`
|
||||
// reaches each of them, which is why the screen reports the two separately.
|
||||
|
||||
/** The stored profile (nickname, bio, address). A store read; never dials. */
|
||||
suspend fun selfProfile(): Result<SelfProfile> =
|
||||
runCatching { requireWire().selfProfile() }
|
||||
|
||||
/**
|
||||
* Replace the stored profile. Validated in the core before it is written:
|
||||
* a rejected edit leaves the previous profile untouched.
|
||||
*/
|
||||
suspend fun setSelfProfile(
|
||||
displayName: String,
|
||||
bio: String,
|
||||
xmrAddr: String,
|
||||
): Result<Unit> = runCatching { requireWire().setSelfProfile(displayName, bio, xmrAddr) }
|
||||
|
||||
/**
|
||||
* Send the signed profile to one friend so their view of this identity is
|
||||
* current. One-shot and fail-closed: an unreachable peer is a failure for
|
||||
* that peer, and nothing is queued for them.
|
||||
*/
|
||||
suspend fun pushSelfProfile(pubkeyHex: String): Result<Unit> =
|
||||
runCatching { requireWire().pushSelfProfile(pubkeyHex) }
|
||||
|
||||
// --- Wallet & payments -------------------------------------------------
|
||||
// These mirror the SDK surface added for the wallet screen. Payment sends
|
||||
// are one-shot: if the peer's onion is unreachable, `send_*` fails now.
|
||||
|
|
|
|||
Loading…
Reference in a new issue