Skip to content

feat(wallet): CrowdNode show balance message#779

Open
romchornyi wants to merge 7 commits into
masterfrom
feat/cn-balance-message
Open

feat(wallet): CrowdNode show balance message#779
romchornyi wants to merge 7 commits into
masterfrom
feat/cn-balance-message

Conversation

@romchornyi

@romchornyi romchornyi commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

This PR adds a CrowdNode balance reminder flow for users who still have funds associated with CrowdNode.

It solves the missing visibility around remaining CrowdNode balances by surfacing a reminder on the active Home flow and in Explore, and by giving users a direct path into the withdrawal flow.

What was done?

  • Added a shared CrowdNodeBalanceReminder state object to track whether a CrowdNode balance is present and whether the active-screen reminder has already been shown in the current session.
  • Added a reusable withdrawal router to centralize the logic for opening the CrowdNode withdrawal flow and handling unsupported states.
  • Added a reminder banner for Explore and a reminder bottom sheet for the active screen flow.
  • Integrated the reminder presentation into HomeViewController, including retry handling when another modal is already visible.
  • Updated the reminder flow so it presents from the currently active screen, not only from Home, which prevents the reminder from being missed when sync completion happens off-screen.
  • Updated the reminder sheet sizing behavior to better match its SwiftUI content.

How Has This Been Tested?

  • Performed a self-review of the code changes.
  • Verified the project file remains valid after the file additions and wiring updates.
  • Verified there are no conflict markers or patch-format issues in the final diff.

Breaking Changes

None.

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

Summary by CodeRabbit

  • New Features

    • Added a CrowdNode balance reminder banner and sheet, with a direct “Withdraw funds” action.
    • Added withdrawal routing that guides users to the correct CrowdNode flow.
  • Bug Fixes

    • CrowdNode balances now refresh automatically after restoring a linked online account.
    • Balance reminders now appear more reliably across Home and Explore screens, including after syncing completes.
  • Refactor

    • Removed several reusable scrolling and layout helpers while consolidating CrowdNode-related UI behavior.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cn-balance-message

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.

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeWithdrawalRouter.swift`:
- Around line 93-100: The mainAction closure in the CrowdNodeWithdrawalRouter
captures navigationController strongly, creating a retain cycle since
navigationController owns the controller that contains this closure. Modify the
closure definition to use weak capture for navigationController by adding a
capture list at the beginning of the closure (after the opening brace), and then
safely unwrap navigationController before using it in the pushViewController
call to ensure it remains valid and the reference cycle is broken.

In `@DashWallet/Sources/UI/Home/HomeViewController.swift`:
- Around line 529-535: Replace the force unwrap of invitationSetup.invitation in
the handleDeeplink call within the DASHPAY conditional block of
HomeViewController with a safe guard let statement. Instead of using
invitation!, use guard let to safely unwrap the invitation property and only
proceed with the handleDeeplink call if the invitation is present, otherwise
skip the operation.

In `@DashWallet/Sources/UI/SwiftUI` Components/SelfSizingSheet.swift:
- Around line 50-54: Remove the debug print statement in the detents computed
property of the SelfSizingSheet class. The line `print("\(height)")` executes in
production builds and should not be included unless wrapped in a `#if DEBUG`
block. Since this appears to be a temporary debug statement, delete this line
entirely to clean up the code.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 35da2df1-9355-427f-b913-b1e7489dd9cb

📥 Commits

Reviewing files that changed from the base of the PR and between fa5e4af and efba637.

📒 Files selected for processing (8)
  • DashWallet.xcodeproj/project.pbxproj
  • DashWallet/Sources/Models/CrowdNode/CrowdNodeBalanceReminder.swift
  • DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeBalanceReminderBanner.swift
  • DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeBalanceReminderSheet.swift
  • DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeWithdrawalRouter.swift
  • DashWallet/Sources/UI/Explore Dash/ExploreMenuScreen.swift
  • DashWallet/Sources/UI/Home/HomeViewController.swift
  • DashWallet/Sources/UI/SwiftUI Components/SelfSizingSheet.swift

Comment thread DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeWithdrawalRouter.swift Outdated
Comment thread DashWallet/Sources/UI/Home/HomeViewController.swift
Comment thread DashWallet/Sources/UI/SwiftUI Components/SelfSizingSheet.swift
Update balance reminder messaging and UI components for better clarity:
- Improve CrowdNodeBalanceReminderBanner and CrowdNodeBalanceReminderSheet messaging
- Update CrowdNode.swift balance calculation logic
- Enhance MayaAmountView formatting
- Improve LocalCurrencyView display
- Remove unused geometry reader utilities (FrameReader, LocationReader, ScaleToFitWidth)
- Remove unused ScrollViewWithOnScrollChanged component
- Update project configuration

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@DashWallet/Sources/Models/CrowdNode/CrowdNode.swift`:
- Around line 216-221: The restore flow in CrowdNode.swift is currently calling
refreshBalance(), which republishs prefs.lastKnownBalance before the network
fetch completes and can wrongly trigger CrowdNodeBalanceReminder from stale
cached data. Update the restore-specific path in the restore logic around the
refreshBalance() call to avoid seeding balance from cache, or gate reminder
publication until the first fresh balance fetch finishes. Keep the fix localized
to the balance refresh/reminder flow so the normal refreshBalance() behavior for
other entry points remains unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a273f069-ca2e-42ee-99b9-a7cf6177f9c5

📥 Commits

Reviewing files that changed from the base of the PR and between efba637 and b9e0c2f.

📒 Files selected for processing (13)
  • DashWallet.xcodeproj/project.pbxproj
  • DashWallet/Sources/Models/CrowdNode/CrowdNode.swift
  • DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeBalanceReminderBanner.swift
  • DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeBalanceReminderSheet.swift
  • DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeWithdrawalRouter.swift
  • DashWallet/Sources/UI/Explore Dash/ExploreMenuScreen.swift
  • DashWallet/Sources/UI/Home/HomeViewController.swift
  • DashWallet/Sources/UI/Maya/Convert/Components/MayaAmountView.swift
  • DashWallet/Sources/UI/Menu/Settings/LocalCurrency/LocalCurrencyView.swift
  • DashWallet/Sources/UI/SwiftUI Components/Geometry Readers/FrameReader.swift
  • DashWallet/Sources/UI/SwiftUI Components/Geometry Readers/LocationReader.swift
  • DashWallet/Sources/UI/SwiftUI Components/Geometry Readers/ScaleToFitWidth.swift
  • DashWallet/Sources/UI/SwiftUI Components/ScrollViews/ScrollViewWithOnScrollChanged.swift
💤 Files with no reviewable changes (4)
  • DashWallet/Sources/UI/SwiftUI Components/Geometry Readers/ScaleToFitWidth.swift
  • DashWallet/Sources/UI/SwiftUI Components/Geometry Readers/FrameReader.swift
  • DashWallet/Sources/UI/SwiftUI Components/Geometry Readers/LocationReader.swift
  • DashWallet/Sources/UI/SwiftUI Components/ScrollViews/ScrollViewWithOnScrollChanged.swift
✅ Files skipped from review due to trivial changes (1)
  • DashWallet/Sources/UI/Menu/Settings/LocalCurrency/LocalCurrencyView.swift
🚧 Files skipped from review as they are similar to previous changes (3)
  • DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeBalanceReminderSheet.swift
  • DashWallet/Sources/UI/Home/HomeViewController.swift
  • DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeBalanceReminderBanner.swift

Comment thread DashWallet/Sources/Models/CrowdNode/CrowdNode.swift Outdated
- Update project.pbxproj build settings and references
- Add SwiftPM Package.resolved for consistent dependencies
- Configure development environment for CN balance message feature
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.

4 participants