Skip to content

refactor(compose): shared AmountEntryPage; move the DEX enter-amount screen onto it - #1678

Open
HashEngineering wants to merge 5 commits into
feat/advanced-payments-screenfrom
feat/shared-amount-entry-page
Open

HashEngineering wants to merge 5 commits into
feat/advanced-payments-screenfrom
feat/shared-amount-entry-page

Conversation

@HashEngineering

@HashEngineering HashEngineering commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Part of MO-1123 (External Receive). Stacked on #1677 (Advanced payments screen), which sits on #1675 → feat/kotlin-sdk-phase-1. Retarget this PR's base as the PRs below it merge.

Why

The Receive tab's "Specify amount" opens an Enter-amount page inside the payments screen. That page needs a reusable Compose amount entry; today each screen combines EnterAmount, NumericKeyboardCompose and processAmountKeyInput by hand.

What

  • AmountEntryPage (common/.../ui/enter_amount/AmountEntryPage.kt): the EnterAmount bar, a flexible gap and the keypad flush with the bottom edge.
    • Slots: header, belowAmount, primaryButton.
    • Max / balance buttons only when onMaxClick / onBalanceClick are passed (the Receive page passes neither).
    • Dash/fiat switching via the currency picker (onCurrencySelected) or tap-to-toggle (secondaryAmount + tap handlers).
    • State hoisted: raw keys go to onKeyInput, and the owner (usually its ViewModel) applies processAmountKeyInput, so decimal places stay per currency. The page only localizes the decimal separator for display.
  • AmountEntryPrimaryButton: the standard Continue button with the DEX inset.
  • DEXEnterAmountScreen now uses the page. Layout and behaviour are unchanged.
  • PurchaseGiftCardScreenV2 is not migrated: only one of its three modes shows the keypad, inside a scrolling column, with different button spacing, so the page would need special cases just for it.
  • Moves processAmountKeyInput's KDoc back above the function.

Tests

  • AmountEntryInputTest (7): processAmountKeyInput (leading zero, single decimal point, decimal limit, back, back_long) and the separator helpers.
  • :wallet:compile_testNet3DebugKotlin, ktlintFormat and /pre-review (0 findings) are clean.
  • Manual, prod debug build on an emulator (Dash DEX → Buy Dash → Bitcoin): typing and decimal limit, EUR/DASH/BTC picker, backspace and long-press clear, Continue enable/disable, offline dimming and toast. All as before. DashDEX doesn't work on testnet, so this needs a mainnet build. No quote was requested.

Previews

AmountEntryPage: Receive-style (picker + Continue), everything on, German locale with the keypad disabled.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a reusable amount-entry screen with a numeric keypad, currency selection, optional balance and maximum-amount actions, and customizable content.
    • Amounts now display decimal separators according to the selected locale.
    • Updated the Maya exchange amount screen to use the shared entry experience, with Continue unavailable while offline or during validation.
  • Bug Fixes
    • Disabled keypad input is visibly dimmed and does not accept taps.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 38a2ede and a633d90.

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

No actionable comments were generated in the recent review.

Walkthrough

The common module adds a configurable Compose amount-entry page, locale display helpers, and input tests. The Maya DEX amount screen uses the shared page and button helper.

Changes: Amount Entry Flow

Layer / File(s) Summary
Shared amount-entry page and validation
common/src/main/java/org/dash/wallet/common/ui/enter_amount/AmountEntryPage.kt, common/src/main/java/org/dash/wallet/common/ui/enter_amount/EnterAmountCompose.kt, common/src/test/java/org/dash/wallet/common/ui/enter_amount/AmountEntryInputTest.kt
The common module adds locale display helpers, a configurable amount-entry page, a primary-button helper, and previews. Tests cover keypad input rules and locale-specific display, including trailing decimal separators.
Maya DEX screen adoption
integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/DEXEnterAmountScreen.kt
The screen replaces its manual amount field, keypad, and Continue button composition with the shared page. The keypad is disabled when offline or validating. Continue is enabled only when continueEnabled and online.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: thepastaclaw, abaranouski

Merge Risk: Minimal · previous review 38a2e

The amount-entry migration preserves the checked DEX input and disabled-keypad behavior. No merge-blocking issue is established.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: extracting a shared AmountEntryPage and migrating the DEX amount-entry screen to use it.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 4 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4ee5970 and 38a2ede.

Files selected for processing: 4

  • common/src/main/java/org/dash/wallet/common/ui/enter_amount/AmountEntryPage.kt
  • common/src/main/java/org/dash/wallet/common/ui/enter_amount/EnterAmountCompose.kt
  • common/src/test/java/org/dash/wallet/common/ui/enter_amount/AmountEntryInputTest.kt
  • integrations/maya/src/main/java/org/dash/wallet/integrations/maya/ui/DEXEnterAmountScreen.kt

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@thepastaclaw

thepastaclaw commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

♻️ No change to this PR's diff since commit 38a2ede (an empty commit, a merge of the base or a rebase onto it): that review stands — approved; @thepastaclaw review asks for a review of this commit (commit a633d90)

…enter-amount screen onto it

AmountEntryPage (common) combines the EnterAmount bar, NumericKeyboardCompose and the
locale display boundary, with header/belowAmount/primaryButton slots and optional
Max/balance buttons, Dash/fiat picker or tap-to-toggle secondary amount. State stays
hoisted: keys go to the owner, which applies processAmountKeyInput.

DEXEnterAmountScreen now uses it with no change in layout or behaviour.
PurchaseGiftCardScreenV2 is left as is: only one of its three modes shows the keypad,
inside a scrolling column, with different button spacing.

Adds unit tests for processAmountKeyInput and the display-separator helpers, and
moves the processAmountKeyInput KDoc back above its function.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HashEngineering
HashEngineering force-pushed the feat/shared-amount-entry-page branch from d2cd61f to f65ae1a Compare November 10, 2026 07:31
HashEngineering added a commit that referenced this pull request Nov 10, 2026
…ry-rows

Picks up cac4f5c (phase-1 through #1675, #1677/#1678/#1680, int37 pin).

Conflicts resolved by keeping both sides:
- AppDatabaseMigrations: our 22->23 tx_display_cache.source migration plus
  the base's data-only removeCrowdNodeCacheRows callback (base stays at v22,
  so AppDatabase is v23 with 23.json unchanged).
- PlatformSyncService: both shieldedHistoryRowSync and
  transparentUsernameCreation constructor params; the six platform tests and
  IdentityConditionalWriteTest pass both.
- DatabaseMigrationTest: our migrate22to23 plus the base's crowdnode cache
  tests; its migrations array now includes migration22to23.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HashEngineering
HashEngineering marked this pull request as ready for review November 11, 2026 01:08

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

Final validation — Phase 1 + Phase 2

Verified the complete diff at 38a2ede against the supplied base and traced the shared controls, DEX state handling, and lifecycle. No actionable in-scope defects were found: the extraction preserves DEX callback wiring, display-only localization, layout, and enablement behavior while retaining amount processing in the ViewModel. This was a static review; current build and check jobs pass, and only the automated review remains pending.

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is an ordinary multi-file Compose UI refactor introducing reusable amount-entry behavior and tests, without changing funds movement, cryptography, or another critical surface.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer

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