Skip to content

feat(push): FCM system notifications (0.4.0) - #10

Merged
CjiW merged 1 commit into
masterfrom
feat/fcm-push
Oct 24, 2026
Merged

CjiW merged 1 commit into
masterfrom
feat/fcm-push

Conversation

@CjiW

@CjiW CjiW commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

What

Replaces the app's 24/7 foreground SSE notification service with real system push via FCM (data-only).

  • push/PushRegistrar: fetch/register the FCM token on login, onNewToken, logout; silent re-auth on 401.
  • push/XbotMessagingService: parses {kind, chat_id, title, body, request_id} and renders the notification locally.
  • push/Notifications: xbot_messages channel, stable notification id per prompt/chat, deep link to the chat.
  • push/PushPresence: 30s foreground lease; the server skips this device while it is visible.
  • Removed: ChatNotificationService, BootReceiver, AppVisibility, FOREGROUND_SERVICE* / RECEIVE_BOOT_COMPLETED permissions, the ongoing notification and the legacy toggle.
  • Settings → Notifications: permission card + FCM status/refresh/test.
  • MainActivity / App.kt: notification tap opens chat/{id}.
  • 0.4.0: CHANGELOG, README/AGENTS/docs; release script auto-extracts the changelog and publishes to MinIO.

Depends on

Server PR: ai-pivot/xbot#455 (/api/push/*, FCM + WebPush). Without it the app still works; registration returns 404 and the UI shows “not registered”.

Notes

  • app/google-services.json is committed: it only contains client identifiers (project_id/app_id/api_key; the API key is restricted by package name). The real secret is the server-side service-account JSON and is never committed.
  • FCM is still subject to Android's force-stop rule and OEM data-only throttling; the foreground SSE stays for live streaming while the app is visible.
  • MinIO distribution: latest.json + xbot-android-25.apk are published at https://minio.cjiw.site/uploads/share/android/.

Tests

  • ./gradlew :app:assembleDebug :app:assembleRelease :app:testDebugUnitTest :app:lintDebug
  • Real device: test notification, AskUser prompt and turn completion received with the app backgrounded and with the process swiped away; notification tap opens the right chat; no ongoing service notification.

Dev channel note

versionCode is 25 (0.4.0). If a newer dev build already exists on the device, the stable install needs the usual max(stable, dev)+1 bump.

…0.4.0)

- push/: PushRegistrar (login/onNewToken/logout, silent re-auth), XbotMessagingService (data-only), Notifications (channel/deep link/stable ids), PushPresence (30s foreground lease).
- remove ChatNotificationService/BootReceiver/AppVisibility and FOREGROUND_SERVICE*/RECEIVE_BOOT_COMPLETED permissions; no ongoing notification.
- settings: notification permission card + FCM status/refresh/test; notification tap deep-links to the target chat.
- commit google-services.json (client identifiers only; API key restricted by package); the server keeps the real service-account secret.
- release script auto-extracts the CHANGELOG section; CHANGELOG 0.4.0.
Tests: assembleDebug, assembleRelease, testDebugUnitTest, lintDebug. Real-device FCM delivery verified (foreground/background/process-killed).
@CjiW
CjiW merged commit 36b4fc1 into master Oct 24, 2026
1 check passed
@CjiW
CjiW deleted the feat/fcm-push branch October 24, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant