Skip to content

fix: show first-time balance gesture toasts - #1272

Merged
ovitrif merged 4 commits into
masterfrom
codex/first-balance-gesture-toasts
Sep 17, 2026
Merged

ovitrif merged 4 commits into
masterfrom
codex/first-balance-gesture-toasts

Conversation

@pwltr

@pwltr pwltr commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

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

  • 1. Fresh wallet → Home → tap the total balance: the switched-unit toast names the new unit and the previous unit; a second tap shows no toast.
  • 2. Fresh wallet → Home → swipe a visible total balance horizontally: the balance hides and the guidance toast appears; reveal it with a swipe or the eye icon, then hide it again without another toast.
  • 3. regression: Settings → Security → disable Swipe balance to hide → Home → swipe the total balance: the balance remains visible and no hide toast appears.
  • 4. 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.
  • 5. 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.kt covers the first unit switch, first visible-to-hidden transition, disabled swipes, persistence, and first-use flags after restore.
  • CurrencyViewModelTest.kt verifies the switched-unit toast title and description for Bitcoin-to-fiat and fiat-to-Bitcoin transitions.
  • Local just test file CurrencyViewModelTest and just lint checks passed.

@greptile-apps

greptile-apps Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

The PR is not yet safe to merge because transaction sheets lose their balance display after the latest overlay refactor.

Summary

This PR adds persistent, one-time guidance for balance unit switching and swipe-to-hide gestures, resets the guidance after wallet restoration, and supplies localized toast text.

  • Atomically switches display units and records whether first-use guidance has been consumed.
  • Shows five-second guidance toasts through the currency and settings view models.
  • Distinguishes swipe hiding from eye-icon revealing.
  • Adds persistence and restore coverage in SettingsStoreTest.
  • The latest sheet-overlay refactor introduces a regression in the transaction-sheet balance display.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  G[Balance gesture] --> S[SettingsStore atomic update]
  S -->|First eligible gesture| V[ViewModel]
  S -->|Already consumed| N[No guidance]
  V --> T[Five-second toast]
  S --> P[Persist consumed flag]
  R[Wallet restore] --> X[Reset guidance flags]
Loading

Reviews (2) · Last reviewed commit: "fix: show hide toast on all balance swip..."

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Regtest APK

Built from c988cf7 (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pwltr
pwltr marked this pull request as draft September 16, 2026 10:19
@pwltr

pwltr commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Drafted to give preference to #1273, to see if it possible to show toasts from sheets

@pwltr
pwltr force-pushed the codex/first-balance-gesture-toasts branch from c6aaa03 to ba448d0 Compare September 17, 2026 11:22
@pwltr
pwltr changed the base branch from master to codex/boost-toast-overlay September 17, 2026 11:23
@pwltr
pwltr added this pull request to stack #1302 September 17, 2026 11:24
@pwltr
pwltr marked this pull request as ready for review September 17, 2026 11:28
@pwltr
pwltr force-pushed the codex/first-balance-gesture-toasts branch 2 times, most recently from 66690fd to 8ba7b8b Compare September 17, 2026 12:11
@pwltr
pwltr requested review from jvsena42 and ovitrif September 17, 2026 13:07
ovi-reviewer[bot]

This comment was marked as resolved.

ovi-reviewer[bot]

This comment was marked as resolved.

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validated manually

stacked auto-merge was automatically disabled September 17, 2026 20:51

Pull Request is not mergeable

stacked auto-merge was automatically disabled September 17, 2026 20:55

Pull Request is not mergeable

stacked auto-merge was automatically disabled September 17, 2026 21:00

Pull Request is not mergeable

stacked auto-merge was automatically disabled September 17, 2026 21:48

Pull Request is not mergeable

stacked auto-merge was automatically disabled September 17, 2026 21:49

Pull Request is not mergeable

Base automatically changed from codex/boost-toast-overlay to master September 17, 2026 22:15
@jvsena42
jvsena42 force-pushed the codex/first-balance-gesture-toasts branch from b269d78 to c988cf7 Compare September 17, 2026 22:15

@ovi-reviewer ovi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

  1. ✅ passed: the first tap named the new and the previous unit; the second and third taps switched silently.

    Test 1:
    Fresh wallet → Home → tap the total balance: the switched-unit toast names the new unit and the previous…
    1.mp4
  2. ✅ passed: the swipe hid the balance and toasted; the eye-icon reveal and a second hide stayed silent.

    Test 2:
    Fresh wallet → Home → swipe a visible total balance horizontally: the balance hides and the guidance toast…
    2.mp4
  3. ✅ passed: with the setting off the balance stayed visible and no hide toast appeared.

    Test 3:
    `regression:` Settings → Security → disable Swipe balance to hide → Home → swipe the total balance: the…
    3.mp4
  4. ✅ passed: Activity Detail's amount toasted on the first tap; Home's balance then switched without one.

    Test 4:
    `regression:` On a fresh wallet, tap the amount in Activity Detail before tapping Home’s total balance: the…
    4.mp4
  5. ✅ passed: Activity Detail's amount hid with a toast; Home's swipes then hid it without one.

    Test 5:
    `regression:` On a fresh wallet, swipe a visible amount in Activity Detail before swiping Home’s total…
    5.mp4

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)

@ovitrif
ovitrif merged commit d142c4c into master Sep 17, 2026
19 checks passed
@ovitrif
ovitrif deleted the codex/first-balance-gesture-toasts branch September 17, 2026 23:49
@piotr-iohk piotr-iohk mentioned this pull request Oct 16, 2026
3 of 5 tasks
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.

3 participants