Repository navigation
fix(chat): render photo captions like text messages - #1124
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
ChatMediaCelldraws the caption in aLinkableBubbleView, the view text bubbles use, so links are tappable and mentions keep their pills.ChatViewControllerwiresonOpenURL,onLinkCardTapandlinkCardSourcefor media cells.ChatItem.captionPreview(for:card:).ChatMediaContent.captionIsEmojiOnly, viaEmojiOnlyDetector) draws throughChatBubbleViewas jumbo emoji with no bubble.MessageCapability.hasCopyableTextoffers Copy on a photo with a caption, and Copy copies the whole caption. Edit still keys offhasText, so photos stay uneditable.Tests are in
ChatMediaCellTests,ChatMessageMappingTests,ChatLinkCardSplitTestsandMessageCapabilityTests.Android counterpart: code-payments/code-android-app#1839.