Skip to content

refactor(chat): make shared/chat a KMP module - #1926

Closed
bmc08gt wants to merge 2 commits into
refactor/emojis-kmpfrom
refactor/chat-kmp
Closed

bmc08gt wants to merge 2 commits into
refactor/emojis-kmpfrom
refactor/chat-kmp

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Compose Desktop needs to run the chat coordinator, so apps/flipcash/shared/chat now builds for jvm and android (flipcash.kmp.app.library). Same module path, same packages; Android behaviour is unchanged.

commonMain: coordinator, delegates, projection, stores, the AppForeground/ChatNotifications interfaces with their None objects, and ChatModule (a Dagger @Module usable from Hilt and the desktop graph, like OpenCodeModule).

androidMain: media/* (Uri, Bitmap, LruCache, shared/blob), share/* (Intent), the ChatMediaSending, LinkPreviewImages, AppForeground and ChatNotifications bindings (new AndroidChatModule), and the Android implementations. These stay Android-only because they use platform types; the coordinator already accepts the None variants.

Changes needed to get the rest into common code:

  • The DataStore stores take PreferencesFiles instead of Context.preferencesDataStore, with the same file names and keys.
  • detectUrls gets its candidates from an expect findWebUrls: Patterns.WEB_URL on Android, a copy of that pattern on the JVM. link_detection.json runs against both (LinkDetectionVectorJvmTest, LinkDetectionVectorAndroidTest).
  • InviteLinkText parses URLs without android.net.Uri.
  • BlobSealer exposes its seal function; Android turns it into a ChatMediaSealing with sealing().
  • ChatType/Fiat/Mint.analytics (shared/analytics) and FIRST_PARTY_HOSTS (core) move to commonMain in the same packages.

Tests: the 750 existing tests stay in androidHostTest, none moved to common/jvm; two new vector tests were added (one jvm, one android).

Stacked on #1925.

Android-only media, share and platform bindings go to androidMain; the rest to
commonMain. Tests move to androidHostTest unchanged.
Compose Desktop needs the chat coordinator, so shared/chat now builds for jvm
and android. The coordinator, delegates, stores and ChatModule are in
commonMain. Media, share, the Android foreground and notification
bindings stay in androidMain (new AndroidChatModule), since they use Uri,
Bitmap, Intent and shared/blob.

- DataStore stores take PreferencesFiles; file names and keys are unchanged.
- detectUrls reads candidates through an expect findWebUrls: Patterns.WEB_URL on
  Android, a copy of that pattern on the JVM. The link_detection vectors run on
  both.
- InviteLinkText parses URLs without android.net.Uri.
- BlobSealer no longer names ChatMediaSealing; Android adds it back with sealing().
- ChatType/Fiat/Mint.analytics (analytics) and FIRST_PARTY_HOSTS (core) move to
  commonMain in the same packages.
@bmc08gt

bmc08gt commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: these commits shipped in #1923, which also moved media, share and blob sealing into commonMain.

@bmc08gt bmc08gt closed this Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant