fix(amethyst): restore no-preview suppression of invoice/withdraw UI

Audit of the rich-text convergence found a behavior regression: the Android
RichTextSegmentRenderer.Payment ignored canPreview and always rendered the
interactive MayBeInvoicePreview / MayBeWithdrawal UI. The original
RenderWordWithoutPreview switchboard deliberately showed plain text for
invoice and withdraw segments when previews are suppressed ("Don't offer to
pay invoices" / "Don't offer to withdraw"). Branch on canPreview for those two;
Cashu and Clink stay unconditional (they decode locally, network only on tap),
matching the original.

Verified: :amethyst play debug compiles.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LUiGxXMbjVmgspa1X15o1V
This commit is contained in:
Claude
2026-07-16 23:42:26 +00:00
parent c90353d944
commit 0fa1a26c26
@@ -163,8 +163,11 @@ class AmethystRichTextSegmentRenderer(
modifier: Modifier,
) {
when (segment) {
is InvoiceSegment -> MayBeInvoicePreview(segment.segmentText, accountViewModel)
is WithdrawSegment -> MayBeWithdrawal(segment.segmentText, accountViewModel)
// Matches the original no-preview switchboard: don't surface a pay/withdraw
// affordance when previews are suppressed — show the raw text instead.
is InvoiceSegment -> if (canPreview) MayBeInvoicePreview(segment.segmentText, accountViewModel) else Text(segment.segmentText)
is WithdrawSegment -> if (canPreview) MayBeWithdrawal(segment.segmentText, accountViewModel) else Text(segment.segmentText)
// Cashu + Clink decode locally (network only on tap), so they render in both modes.
is CashuSegment -> CashuPreview(segment.segmentText, accountViewModel)
is ClinkOfferSegment -> ClinkOfferPreview(segment.offer, accountViewModel, nav)
else -> Text(segment.segmentText)