From 0fa1a26c269c456b35597786e56cc755d71b4170 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 16 Jul 2026 23:42:26 +0000 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01LUiGxXMbjVmgspa1X15o1V --- .../amethyst/ui/components/AmethystRichText.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/AmethystRichText.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/AmethystRichText.kt index 81c42aa64e..a9c5635992 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/AmethystRichText.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/AmethystRichText.kt @@ -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)