mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 01:07:46 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user