Skip to content

refactor(ui): extract shared AmountEntryScreen and AmountEntryDelegate#829

Merged
bmc08gt merged 9 commits into
code/cashfrom
refactor/shared-amount-entry
Jun 5, 2026
Merged

refactor(ui): extract shared AmountEntryScreen and AmountEntryDelegate#829
bmc08gt merged 9 commits into
code/cashfrom
refactor/shared-amount-entry

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Extract duplicated amount-entry UI and ViewModel logic into a shared module (apps/flipcash/shared/amount-entry). The new AmountEntryDelegate encapsulates NumberInputHelper, currency observation, and animated model management. The new AmountEntryScreen composable provides the unified Column { AmountWithKeypad + CodeButton/SlideToConfirm } layout.

Migrated Send, Cash (Give), Swap (Buy/Sell), and Withdrawal features to use the shared components, eliminating ~250 lines of duplicated code.

@bmc08gt bmc08gt self-assigned this Jun 2, 2026
@github-actions github-actions Bot added type: refactor Code restructuring, no behavior change area: payments Payments, transfers, intents, billing area: build-system Gradle, convention plugins, build-logic area: tokens Token accounts, balances, token info labels Jun 2, 2026
bmc08gt added 2 commits June 2, 2026 16:25
Extract duplicated amount-entry UI and ViewModel logic into a shared
module (apps/flipcash/shared/amount-entry). The new AmountEntryDelegate
encapsulates NumberInputHelper, currency observation, and animated model
management. The new AmountEntryScreen composable provides the unified
Column { AmountWithKeypad + CodeButton/SlideToConfirm } layout.

Migrated Cash (Give), Swap (Buy/Sell), and Withdrawal features to use
the shared components, eliminating ~250 lines of duplicated code.

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
…Delegate

AmountEntryDelegate now derives AmountEntryConfig internally from
style, loadingState, maxAmount, and minimumAmount flows passed at
construction. VMs provide structured AmountEntryStyle inputs instead
of owning a secondary config StateFlow, eliminating the only instance
of a secondary StateFlow on any BaseViewModel in the codebase.

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
@bmc08gt bmc08gt force-pushed the refactor/shared-amount-entry branch 2 times, most recently from 3dc825f to fa75fbd Compare June 3, 2026 14:56
…estability

AmountEntryDelegate now implements AmountEntryController, which
captures the screen-facing API (state, config, keypad input).
AmountEntryScreen takes the interface instead of the concrete class,
enabling Compose UI tests with a trivial FakeController — no Exchange
mock, coroutine scope, or flow wiring required.

Adds 10 Robolectric Compose UI tests covering action labels, enabled
state, loading transitions, confirm callback, slide variant, hints,
and keypad forwarding.

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
@bmc08gt bmc08gt force-pushed the refactor/shared-amount-entry branch from fa75fbd to e319a6b Compare June 3, 2026 14:58
bmc08gt added 3 commits June 3, 2026 11:01
…, and WithdrawalConfirmation

Add Robolectric-based Compose UI tests following the established pattern
from AmountEntryScreenTest. Includes receipt, currency conversion, and
bonding curve token rendering tests. Extract compose-ui-testing bundle
and enable isIncludeAndroidResources globally in the convention plugin.

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
…Model API

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
@bmc08gt bmc08gt marked this pull request as ready for review June 3, 2026 15:27
bmc08gt added 2 commits June 3, 2026 12:03
Gradle 9 fails test tasks when test dependencies exist but no test
classes are discovered. Set failOnNoDiscoveredTests to false in the
convention plugin since kotlin-test-junit is added to all modules.
Keep refactored AmountEntryScreen usage, discard old AmountWithKeypad
inline implementation that was replaced by the shared module.
@github-actions github-actions Bot added area: onramp Deposit, purchase, Coinbase, fiat on-ramp area: deeplinks Deep link handling, URL routing, and link parsing area: session area: onboarding labels Jun 5, 2026
Include :libs:test-utils as a testImplementation dependency in the
base library convention plugin so all modules pick up the
robolectric.properties file pinning SDK to 36. Remove the now-redundant
manual declarations from 15 individual modules.
@bmc08gt bmc08gt force-pushed the refactor/shared-amount-entry branch from a058b94 to e9bc21d Compare June 5, 2026 13:06
@bmc08gt bmc08gt merged commit bc0ae80 into code/cash Jun 5, 2026
3 checks passed
@bmc08gt bmc08gt deleted the refactor/shared-amount-entry branch June 5, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build-system Gradle, convention plugins, build-logic area: deeplinks Deep link handling, URL routing, and link parsing area: onboarding area: onramp Deposit, purchase, Coinbase, fiat on-ramp area: payments Payments, transfers, intents, billing area: session area: tokens Token accounts, balances, token info type: refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant