Repository navigation
feat(chat): show a person card for Flipcash profile links - #1578
Merged
Merged
Conversation
A message ending https://flipcash.com/x. drew the card plus a bubble holding only ".", because the split around the card trimmed whitespace alone. Punctuation touching the link now goes with it, and a segment of nothing but whitespace and punctuation is dropped, matching iOS (code-ios-app#880).
A `flipcash.com/<handle>`, `flipcash.com/<uuid>` or legacy `/tip/<uuid>` link in chat now renders as a person card instead of underlined text, matching iOS (code-ios-app#872, #879). The router's reserved profile paths (download, privacy, terms, ...) still classify as website links. The card looks the profile up by user id or username through ProfileController, with no tip-flow side effects. An empty profile or a thrown error shows "No Such Account"; errors are not memoized, so the card retries the next time it appears. Tapping opens the person's DM, your own link opens your tip card on the You tab, and a link to the person you're already messaging does nothing. The profile screen's "Joined <Month Year>" line moves to a shared joinedLine() so the card and the profile format it the same way.
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.
Links to a Flipcash profile —
flipcash.com/<handle>,flipcash.com/<uuid>, and legacy/tip/<uuid>on the Flipcash hosts — now render in chat as a person card instead of underlined text. This ports code-payments/code-ios-app#872 and #879, plus the stray-punctuation split fix from #880.Design decisions
Classification
AppRouter(DeeplinkType.Tipcard/TipcardByUsername), so the reserved profile paths (download, privacy, terms, support, help, about, blog, legal, currencycreator, app, api, assets, fonts, icons, js, v1, pool) stay website links. iOS copied that list from Android, andAppRouterTestalready covers it. The messenger classifier test uses a fake router, which mirrors the list and points atAppRouterTest, becauseAppRouteris internal to its module.discord.gg/x) don't produce a card.link_detection.jsonfixture still expects no card for itstip-card-by-idvector. As on iOS, that vector is marked "ahead of fixture" rather than the fixture being edited here.Lookup (
UserLinkLookup)ProfileController.getProfileForUser/getProfileForUsernameonly. Nothing is reused from the tip flow: no profile caching, no bill overlay, no navigation.userId(an unclaimed handle) is not found. A thrown error is also not found, and isn't memoized, so the card retries the next time it appears. A found profile is memoized per identity, the same way the group card is.userManager.accountId.Profile: picture blurhash, picture, display name,@username, andjoinedAt. It doesn't showminDmChatInitFee(the DM's fee sheet still handles payment) and doesn't read tip card colours.Tap (
ChatAction.OpenUser)AppRoute.Messaging.Chat(ChatIdentifier.ByUser(...))on the current stack, the same way the group card pushes its chat.rootNavigator.navigateAll(listOf(AppRoute.Tabs.Menu)). That's where your tip card lives on Android, and where the own-card deep link and scanning your own card already go.Look (
UserLinkCard.kt, constants inUserLinkCardDefaultsmirroring iOSLinkUserCardContent.Layout)TINT_OPACITY, provisional pending design sign-off). With no blurhash, the tint sits overCodeTheme.colors.background. The photo itself is never the background.drawBehindrather thanModifier.paint: with bounded constraints,paint(sizeToIntrinsics = false)raises the minimum size to the maximum, and the card filled the whole bubble.GroupInviteCardDefaults.SHAPE/STROKE, the group card's radius 12 and white 0.1 stroke.ContactAvatarwith the same ring. Not found uses the generic placeholder avatar.textMedium, 2 lines then ellipsis. The handle iscaptionat 0.5, and the detail line iscaptionat 0.45. No new type tokens.joinedLine(), which the profile screen now uses too, so the format lives in one place. It's omitted whenjoinedAtis null. Not found shows the existing "No Such Account" string in that spot, with the URL's@handleas the name.previewPicturehelper, which went from private to internal.Stray punctuation (
ChatListItem.splitAroundLinkCard)link.and(link)give the card only, andlink, then lunchgives the card then "then lunch". Punctuation after a space stays with its words. A leftover segment of only whitespace and punctuation is dropped, while symbols and emoji ($, 🎉) are kept. Copy still copies the original message.Differences from iOS
Also in this PR
test(chat):ChatGroupCashLinkTestdidn't compile oncode/cashbecauseChatViewModelgained constructor dependencies. It now passes them, so the messenger tests run.