Skip to content

feat(wallet): CrowdNode show balance message#779

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

feat(wallet): CrowdNode show balance message#779
romchornyi wants to merge 3 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

Release Notes

  • New Features
    • Added CrowdNode Balance Reminder that notifies users when they have funds available to withdraw.
    • Reminder appears as a banner on the Explore screen and as a modal on the home screen.
    • Users can now initiate fund withdrawals directly from the reminder interface.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@romchornyi, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 38 minutes and 4 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5a097354-30e2-4fde-90af-4bc748212c54

📥 Commits

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

📒 Files selected for processing (3)
  • DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeWithdrawalRouter.swift
  • DashWallet/Sources/UI/Explore Dash/ExploreMenuScreen.swift
  • DashWallet/Sources/UI/Home/HomeViewController.swift
📝 Walkthrough

Walkthrough

Adds a CrowdNode Balance Reminder feature: a new CrowdNodeBalanceReminder observable model tracks balance state and session-scoped dismissal flags; new SwiftUI views (CrowdNodeBalanceReminderBanner, CrowdNodeBalanceReminderSheet) render the reminder UI; CrowdNodeWithdrawalRouter handles navigation gating; HomeViewController and ExploreMenuScreen integrate the reminder. The DashUIKit local package is wired into the Xcode project.

Changes

CrowdNode Balance Reminder Feature

Layer / File(s) Summary
Xcode project wiring
DashWallet.xcodeproj/project.pbxproj
Adds DashUIKit as a local Swift package reference/product dependency linked to the Frameworks build phase; registers PBXFileReference and PBXBuildFile entries for the four new Swift files; creates the BalanceReminder group; wires all new sources into two target build phases.
CrowdNodeBalanceReminder observable model
DashWallet/Sources/Models/CrowdNode/CrowdNodeBalanceReminder.swift
@MainActor ObservableObject with published balance/flag state, computed display-gate properties (shouldShowOnActiveScreen, shouldShowOnExplore), a Combine initializer subscribing to crowdNode.$balance, session-scoped dismiss/shown control methods, and a balance-zero state-reset transition.
Balance reminder banner and sheet views
DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeBalanceReminderBanner.swift, DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeBalanceReminderSheet.swift
CrowdNodeBalanceReminderBanner renders a horizontal warning banner with a DashUIKit withdraw button; CrowdNodeBalanceReminderSheet renders a full sheet with warning image, localized text, and withdraw/close buttons, including two SwiftUI previews (one wrapping a DashUIKit.BottomSheet.selfSizing).
CrowdNodeWithdrawalRouter navigation flow
DashWallet/Sources/UI/CrowdNode/BalanceReminder/CrowdNodeWithdrawalRouter.swift
openWithdrawal(from:) gates on SyncingActivityMonitor.syncDone, restores CrowdNode state, branches on signUpState, enforces canWithdraw with a BasicInfoController error screen wired to authenticate(), and otherwise presents a BaseNavigationController pushing CrowdNodeTransferController in withdraw mode.
HomeViewController integration
DashWallet/Sources/UI/Home/HomeViewController.swift, DashWallet/Sources/UI/SwiftUI Components/SelfSizingSheet.swift
Adds internal flags for sync-observer registration and reminder state tracking; subscribes to CrowdNodeBalanceReminder.shared.$hasBalance; adds helpers to present the SwiftUI bottom sheet on the active top controller with UIKit detents, retry scheduling, dismissal clearing, and withdrawal routing; updates sync-completion handler to trigger presentCrowdNodeBalanceReminderIfNeeded(); adds a debug print in SelfSizingSheet.detents.
ExploreMenuScreen banner integration
DashWallet/Sources/UI/Explore Dash/ExploreMenuScreen.swift
Adds @ObservedObject balanceReminder from CrowdNodeBalanceReminder.shared; conditionally renders CrowdNodeBalanceReminderBanner when shouldShowOnExplore is true; adds showCrowdNodeWithdrawal() calling CrowdNodeWithdrawalRouter.openWithdrawal(from:).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐇 A balance sits waiting in CrowdNode's care,
The rabbit twitches its nose—funds are there!
A banner appears, a sheet softly glows,
"Withdraw your Dash!" the reminder bestows.
Through routers and syncing, the flow finds its way,
The bunny hops proud—reminders saved the day! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.04% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(wallet): CrowdNode show balance message' directly summarizes the main change: adding a CrowdNode balance reminder feature to display messages about remaining funds to users.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

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

2 participants