Skip to content

feat(wallet): cycle balance display between sats, fiat, and hidden#562

Open
dmnyc wants to merge 1 commit into
barrydeen:mainfrom
dmnyc:feat/wallet-balance-toggle
Open

feat(wallet): cycle balance display between sats, fiat, and hidden#562
dmnyc wants to merge 1 commit into
barrydeen:mainfrom
dmnyc:feat/wallet-balance-toggle

Conversation

@dmnyc
Copy link
Copy Markdown
Contributor

@dmnyc dmnyc commented May 22, 2026

Summary

Android port of iOS feat/wallet-balance-toggle. Tapping the wallet
dashboard balance now cycles through three states instead of the
prior plain hide/show toggle:

  1. SATS — current default. "21,000 sats" or app-wide fiat when
    the global `FiatPreferences.isFiatMode` flag is on.
  2. FIAT — wallet-screen-scoped fiat. Renders the balance + each
    tx row's amount/fee in the user's currently-selected fiat currency
    without flipping the app-wide flag, so feed sat counts elsewhere
    keep showing sats.
  3. HIDDEN — masks the dashboard balance AND every per-row amount
    • fee in the transaction history view, for screenshots /
      shoulder-surfing.

Storage

New per-pubkey key `walletBalanceDisplay_` (matches iOS) in
the existing `wisp_settings` SharedPreferences. The legacy global
`balance_hidden` Bool is read once per pubkey when no per-pubkey
entry exists (true → HIDDEN, false → SATS) and then a migrated value
is written. Legacy key left in place — older builds rolled back keep
their preference.

`WalletBalanceDisplayMode` enum exposes `next()` for the cycle and
`read` / `write` helpers. Both `WalletHomeContent` and
`TransactionRow` read the same key so dashboard + history stay in
lockstep.

Test plan

  • Wallet dashboard: tap the balance once → it renders as fiat
    ("$12.34" using the user's selected fiat currency). Tap
    again → "* * * * *" hidden. Tap again → back to sats.
  • Cycle persists across app restarts: leave the wallet in FIAT,
    kill + relaunch, dashboard opens in FIAT.
  • In HIDDEN, navigate to Transactions → every row's amount + fee
    is masked ("+* * " / "- * *"; fee text masked). Tap the
    dashboard balance to leave HIDDEN → tx history numbers reappear
    on next open.
  • In FIAT, transactions list amounts + fees render in the user's
    fiat currency.
  • Wallet-screen FIAT state does NOT flip the app-wide
    `isFiatMode` flag: Settings → Interface → Fiat toggle stays
    whatever it was; feed action-bar zap counts, timestamps, etc.
    still respect the global setting.
  • User who previously had `balance_hidden = true` opens this
    build for the first time → dashboard opens in HIDDEN. User who
    had it `false` → opens in SATS. Same value reflected after
    toggling and relaunching.
  • User with no prior preference → defaults to SATS.
  • Account switch: signing out and into a different pubkey starts
    that pubkey at its own default (SATS, since the per-pubkey key
    isn't migrated for the new account).
  • FIAT mode when the exchange-rate cache hasn't loaded yet: falls
    back to the sats display so the dashboard doesn't show a blank.

Ports iOS PR barrydeen/wisp-ios#166 to Android. Tapping the wallet
dashboard balance now cycles through three states instead of the
prior plain hide/show toggle:

1. SATS   — current default rendering ("21,000 sats" or app-wide
            fiat when [FiatPreferences.isFiatMode] is on).
2. FIAT   — wallet-screen-scoped fiat. Renders the balance + each tx
            row's amount/fee in the user's currently-selected fiat
            currency without flipping the app-wide fiat-mode flag, so
            feed sat counts elsewhere stay in sats.
3. HIDDEN — masks the dashboard balance AND every per-row amount +
            fee in the transaction history, useful for screenshots /
            shoulder-surfing scenarios.

Storage: new per-pubkey key `walletBalanceDisplay_<pubkey>` in the
existing `wisp_settings` SharedPreferences. The legacy global
`balance_hidden` Bool is read once per pubkey when no per-pubkey
entry exists (true → HIDDEN, false → SATS) and then a migrated value
is written; legacy key is left in place so older builds rolled back
keep their preference.

Storage-key format matches iOS, so the cross-platform port doc lives
on the iOS side (see PR barrydeen#166). Companion enum
`WalletBalanceDisplayMode` carries the `next()` cycle helper and the
read/write helpers; both `WalletHomeContent` and the transaction
history `TransactionRow` read the same key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant