Add push notifications via local sync loop and FCM
Local notifications: - NotificationHelper posts per-room notifications from the sync loop - Notifications suppressed when room is active (ChatScreen DisposableEffect) - Deferred for encrypted rooms until room key arrives; fires with real body - Notification tap navigates to the room via pendingRoomId StateFlow - POST_NOTIFICATIONS permission requested at runtime (API 33+) FCM push (app killed): - MatrixFirebaseMessagingService handles token refresh and data messages - Pusher registered with homeserver pointing to Cloudflare Worker gateway - gateway/src/index.js: Cloudflare Worker forwards Matrix pushes to FCM v1 API using a service-account JWT signed with Web Crypto - last_sync_token persisted in SharedPreferences so restored sessions start with an incremental sync and fire notifications immediately (fixes missed-on-wake bug) - Default FCM notification channel declared in manifest Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1f5e6ca691
commit
de6386d614
15 changed files with 489 additions and 5 deletions
11
gateway/wrangler.toml
Normal file
11
gateway/wrangler.toml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
name = "matrix-push-gateway"
|
||||
main = "src/index.js"
|
||||
compatibility_date = "2024-11-01"
|
||||
workers_dev = true
|
||||
|
||||
# After deploying, set these secrets:
|
||||
# wrangler secret put FIREBASE_PROJECT_ID
|
||||
# wrangler secret put FIREBASE_SERVICE_ACCOUNT
|
||||
#
|
||||
# Then set PUSH_GATEWAY_URL in MatrixSession.kt to:
|
||||
# https://matrix-push-gateway.<your-subdomain>.workers.dev
|
||||
Loading…
Add table
Add a link
Reference in a new issue