feat(activity): badge person avatars with the token the row moved in - #1386
Merged
Conversation
An activity row for a tip or a peer send draws the counterparty's face, so nothing in it names the token: a tip in dollars and a tip in a creator coin read identically. Draw the mint as a small coin over the avatar's bottom-right corner (node 9717:14138) — 40dp avatar centred in a 48dp slot, 20dp badge ringed in the page background. Only person-shaped avatars get one; a token or swap avatar already is the token. Rows reserve the full 48dp slot whether or not they badge, so titles stay aligned down the list. The badge needed a new resolution path. `observeTokenCache()` only ever holds mints the user has an account for, and a tip commonly arrives in a creator coin the recipient holds nothing of, so those rows would never resolve a token. `ensureBadgeToken` fetches such a mint once and memoizes it, following the existing `ensureProfile` shape: an in-flight key set collapses concurrent misses and the memo keeps the answer, so a mint costs at most one request. That matters here — the design this replaces called `getTokenMetadata` per item inside the paging transform, re-fetching never-cached mints on every emission until the wallet locked up. Held-token metadata is layered over the memo so balance-driven refreshes win, and the memo clears on loss of API access. Also collapses the coordinator's three duplicated message-to-row mapping blocks into one `resolveRow`.
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.
An activity row for a tip or a peer send draws the counterparty's face, so nothing in it names the token — a tip in dollars and a tip in a creator coin read identically. This draws the mint as a small coin over the avatar's bottom-right corner, per node 9717:14138: a 40dp avatar centred in a 48dp slot, with a 20dp badge ringed 2dp in the page background.
Only person-shaped avatars carry one.
TokenIconandSwapTokensrows already are the token, so badging them would repeat it. Rows reserve the full 48dp slot whether or not they badge, so titles stay aligned down the list.The resolution path
The badge needed a new one.
observeTokenCache()only ever holds mints the user has an account for, and a tip commonly arrives in a creator coin the recipient holds nothing of — so exactly the rows this design targets would never resolve a token.ensureBadgeTokenfetches such a mint once and memoizes it, following the existingensureProfileshape: an in-flight key set collapses concurrent misses, aMutableStateFlowmemo keeps the answer, and it only fires for rows that have a counterparty. A mint therefore costs at most one request for the process. That bound is the point — the design this replaces calledgetTokenMetadataper item inside the paging transform, with nowhere to put the answer for an unheld mint, so every page emission re-fetched the same mints until the wallet locked up. Held-token metadata is layered over the memo so balance-driven refreshes win, and the memo clears on loss of API access.The coordinator's three duplicated message-to-row mapping blocks are collapsed into one
resolveRowalong the way.Notes
recentTransactions(mint, limit)) will now badge every person row with the same token as the screen itself. Arguably redundant, but I kept the rule uniform rather than making a per-surface exception here.#19191A; this usesCodeTheme.colors.backgroundto match the ringSwapAvataralready draws.features/transactionsFeedItemUI is a separate screen and is untouched.