5.5 KiB
Client Integration Handoff & Migration Notes
Important
Host App Integration Standard As of the
mattermost-push-plugin-extractionmilestone, all native FCM services, Room DB structures, JJWT signature verification, inline reply/dismiss receivers, notification builders, and ACK request handling have been successfully extracted into the local Flutter plugin package. The package now lives in thenexomonorepo at../nexo/packages/messaging_flutterwith Dart package namenexo_messaging. The host-facing interface keeps Mattermost naming because this app consumes the Mattermost-compatible messaging boundary.Do NOT edit native push files directly inside this host app repository (
apps/client/android). All native push logic and platform services now reside in and must be maintained within the plugin repository.
1. Responsibility Split & Boundaries
To keep host architectures generic and lightweight, we maintain a strict boundary between host logic and external dependency plugins.
1.1 Mattermost Push Notification Boundary
- Host Application (
apps/client) Responsibilities:- Firebase Manifest & Metadata:
google-services.jsoninsideapps/client/android/app/- Initializing Firebase inside
lib/src/app/bootstrap.dartviaFirebase.initializeApp().
- Credential Plumbing:
- Host standardizes all credential synchronization through the
MattermostPushClientinterface rather than accessing the native plugin directly:- Local smoke credentials may be provided as ignored
assets/mattermost_credentials.json. - Login: Sync authorization credentials via
pushClient.setAuthToken(serverUrl, token). - Logout: Revoke and clear credentials via
pushClient.setAuthToken(serverUrl, ''). - Asymmetric Signing Keys: Register server public keys via
pushClient.setSigningKey(serverUrl, publicKey).
- Local smoke credentials may be provided as ignored
- Host standardizes all credential synchronization through the
- App Navigation Callbacks:
- Wire navigation delegates on the
MattermostPushClientinterface:onNavigateToChannel = (serverUrl, channelId) => ...: Handles custom routing logic to channel view on notification click.onNavigateToThread = (serverUrl, rootId) => ...: Handles CRT thread view navigation.
- Wire navigation delegates on the
- Device Token Sync:
- Listen to token registration callbacks via the
onDeviceTokenReadycallback onMattermostPushClientinterface, and forward the target device token back to the Mattermost backend server. - Note: Production calls to
NexoMessagingPlugin.instanceare strictly isolated and encapsulated within theMattermostPushPluginClientadapter implementation, maintaining a generic, testable host bootstrap.
- Listen to token registration callbacks via the
- Firebase Manifest & Metadata:
- Nexo Messaging Plugin (
nexo_messaging) Responsibilities:- Intercepting incoming FCM pushes via Kotlin services (
MattermostFirebaseMessagingService). - Parsing payloads and verifying cryptographic signatures with JJWT.
- Interacting with local SQLite database (Room DB).
- Building native system notifications, dismissing ACKs, and inline replies.
- Intercepting incoming FCM pushes via Kotlin services (
1.2 Proto-socket Integration Boundary
- Host Application (
apps/client) Responsibilities:- Local Dependency Setup:
- Reference the local path package
proto_socketinpubspec.yaml.
- Reference the local path package
- Facade Configuration:
- Read configuration defaults through
ProtoSocketEndpointConfig.fromEnv(). - Wire connections via
ProtoSocketLifecyclefacade inside the bootstrap stream.
- Read configuration defaults through
- No-Op Auto-connect:
- By default, bootstrap configures the lifecycle with
enabled: falseand usesNoopProtoSocketConnector(). - Real socket initialization and active transport loops are decoupled from bootstrap and deferred to client UI activation.
- By default, bootstrap configures the lifecycle with
- Local Dependency Setup:
2. Platform Target Status & Expansion
2.1 Web Target
- Supported in core configuration bootstrap.
- Socket facade safely falls back to standard WebSocket interfaces or no-op handlers in non-supported native environments.
2.2 Android Target
- Fully operational for Mattermost push notifications.
- Integrates Firebase Cloud Messaging, JJWT verification, Room Database, and native background broadcasts.
2.3 iOS Target Status & Native Extension
- iOS is fully integrated into the unified Dart API boundary.
- Dart Level Integration: Sibling systems can target iOS using identical calls (
MattermostPushClientmethods). - Native Implementation Extension: Sibling repos can implement native APNS delegate receivers inside the iOS project folder without needing to modify common Dart facades or common bootstrap parameters.
3. Reference Sibling Repo Alignment & Replacement
When replicating this integration boundary in sibling repositories (../iop and ../alt):
Checklist for Sibling Alignment:
- Firebase Credential Sync: Provide valid
google-services.json(Android) andGoogleService-Info.plist(iOS) in respective project roots. - Local Path Imports: Ensure
pubspec.yamlpoints correctly to the actual sibling workspace dependency paths:
Note: If sibling repositories utilize different directory hierarchies (e.g. nested packages or monorepo namespaces), the relative path must be adjusted accordingly to point to the correct workspace location of the shared libraries.nexo_messaging: path: ../../../nexo/packages/messaging_flutter proto_socket: path: ../../../proto-socket/dart - Endpoint Realization: Initialize client configuration with workspace endpoints matching your target backend (e.g. IOP portal routing or ALT quant metrics server).