Skip to content

refactor(scannable): introduce Scannable hierarchy replacing Bill#1116

Merged
bmc08gt merged 4 commits into
code/cashfrom
refactor/scannable-hierarchy
Jul 22, 2026
Merged

refactor(scannable): introduce Scannable hierarchy replacing Bill#1116
bmc08gt merged 4 commits into
code/cashfrom
refactor/scannable-hierarchy

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

What

Replaces the single-variant Bill sealed interface with a Scannable ancestor that holds only the scannable code, and payment-bearing children under Scannable.Payable:

  • Scannable — holds only data (the encoded KikCode bytes)
  • Scannable.Payable — token/amount/didReceive/…, metadata, stamped()
    • Scannable.CashBill, Scannable.GoldBar
  • Scannable.TipCard — directly under Scannable (non-payment)

Why

Bill conflated three things: the domain concept, the render choice (the renderAsBill flag), and a payment sub-kind. Hoisting a Scannable parent turns the render choice into a real type distinction and lets non-payment scannables (tip cards) reuse the bill pipeline later without dragging payment concerns along.

Changes

  • forToken factory — the USDF→GoldBar rule (formerly the runtime renderAsBill flag) is now decided once at construction; renderAsBill is removed.
  • stamped(code, nonce) replaces .copy(data =, nonce =) at the sealed-interface seam in presentBillToUser (a data-class copy isn't callable on a Payable reference).
  • RenderedBill dispatches on type (is CashBill / is GoldBar) instead of the boolean flag.
  • Migrated every consumer: scan / cash-link / currency-creator / customization delegates, AnimatedBill, and the three customization guards (narrowed to Scannable.CashBill).
  • Existing tests migrated; new ScannableTest covers forToken routing + stamped type-preservation; the airdrop path now asserts awaitGrab is never called.
  • Drive-by: a one-line correctness fix to the image-moderation error message in the same currency-creator file.

Testing

  • ./gradlew :apps:flipcash:app:assembleDebug — BUILD SUCCESSFUL (standalone)
  • :apps:flipcash:core and :apps:flipcash:shared:session unit tests pass

bmc08gt added 4 commits July 21, 2026 23:31
…rough assertions

- Convert positional GoldBar/CashBill constructor calls in forToken to named
  arguments to prevent silent field-order drift
- Extend forToken passthrough test to assert every forwarded field
  (disableGestures, confirmationDelay, data, nonce) with non-default values
- Assert bar.token survives stamped copy in GoldBar stamped test
Replaces the single-variant Bill sealed interface with Scannable.Payable
(CashBill/GoldBar). renderAsBill removed; USDF->GoldBar decided by the
forToken factory. presentBillToUser uses stamped(); customization guards
narrow to Scannable.CashBill.

Signed-off-by: Brandon McAnsh <brandon@bmcreations.dev>
@github-actions github-actions Bot added type: refactor Code restructuring, no behavior change area: payments Payments, transfers, intents, billing area: ui Compose UI, theme, components, resources area: scanner QR/Kikcode scanning, camera area: session labels Jul 22, 2026
@bmc08gt
bmc08gt merged commit b6e1aa2 into code/cash Jul 22, 2026
3 checks passed
@bmc08gt
bmc08gt deleted the refactor/scannable-hierarchy branch July 22, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: payments Payments, transfers, intents, billing area: scanner QR/Kikcode scanning, camera area: session area: ui Compose UI, theme, components, resources type: refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant