Skip to content

chore(flipcash): follow flipcash2 contract 3d6de707 (client 0.13.0) - #1625

Merged
bmc08gt merged 2 commits into
code/cashfrom
chore/flipcash2-3d6de707
Sep 30, 2026
Merged

bmc08gt merged 2 commits into
code/cashfrom
chore/flipcash2-3d6de707

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Blocked on code-payments/flipcash2-client-protocol#19 (code-payments/flipcash2-client-protocol#19) merging and 0.13.0 being published. Until then com.flipcash:flipcash2-client-protocol:0.13.0 does not resolve, so CI stays red.

Follows the flipcash2 contract to 3d6de707:

  • Renames: ChatType.DM, ChatMetadata.DmPayment and Location.FLIPCARD are updated in the proto mappers and DmPaymentMetadata.kt. The domain ChatType.TIP_DM keeps its name because Room persists it by name, and renaming it needs a migration.
  • SpeakerRules.never: new ChatRuleRequirement.Never, mapped both ways, persisted, and never satisfied in GroupAccess. ListenerRules has no never arm, so asProtoListenerRules throws for it.
  • Content.widget: new MessageContent.Widget, either ShareProfile(username) or Unsupported for unknown variants, and persisted. MessageBubble and the chat summary preview do not render it yet (TODO).
  • SetDisplayNameResponse.username: ProfileController.setDisplayName returns and caches the assigned username. NameEntryViewModel does not act on it yet.

…ule and assigned username

Adapt to the flipcash2 contract at 3d6de707 (built against a local checkout, pin unchanged):
- ChatType.TIP_DM -> DM and DmPayment/FLIPCARD renames in the proto mapping; the domain
  ChatType.TIP_DM stays because it is persisted by name.
- Map SpeakerRules.never to ChatRuleRequirement.Never, including persistence.
- Map messaging Content.widget to MessageContent.Widget (ShareProfile / Unsupported),
  including persistence and the exhaustive whens in chat-ui.
- setDisplayName now returns the server-assigned username and the controller caches it.
@bmc08gt bmc08gt self-assigned this Sep 30, 2026
@github-actions github-actions Bot added type: chore Maintenance, config, CI/CD area: network gRPC, connectivity, API, exchange rates area: build-system Gradle, convention plugins, build-logic and removed type: chore Maintenance, config, CI/CD labels Sep 30, 2026
@bmc08gt
bmc08gt marked this pull request as ready for review September 30, 2026 15:23
@bmc08gt
bmc08gt merged commit 1f05740 into code/cash Sep 30, 2026
3 of 5 checks passed
bmc08gt added a commit that referenced this pull request Sep 30, 2026
#1625 changed ProfileController.setDisplayName to return the server-assigned
username as Result<String?>. NameEntryViewModelTest still stubbed Result<Unit>,
so the module's unit tests no longer compiled.
bmc08gt added a commit that referenced this pull request Sep 30, 2026
…count (#1630)

* fix(login): stop logging in as other accounts to name switcher rows

The account switcher named each row by calling the Login RPC signed as
that row's account, then GetProfile with the user id it returned
(AccountProfileFetcher, from #1626). The app must not sign in as an
account the user has not switched to, and iOS dropped the same call.

Android stores no user id for accounts other than the signed-in one, so
there is no GetProfile call left that avoids Login. Rows now take their
username and display name only from AccountProfileCache, which is
written while each account is signed in. An account that has never
signed in on this device keeps its mnemonic name. The fallback order is
unchanged: @username, then display name, then mnemonic name.

The balance fetch per row is unchanged. It signs a read as the row's
owner key but does not call Login or start a session.

* feat(login): fetch switcher profiles by a user id cached at sign-in

Rows for other accounts could only show the name cached while that
account was signed in, because the user id GetProfile needs was never
stored. AccountProfileCache now keeps each account's user id alongside
its names, taken from UserManager's state while the account is signed
in. NoId, the value clear() leaves at sign-out, is skipped.

A row with a cached user id fetches its profile with GetProfile by that
id, signed with the row's owner key the way the balance fetch signs. A
row without one makes no profile call. AccountProfileFetcher now takes
the user id and depends only on ProfileRepository and the cache, so it
has no path to the Login RPC.

Accounts that last signed in before this change have no cached user id
until their next sign-in on this device, and keep their cached or
mnemonic name until then.

* fix(user-profile): stub setDisplayName with its String? result

#1625 changed ProfileController.setDisplayName to return the server-assigned
username as Result<String?>. NameEntryViewModelTest still stubbed Result<Unit>,
so the module's unit tests no longer compiled.

* fix(login): resolve a missing user id with Login as the last fallback

A switcher row with a cached user id still calls GetProfile by that id. A row
without one now calls Login signed with its own owner key, caches the user id it
returns, then calls GetProfile. The cached id means each account goes through
Login at most once on this device.

This matches code-payments/code-ios-app#918, which calls login(owner:) only when
a row has no stored user id and its database has none either. Android has no
database step, so Login follows the cache directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build-system Gradle, convention plugins, build-logic area: network gRPC, connectivity, API, exchange rates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant