Repository navigation
fix: show first-time balance gesture toasts - #1272
Conversation
|
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
jvsena42
left a comment
There was a problem hiding this comment.
One MEDIUM: the e2e-tests-local - settings job is deterministically red on this branch, and the fix lives in bitkit-e2e-tests rather than here. Details on the inline comment. COMMENT rather than REQUEST_CHANGES because the app code is right — pointing REQUEST_CHANGES at this diff would blame the wrong repo — but it does block the merge queue until the companion branch exists.
The app behaviour itself is clean. What I checked:
Displayed amount. The rendered unit comes from CurrencyState.primaryDisplay, derived from settingsStore.data. switchBalanceUnit() writes primaryDisplay and ignoresSwitchUnitToast in one updateData, and the toast text is built from the pre/post values captured inside that same transform — so the header and the toast cannot disagree. The rate-refresh path is untouched.
Hidden-balance leak. Toast args are only "Bitcoin" or the currency code; the hide toast takes no args. No amount is ever interpolated, so nothing reveals a balance while it is hidden.
Upgrade default. Both new fields default false, v2.4.1's SettingsData has no such keys, and the Json is configured ignoreUnknownKeys = true, so kotlinx fills them with defaults. Every existing user upgrades to "not yet seen" and sees each toast once on their next gesture — which matches the intent. An older app restoring a newer backup ignores the two extra keys, and restoreFromBackup resets both flags explicitly. DataStore.updateData returns only after the durable write and the toast is sent after it returns, so a crash can't re-show it.
Strings. All four keys exist in values/strings.xml and in all 13 locale files, with %1$s present in both arg-taking strings in every locale and absent from the no-arg ones — no format-arg crash. Keys are alphabetically placed, nothing is hardcoded, and both ViewModels localize via injected @ApplicationContext.
Concurrency. Toasts go through ToastEventBus (extraBufferCapacity = 1, SUSPEND overflow, so nothing is dropped) collected once in AppViewModel.init. The flag flips inside the same updateData as the state change, so a rapid double tap can't produce two toasts. No LaunchedEffect, so no toast on recomposition.
0cae3c667 (scoping the guidance to wallet screens, answering greptile's P1): the fallback setHideBalance(!hideBalance) on the ten non-wallet surfaces looked like it might bypass the enableSwipeToHideBalance guard that toggleHideBalanceFromSwipe carries — it doesn't. allowSwipeToHide = useSwipeToHide && isSwipeToHideEnabled already gates the swipe modifier itself, so with the setting off the branch is unreachable. Clean.
Design. Frames are linked and I diffed against them. Wallet Balance Hidden (46920-147840) specifies the toast as title "Wallet Balance Hidden" / body "Swipe your wallet balance to reveal it again." — the implementation's copy matches verbatim, and the blue accent matches the frame's Accents/Blue. No delta worth raising.
|
Drafted to give preference to #1273, to see if it possible to show toasts from sheets |
c6aaa03 to
ba448d0
Compare
66690fd to
8ba7b8b
Compare
Pull Request is not mergeable
Pull Request is not mergeable
Pull Request is not mergeable
Pull Request is not mergeable
Pull Request is not mergeable
b269d78 to
c988cf7
Compare
There was a problem hiding this comment.
Verdict: ✅ Approve
Reaudit: diff 1 file.
Findings:
N/A
Audit:
Audited - no findings.
QA: emu-1 redroid container on Android 15, dev build 2.4.1 (188)
-
✅ passed: the first tap named the new and the previous unit; the second and third taps switched silently.
-
✅ passed: the swipe hid the balance and toasted; the eye-icon reveal and a second hide stayed silent.
-
✅ passed: with the setting off the balance stayed visible and no hide toast appeared.
-
✅ passed: Activity Detail's amount toasted on the first tap; Home's balance then switched without one.
-
✅ passed: Activity Detail's amount hid with a toast; Home's swipes then hid it without one.
Note
With Swipe balance to hide off, a horizontal swipe still reaches the balance's click handler and switches the unit, so on a fresh wallet it raises the switched-unit toast. That is the existing gesture behaviour, not the hide path item 3 checks.
Tip
Test 1 worth a journey:
- Clear app data and create a new wallet
- Land on Home with the total balance shown in Bitcoin
- Tap the total balance once
- Verify the toast names the new unit and the previous unit
- Tap the total balance again
- Verify no toast appears for thirty seconds
Test 2 worth a journey:
- Open Home with a visible total balance
- Swipe the total balance sideways
- Verify the balance hides and the guidance toast appears
- Tap the eye icon to reveal the balance
- Swipe the total balance sideways again
- Verify the balance hides with no second toast
Test 3 worth a journey:
- Create a new wallet and open Settings
- Go to the Security tab
- Turn off Swipe balance to hide
- Return to Home and swipe the total balance
- Verify the balance stays visible and no hide toast appears
Test 4 worth a journey:
- Create a new wallet and generate test activities from Dev Settings
- Open an activity from the Home list
- Tap the amount at the top of Activity Detail
- Verify the switched-unit toast appears there
- Go back to Home and tap the total balance
- Verify no toast appears on Home
Test 5 worth a journey:
- Create a new wallet and generate test activities from Dev Settings
- Open an activity from the Home list
- Swipe the visible amount in Activity Detail sideways
- Verify the amount hides and the guidance toast appears there
- Go back to Home and swipe the total balance to reveal it
- Swipe the total balance again to hide it and verify no toast repeats
Coverage:
Unit tests: 80% - SettingsStoreTest.kt covers first-use state; CurrencyViewModelTest.kt now covers both switched-unit toast copy directions.
QA: 5 of 5 manual tests passed
Reviewed by claude-opus-5-xhigh via gh-pr-review-loop skill
Commands: @ovi-reviewer test · retest · audit (author or owner)















Description
This PR shows one-time guidance when a user first taps any balance display to switch between Bitcoin and fiat, or first swipes a visible balance to hide it. Both toasts follow the existing Android gestures across balance surfaces, including Activity Detail. The toasts use the new and previous display units, remain visible for five seconds, and stop appearing after their first eligible gesture. The guidance resets for a restored wallet and uses the available iOS translations on Android.
Design
Bitkit - Handoff v62: Wallet On-chain › Wallet BTC and Wallet Balance Hidden.
Preview
demo.mp4
QA Notes
Manual Tests
regression:Settings → Security → disable Swipe balance to hide → Home → swipe the total balance: the balance remains visible and no hide toast appears.regression:On a fresh wallet, tap the amount in Activity Detail before tapping Home’s total balance: the currency toast appears on Activity Detail and does not repeat on Home.regression:On a fresh wallet, swipe a visible amount in Activity Detail before swiping Home’s total balance: the hide toast appears on Activity Detail and does not repeat on Home.Automated Checks
SettingsStoreTest.ktcovers the first unit switch, first visible-to-hidden transition, disabled swipes, persistence, and first-use flags after restore.CurrencyViewModelTest.ktverifies the switched-unit toast title and description for Bitcoin-to-fiat and fiat-to-Bitcoin transitions.just test file CurrencyViewModelTestandjust lintchecks passed.