Skip to content

feat(dash-dex): add buy swap part 1#1502

Open
HashEngineering wants to merge 4 commits into
feat/dash-dex-swapkitfrom
feat/dash-dex-buy-swap-one
Open

feat(dash-dex): add buy swap part 1#1502
HashEngineering wants to merge 4 commits into
feat/dash-dex-swapkitfrom
feat/dash-dex-buy-swap-one

Conversation

@HashEngineering

@HashEngineering HashEngineering commented Jun 26, 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 new Home screen shortcut for Dash DEX, making it easier to start a swap from the main wallet screen.
    • Introduced separate buy and sell paths in the Dash DEX experience, with updated screens, icons, and labels.
  • Bug Fixes
    • Improved navigation and screen transitions across the swap flow for a smoother experience.
    • Buy options are now shown only where supported, while unsupported steps display a clear message.

HashEngineering and others added 4 commits June 22, 2026 15:30
Add a shortcut button that navigates directly into the DashDEX (Maya)
portal. Uses the SwapKit emblem recoloured to Dash brand blue.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@HashEngineering HashEngineering self-assigned this Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds a Dash DEX home shortcut and wires it into the Maya integration. It introduces buy/sell direction state, updates the Maya portal UI and navigation, and changes the crypto picker to branch on the selected direction.

Changes

Dash DEX shortcut and Maya flow

Layer / File(s) Summary
Home shortcut entry
common/src/main/java/org/dash/wallet/common/services/analytics/AnalyticsConstants.kt, wallet/res/values/strings-extra.xml, wallet/res/drawable/ic_shortcut_dash_dex.xml, wallet/src/de/schildbach/wallet/ui/main/shortcuts/ShortcutOption.kt, wallet/res/navigation/nav_home.xml, wallet/src/de/schildbach/wallet/ui/main/WalletFragment.kt
Dash DEX gets a home shortcut label, icon, enum entry, analytics event, navigation action, and tap handling.
Portal direction routing
integrations/maya/src/main/java/org/dash/wallet/integrations/maya/utils/SwapDirection.kt, integrations/maya/src/main/java/org/dash/wallet/integrations/maya/utils/SwapBackend.kt, integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaPortalFragment.kt, integrations/maya/src/main/res/navigation/nav_maya.xml
Swap direction and buy support are added, and the Maya portal now sets direction before routing through the Maya flow.
Portal screen and assets
integrations/maya/src/main/res/values/strings-maya.xml, integrations/maya/src/main/res/drawable/ic_dash_dex_*.xml, integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaPortalScreen.kt
The portal screen now uses Dash DEX strings and new drawables to render the static intro card, buy/sell rows, and updated previews.
Picker direction handling
integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaViewModel.kt, integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaCryptoCurrencyPickerFragment.kt
The view model tracks swap direction and filters the picker list, and the picker fragment branches on SELL versus BUY when a coin is tapped.

Sequence Diagram(s)

sequenceDiagram
  participant MayaPortalScreen
  participant MayaPortalFragment
  participant MayaViewModel
  participant MayaCryptoCurrencyPickerFragment
  MayaPortalScreen->>MayaPortalFragment: onBuyClick() / onSellClick()
  MayaPortalFragment->>MayaViewModel: setSwapDirection(BUY or SELL)
  MayaCryptoCurrencyPickerFragment->>MayaViewModel: read swapDirection
  alt SELL
    MayaCryptoCurrencyPickerFragment->>MayaCryptoCurrencyPickerFragment: navigate to address input screen
  else BUY
    MayaCryptoCurrencyPickerFragment->>MayaCryptoCurrencyPickerFragment: show AdaptiveDialog("Buy Swap")
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • dashpay/dash-wallet#1469: Both PRs touch the Maya flow UI and ViewModel state around coin selection and related screen behavior.

Suggested reviewers

  • abaranouski

Poem

🐇 Thump-thump, the shortcut wakes the den,
Dash DEX hops in from home again.
Buy and sell now split their way,
Moonlit icons brighten the clay.
Little paws tap, and off we go!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 is concise and accurately reflects the main change: the first part of adding Dash DEX buy swap functionality.
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.
✨ 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/dash-dex-buy-swap-one

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.

@HashEngineering HashEngineering changed the title Feat/dash dex buy swap one feat(dash-dex): add buy swap part 1 Jun 26, 2026
@HashEngineering

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaViewModel.kt (1)

156-165: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Direction state added as a standalone flow rather than folded into a UIState.

_swapDirection/swapDirection are correctly exposed (private mutable + asStateFlow(), StateFlow), but they add yet another separate flow to a ViewModel that the guidelines say should converge on a single UIState data class. This matches the file's existing pattern, so consider it non-blocking, but worth noting for future consolidation.

As per coding guidelines: "ViewModels should use a single UIState data class rather than multiple separate flows".

🤖 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
`@integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaViewModel.kt`
around lines 156 - 165, The swap direction is currently exposed as its own
MutableStateFlow/StateFlow pair in MayaViewModel, but the ViewModel should
converge on a single UIState model. Fold _swapDirection and swapDirection into
the existing UIState data class and update setSwapDirection to mutate that state
instead of maintaining a separate flow.

Source: Coding guidelines

🤖 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
`@integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaCryptoCurrencyPickerFragment.kt`:
- Around line 91-92: The “navigating to address input” log in
MayaCryptoCurrencyPickerFragment’s onCurrencySelected flow is misleading because
it runs before the SwapDirection.SELL check even though the BUY path shows a
dialog instead of navigating. Move the log into the SELL branch that performs
the navigation, or change the message to describe the shared selection step, so
the log matches the actual behavior in this fragment and its viewModel
swapDirection logic.

In `@wallet/src/de/schildbach/wallet/ui/main/WalletFragment.kt`:
- Around line 409-412: The Dash DEX shortcut path in WalletFragment’s shortcut
handling jumps directly to homeToMaya() without setting the swap backend first,
which can leave stale provider state active. Update this ShortcutOption.DASH_DEX
branch to reuse the same backend-selection flow used by buySellToMaya(),
explicitly selecting SwapBackend.MAYA/SWAPKIT before navigation, then continue
through the existing navigation path.

---

Nitpick comments:
In
`@integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaViewModel.kt`:
- Around line 156-165: The swap direction is currently exposed as its own
MutableStateFlow/StateFlow pair in MayaViewModel, but the ViewModel should
converge on a single UIState model. Fold _swapDirection and swapDirection into
the existing UIState data class and update setSwapDirection to mutate that state
instead of maintaining a separate flow.
🪄 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: a50cefae-f631-4958-88b3-237bcbdd4449

📥 Commits

Reviewing files that changed from the base of the PR and between 2e75d5d and a06ff40.

📒 Files selected for processing (17)
  • common/src/main/java/org/dash/wallet/common/services/analytics/AnalyticsConstants.kt
  • integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaCryptoCurrencyPickerFragment.kt
  • integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaPortalFragment.kt
  • integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaPortalScreen.kt
  • integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/MayaViewModel.kt
  • integrations/maya/src/main/java/org/dash/wallet/integrations/maya/utils/SwapBackend.kt
  • integrations/maya/src/main/java/org/dash/wallet/integrations/maya/utils/SwapDirection.kt
  • integrations/maya/src/main/res/drawable/ic_dash_dex_buy.xml
  • integrations/maya/src/main/res/drawable/ic_dash_dex_illustration.xml
  • integrations/maya/src/main/res/drawable/ic_dash_dex_sell.xml
  • integrations/maya/src/main/res/navigation/nav_maya.xml
  • integrations/maya/src/main/res/values/strings-maya.xml
  • wallet/res/drawable/ic_shortcut_dash_dex.xml
  • wallet/res/navigation/nav_home.xml
  • wallet/res/values/strings-extra.xml
  • wallet/src/de/schildbach/wallet/ui/main/WalletFragment.kt
  • wallet/src/de/schildbach/wallet/ui/main/shortcuts/ShortcutOption.kt

Comment thread wallet/src/de/schildbach/wallet/ui/main/WalletFragment.kt

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

Approved

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