Skip to content

fix(dashpay): persist Upgrade-to-DashPay banner dismissal (Hide now works) - #900

Merged
romchornyi merged 2 commits into
swift-sdk-integrationfrom
fix/sb-8-dashpay-banner-hide
Jul 30, 2026
Merged

fix(dashpay): persist Upgrade-to-DashPay banner dismissal (Hide now works)#900
romchornyi merged 2 commits into
swift-sdk-integrationfrom
fix/sb-8-dashpay-banner-hide

Conversation

@romchornyi

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Tapping Hide on the "Upgrade to DashPay — Your Shielded balance is ready" banner did nothing — the banner stayed (reported as SB-8 during shielded-balance testing). Two causes:

  1. UsernamePrefs.joinDashPayDismissed cached the value in an in-memory scalar and stored it under a global key — stale after a network round-trip and leaking between Mainnet/Testnet.
  2. HomeViewModel only honored the dismissal when the wallet already had an identity (identityScopedDismissal = hasIdentity && dismissed). But the banner shows precisely when the user has no identity yet ("register your username"), so Hide was ignored in exactly the case it's offered.

What was done?

  • Persist the dismissal per active wallet + network (JoinDashPayDismissalScope → key joinDashPayDismissed.v2.<network>.<wallet>), reading/writing UserDefaults directly (no stale in-memory scalar). This keeps the choice attached to the wallet/network where it was made and survives readiness re-evaluation and leaving/returning to the network.
  • Honor the dismissal unconditionally in banner visibility via a testable JoinDashPayBannerPolicy.shouldShow(contextReady:syncDone:dismissed:hasRegisteredUsername:hasRegistrationInProgress:) — no longer gated on hasIdentity, so Hide works before an identity exists.
  • Added SwiftDashSDKCoreLifecycleTests cases for the banner policy.

How Has This Been Tested?

Manual, testnet: tapping Hide on the Upgrade-to-DashPay banner now dismisses it immediately and it stays hidden across shielded-readiness re-evaluations and network round-trips within the session. Upgrade still works; Hide and Upgrade are independent. (Unit-test target is pre-existing broken; the added tests are compile-ready.)

Breaking Changes

None. New scoped key (.v2.) — a prior global dismissal simply isn't read; the banner reappears once and can be re-hidden, now persistently.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Why:
- Hide was ignored before identity creation because banner gating only honored dismissal for wallets that already had an identity
- the legacy global preference could not safely survive network switches

What:
- scope dismissal storage to the active wallet and network
- apply dismissal independently of identity existence
- cover pre-identity hiding and scope isolation with regression tests

Validation:
- dashwallet-dashpay arm64 iOS Simulator build succeeds
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dcb7dd3b-c89c-45e2-b026-ac6518e0c4a4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@romchornyi
romchornyi requested a review from llbartekll July 29, 2026 16:24

@llbartekll llbartekll 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.

The Home banner now honors the scoped dismissal, but the same Upgrade-to-DashPay banner in More/Menu still does not. MainMenuViewController's Hide action only calls markAsDismissed(), while CurrentUserProfileModel.updateShowJoinDashpay() never reads UsernamePrefs.shared.joinDashPayDismissed (and no dismissal event triggers a recomputation there). As a result, tapping Hide in the menu still leaves the banner visible. Please apply the same scoped dismissal policy to the menu/profile model and refresh it after Hide.

Apply the wallet-and-network-scoped dismissal policy to the menu profile model and refresh its published visibility immediately after Hide.

Validation: dashwallet-dashpay arm64 iOS Simulator build succeeds.
@romchornyi
romchornyi requested a review from llbartekll July 30, 2026 10:05

@llbartekll llbartekll 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.

Looks good

@romchornyi
romchornyi merged commit 8e211e6 into swift-sdk-integration Jul 30, 2026
2 checks passed
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