Skip to content

fix(chat): render photo captions like text messages - #1124

Merged
bmc08gt merged 5 commits into
mainfrom
feat/chat-caption-link-cards
Oct 23, 2026
Merged

bmc08gt merged 5 commits into
mainfrom
feat/chat-caption-link-cards

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

A photo caption doesn't render like the same text sent as a message. A text message with a group, profile or tip link draws the Flipcash card, an emoji-only one draws jumbo emoji, its links are tappable, and long-press offers Copy. A caption got none of that.

  • ChatMediaCell draws the caption in a LinkableBubbleView, the view text bubbles use, so links are tappable and mentions keep their pills. ChatViewController wires onOpenURL, onLinkCardTap and linkCardSource for media cells.
  • A caption that is only a group, profile or tip link draws that card under the photo. A caption with words around one follows the text message's split: the words with the link removed, then the card, then any words after the link. The rule lives in ChatItem.captionPreview(for:card:).
  • An emoji-only caption (ChatMediaContent.captionIsEmojiOnly, via EmojiOnlyDetector) draws through ChatBubbleView as jumbo emoji with no bubble.
  • MessageCapability.hasCopyableText offers Copy on a photo with a caption, and Copy copies the whole caption. Edit still keys off hasText, so photos stay uneditable.
  • Cash and token links with words around them stay caption text.
  • A web link gets no card. Neither app attaches a link preview to a caption: when the composer has one, the photo and the text go out as two messages, and that doesn't change here.

Tests are in ChatMediaCellTests, ChatMessageMappingTests, ChatLinkCardSplitTests and MessageCapabilityTests.

Android counterpart: code-payments/code-android-app#1839.

A photo caption now draws through the text bubble's LinkableBubbleView, fed a text row built from the caption, so its underlined links, mention pills, taps and the sender-attached web card under the text come from the same view a text message uses. The mapper detects links, mentions and the sender's web preview the way the text path does. Flipcash cards in captions are not drawn.
Copy now copies the caption. Edit stays text-only: the capability resolver gates it separately from copyable text.
A caption that is only a Flipcash link draws the text path's bare card under the photo, with its tap routed to the card handler. A caption of one to three emoji draws as the text path's bare enlarged emoji (ChatBubbleView) with no bubble. A Flipcash link among words stays link text.
Senders never attach a link preview to a caption: the composer sends
the photo and a separate text message that carries the card. The
caption's web-card path was unreachable, so remove it.

Captions keep mention pills, tappable links, a Flipcash card when the
caption is only that link, jumbo emoji, and Copy.
A caption with words around a group, profile or tip link showed the raw
link and no card, while the same text as a message shows the words and
the card as its own row.

The caption now takes the text path's split: the words before the link,
the card, then the words after it, with the link removed from the text.
The photo stays on top. Cash and token links keep their underlined
text, and Copy still copies the full caption.
@bmc08gt bmc08gt self-assigned this Oct 23, 2026
@bmc08gt
bmc08gt merged commit 2f857e4 into main Oct 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant