You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8802fa9
Browse filesBrowse the repository at this point in the historyBrowse files
feat(login): name account switcher rows by username, and load balances in two calls (#1626)
* feat(login): name account switcher rows by username or display name
Each row in the account switcher now shows the account's @username, else
its profile display name, else the mnemonic name it showed before. iOS
uses the same order.
Only the signed-in account has a session, so the other rows read from a
new AccountProfileCache: a local DataStore keyed by owner public key,
written from UserManager's state whenever a profile is restored, fetched,
or edited. Reading it needs no network and no signing as the other
account. The server's getProfile takes a user id and a signed request,
so there was no unsigned lookup by owner key to use instead.
Names stay out of the Block Store entry, which has a 4KB budget sized
for fixed-width records. An account fills its cache entry the next time
it signs in on this device; until then its row keeps the mnemonic name.
* feat(login): fetch every listed account's username and display name
The switcher named only accounts that had signed in on this device, since
the cache was filled from the signed-in session. Each row now fetches its
own profile, signed as that account, the way the list already fetches
balances: Login maps the owner key to a user id, then GetProfile by that
id. The cached names still show first, and offline.
A NotFound profile counts as "no names", so a name the account has since
dropped is cleared from the cache. Other failures leave the row's cached
title in place.
* perf(login): load account switcher balances in two calls per account
An account holding 43 tokens made 43 sequential metadata calls of
100-200ms each before its balance showed. fetchTokenAccounts resolves
metadata one mint at a time, which is cheap behind the main screen's
cache and a round trip per token here, where there is no cache.
TokenController.fetchTokenBalances makes one account lookup and one
batched metadata lookup, the shape iOS's account list uses. A mint the
batch does not return fails the fetch instead of shortening the total.
The list also showed nothing until every stored account's key was
derived, one PBKDF2 run and SLIP-10 chain after another. Those now run
side by side on the Default dispatcher.
* feat(login): show a shimmer where an account's balance is loading
* feat(login): mark accounts with the app's checked/unchecked circle
The rows used a bare tick on the current account only. They now use the
ic_checked/ic_unchecked pair the region, token and group-invite pickers
use, which matches iOS's CheckView.
Copy file name to clipboardExpand all lines: apps/flipcash/features/login/src/main/kotlin/com/flipcash/app/login/internal/accounts/AccountSelectionViewModel.kt
0 commit comments