Skip to content

feat: crowdnode messaging regarding withdrawals#1497

Open
HashEngineering wants to merge 3 commits into
masterfrom
feat/crowdnode-messaging
Open

feat: crowdnode messaging regarding withdrawals#1497
HashEngineering wants to merge 3 commits into
masterfrom
feat/crowdnode-messaging

Conversation

@HashEngineering

@HashEngineering HashEngineering commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Related PR's and Dependencies

Screenshots / Videos

How Has This Been Tested?

  • QA (Mobile Team)

Checklist:

  • I have performed a self-review of my own code and added comments where necessary
  • I have added or updated relevant unit/integration/functional/e2e tests

Summary by CodeRabbit

  • New Features

    • Added a CrowdNode withdrawal reminder that appears after the wallet syncs when the user has a positive balance.
    • Enabled deep-linking into the staking withdrawal flow from the reminder.
  • UI Improvements

    • Redesigned the Explore screen using Jetpack Compose for a smoother, card-based navigation layout and conditional callouts.
  • Bug Fixes & Improvements

    • Improved reliability of CrowdNode status restoration by preventing overlapping restore operations.
    • Deferred the reminder until after the lock screen is dismissed when applicable.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR migrates ExploreFragment from an XML layout to Jetpack Compose (ExploreScreen), introducing a CrowdNodeWithdrawalBanner and a per-launch withdrawal reminder flow. MainViewModel detects synced wallets with positive CrowdNode balances and fires a one-time reminder event; MainActivity defers its presentation until the lock screen clears. StakingActivity gains a direct withdrawal deep-link. CrowdNodeApi serializes restoreStatus() with a Mutex.

Changes

CrowdNode Withdrawal Reminder and Explore Compose Migration

Layer / File(s) Summary
CrowdNode restoreStatus concurrency fix
integrations/crowdnode/.../CrowdNodeApi.kt
Adds restoreStatusMutex: Mutex and wraps restoreStatus() body in withLock { ... }, converting early exits to return@withLock.
ExploreScreen Compose UI and string resources
wallet/src/de/schildbach/wallet/ui/explore/ExploreScreen.kt, wallet/res/values/strings.xml
Introduces ExploreScreenState and all composables (ExploreScreen, StakingMenuItem, CrowdNodeWithdrawalBanner, previews); adds four withdrawal-reminder string resources.
ExploreFragment and ExploreEntryViewModel refactor
wallet/src/de/schildbach/wallet/ui/explore/ExploreFragment.kt, wallet/src/de/schildbach/wallet/ui/explore/ExploreEntryViewModel.kt
ExploreFragment drops its layout-based constructor, adds onCreateView returning a ComposeView, and wires all navigation through ExploreScreen callbacks. ExploreEntryViewModel adds showWithdrawalBanner: LiveData<Boolean> and moves IO operations into withContext(Dispatchers.IO).
CrowdNodeWithdrawalReminderDialog bottom sheet
wallet/src/de/schildbach/wallet/ui/staking/CrowdNodeWithdrawalReminderDialog.kt
New file with createCrowdNodeWithdrawalReminderDialog factory producing a ComposeBottomSheet containing composite logo/warning icon, localized text, and withdraw/close buttons.
StakingActivity withdrawal deep-link
wallet/src/de/schildbach/wallet/ui/staking/StakingActivity.kt
Adds EXTRA_GO_TO_WITHDRAW, createIntent(context, goToWithdraw), and maybeNavigateToWithdrawal() that navigates directly to transferFragment with WITHDRAW_ARG when the flag is set and the account is active.
MainViewModel detection and MainActivity presentation
wallet/src/de/schildbach/wallet/ui/main/MainViewModel.kt, wallet/src/de/schildbach/wallet/ui/main/MainActivity.kt
MainViewModel injects CrowdNodeApi, combines sync/signup/balance flows, and posts showCrowdNodeWithdrawalReminder once per launch. MainActivity defers presentation behind the lock screen using pendingCrowdNodeWithdrawalReminder and calls presentCrowdNodeWithdrawalReminder() which shows the dialog and starts StakingActivity with goToWithdraw=true.
Navigation and startup cleanup
wallet/res/navigation/nav_home.xml, wallet/src/de/schildbach/wallet/WalletApplication.java
Removes tools:layout attribute from exploreFragment in nav XML and updates a comment describing AppsFlyer initialization.

Sequence Diagram(s)

sequenceDiagram
  participant MainViewModel
  participant MainActivity
  participant CrowdNodeWithdrawalReminderDialog
  participant StakingActivity

  MainViewModel->>MainViewModel: combine(blockchainSyncState, signUpStatus, balance)
  Note over MainViewModel: synced + account exists + balance > 0 + not shown yet
  MainViewModel->>MainActivity: showCrowdNodeWithdrawalReminder (SingleLiveEvent)

  alt Lock screen is active
    MainActivity->>MainActivity: pendingCrowdNodeWithdrawalReminder = true
    MainActivity->>MainActivity: onLockScreenDeactivated() fires
  end

  MainActivity->>CrowdNodeWithdrawalReminderDialog: presentCrowdNodeWithdrawalReminder() → show()
  CrowdNodeWithdrawalReminderDialog-->>MainActivity: onWithdraw callback
  MainActivity->>StakingActivity: createIntent(goToWithdraw=true) → startActivity
  StakingActivity->>StakingActivity: maybeNavigateToWithdrawal()
  StakingActivity->>StakingActivity: navigate to transferFragment (WITHDRAW_ARG=true)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • dashpay/dash-wallet#1486: Provides the ComposeBottomSheet component that CrowdNodeWithdrawalReminderDialog depends on for its dialog implementation.

Suggested reviewers

  • abaranouski

Poem

🐇 Hop hop, the old XML's gone away,
Compose now paints the Explore display!
A Mutex locks the restore in line,
A reminder pops when balances shine.
Withdraw your Dash before it's too late —
The bunny has opened the staking gate! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.35% 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.
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.
Title check ✅ Passed The title accurately describes the main feature: adding CrowdNode withdrawal reminder messaging throughout the UI and business logic.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/crowdnode-messaging

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
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
wallet/src/de/schildbach/wallet/ui/explore/ExploreScreen.kt (1)

165-216: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Avoid exact Double equality for APY branch selection.

Using apy == 0.0 can render the “APY row” for tiny values that still format to 0.0, causing inconsistent UI state. Prefer a positive-threshold check for the APY variant.

Suggested fix
-    if (apy == 0.0) {
+    if (apy <= 0.0) {
         MenuItem(
             title = stringResource(R.string.staking_title),
             subtitle = stringResource(R.string.explore_staking_subtitle),
             icon = R.drawable.ic_deposit,
             action = onClick
         )
     } else {
🤖 Prompt for 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.

In `@wallet/src/de/schildbach/wallet/ui/explore/ExploreScreen.kt` around lines 165
- 216, Replace the exact equality check for APY in the conditional statement
from `apy == 0.0` with a threshold-based comparison such as `apy <= 0.0` to
handle all negligible APY values consistently. This prevents tiny positive APY
values from matching the exact zero condition while still formatting as "0.0" in
the display, which would cause the MenuItem composable to be shown instead of
the custom Row layout with the inline APY pill, creating inconsistent UI
behavior.
🤖 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.

Outside diff comments:
In `@wallet/src/de/schildbach/wallet/ui/explore/ExploreScreen.kt`:
- Around line 165-216: Replace the exact equality check for APY in the
conditional statement from `apy == 0.0` with a threshold-based comparison such
as `apy <= 0.0` to handle all negligible APY values consistently. This prevents
tiny positive APY values from matching the exact zero condition while still
formatting as "0.0" in the display, which would cause the MenuItem composable to
be shown instead of the custom Row layout with the inline APY pill, creating
inconsistent UI behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f13929cc-a227-456b-b4c2-3c620e93a072

📥 Commits

Reviewing files that changed from the base of the PR and between ced8935 and 7e58363.

📒 Files selected for processing (2)
  • wallet/src/de/schildbach/wallet/ui/explore/ExploreScreen.kt
  • wallet/src/de/schildbach/wallet/ui/staking/CrowdNodeWithdrawalReminderDialog.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • wallet/src/de/schildbach/wallet/ui/staking/CrowdNodeWithdrawalReminderDialog.kt

@HashEngineering HashEngineering changed the title Feat/crowdnode messaging feat: crowdnode messaging regarding withdrawals Jun 22, 2026
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.

1 participant