Repository navigation
feat(chat): group invite link card, and a row per link card - #1530
Merged
Merged
Conversation
A carded link drew inside the message's bubble, with the URL cut out of the text around it. The message now splits into up to three transcript rows, as on iOS (code-ios-app#830): the text before the link, the card with no bubble behind it, and the text after. Blank segments are dropped, and the rows key as the message id plus `#leading`, `#card` or `#trailing`. Every row keeps the whole message, so selection, copy, edit, reply, retry, jumps and the jump highlight act on the message from whichever row they start on; selection now compares `messageKey` instead of the row key. The reply citation goes on the first row and the "Edited" marker and receipt on the last. A card row breaks the bubble run the way a bare emoji does, and its "Edited" marker moves to the metadata line under it. The view model emits the rows bottom-first because the list is reverseLayout. LinkCardView now owns the card's tap and hands a long press back to the transcript, which the bare row needs to stay selectable. `withoutLinkSpan` and its test go, since no row cuts the link out of its text any more.
A link to `app.flipcash.com/chat/{uuid}` stayed plain text. It now gets
a card, as on iOS (code-ios-app#830). `/chat/{uuid}/send` and the tip chat
route are still refused.
The card reads the group with GetChat in the redacted view, which answers
for non-members, and uses only its title, picture, roster summary and
rules. `members` is never read, so no member name or avatar can reach the
card. An untitled group is named "Group Chat" for now, pending copy.
Layout follows the group header card (nodes 10125:19157, 10127:118280,
10127:116723): radius 12, a white 10% stroke, a 46dp band across the top
tinted at 28% opacity, and a 64dp ringed avatar centred on the band's
bottom edge. Under it are the title, the member count and the rule, as
`ChatInfoCard` renders them, then a 44dp button at least 16dp below.
The band's colour is the picture's blurhash DC component, falling back to
the avatar placeholder gradient's first stop.
`BlurHash.averageColor` is checked against the shared
`blurhash_average.json` vectors.
The card is as wide as the cash card, and its height is the larger of its
content and width × 224/328, measured intrinsically at the card's own
width. So a wrapped requirement line or a large font scale grows the row
instead of overlapping its neighbours.
Only the button takes a tap. "Start Chatting" pushes the group's
conversation onto the root stack, so Back returns to the chat holding the
link, and the pushed screen handles joining or buying. A card linking to
the chat on screen does nothing. An unavailable group shows only the band
and a disabled "Group Unavailable" button.
The label and the amount now break onto two lines, in the chat header and the group invite card alike, since both read the same strings.
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.
Ports code-payments/code-ios-app#830 to Android. It's two commits, meant to be reviewed in order.
1. A link card gets its own row
A message with a carded link (cash link, token info, group invite) now becomes up to three transcript items: the text before the URL as a bubble, the card with no bubble behind it, and the text after as a bubble. Rows keep source order, blank segments are dropped, and each row's id is the message id plus
#leading,#cardor#trailing.Every row carries the whole message. Selection, reactions, reply, edit, delete, copy (whole text), retry, quote jumps and the jump highlight all act on the message from any row. The reply quote goes on the first row, and "Edited" plus the receipt go on the last. On a bare card row, "Edited" moves to the metadata line. A card row breaks the bubble-grouping run the way a bare emoji does. Other links in the text stay underlined inline, and a message has at most one card.
2. Group invite card
app.flipcash.com/chat/{uuid}now classifies to a card./chat/{uuid}/sendand the tip chat route are still refused. The card is fetched with GetChat inViewMode.REDACTEDand built fromtitle,picture,rosterSummary.memberCountandrulesonly.membersis never read. An untitled group shows "Group Chat" (provisional copy).Only the button takes a tap. "Start Chatting" dispatches
ChatAction.OpenGroup, and the messenger pushesAppRoute.Messaging.Chat(ByChatId)onto the current stack, so Back returns to the chat that held the link. The pushed screen does the join or buy gating. A card linking to the chat on screen does nothing. Cash and token cards are still tappable anywhere.Design: nodes 10125:19157, 10127:118280, 10127:116723.
Constants (
GroupInviteCardDefaults)SHAPESTROKEdimens.border(1px)BAND_HEIGHTBAND_OPACITYAVATARMEMBER_COUNT_GAPBUTTON_GAPBUTTON_HEIGHTLinkCardDefaults.CARD_ASPECT)Band tint comes from
BlurHash.averageColor: chars 2–5 decoded as base-83 to0xRRGGBBsRGB with no linearisation, and null if malformed. The fallback iscontactAvatar.colors.first(). The helper is tested againsttest-vectors/blurhash_average.json, copied intocommon-ui/src/test/resources.Where Android differs from iOS
ChatInfoCardrenders both astextSmallintextSecondary, and the card matches Android's header, since matching the header is the rule.CodeButtonsized toBUTTON_HEIGHTwith zero content padding. "Start Chatting" isButtonState.Filled. "Group Unavailable" isButtonState.Filled20and disabled, mirroring iOS'sfilled20Compact.sizeis its outermost modifier, which keeps the intrinsic query away from itsBoxWithConstraints.detectTapGestureslong press passes selection back to the transcript.reverseLayout, so the view model emits a split message's rows bottom-first.withoutLinkSpanand its test are gone, as is iOS'scutRange.Tests and previews
SplitAroundLinkCardTest: order, blank segments dropped, unique ids.BubblePositionTest: the grouping run breaks around a card row.LinkCardClassifierTest:chatyields a card, and/chat/{uuid}/senddoesn't.LinkCardResolverTest: group cases.BlurHashAverageColorVectorTest: the shared vectors.GroupInviteLinkCard.ktcover resolved, no picture, unavailable, loading and 2× font scale.MessageBubble.kthas a split group-invite message next to a cash card.