Skip to content

Add FCM push notification support#122

Draft
dalinaum wants to merge 1 commit intohackers-pub:mainfrom
dalinaum:feat/fcm-push-notifications
Draft

Add FCM push notification support#122
dalinaum wants to merge 1 commit intohackers-pub:mainfrom
dalinaum:feat/fcm-push-notifications

Conversation

@dalinaum
Copy link
Copy Markdown
Contributor

Summary

  • Add firebase-messaging dependency and HackersPubMessagingService for receiving FCM data messages
  • Implement FcmTokenManager for token registration/unregistration via GraphQL mutations
  • Register FCM token on login (via LaunchedEffect(isLoggedIn)), unregister on logout
  • Request POST_NOTIFICATIONS permission on login transition (not just app startup)
  • Remove foreground polling — FCM replaces it; 15-min WorkManager polling remains as fallback
  • Handle all GraphQL union error types (RegisterFcmDeviceTokenFailedError, InvalidInputError, NotAuthenticatedError) in mutation responses
  • Add FCM mutation types to local GraphQL schema

⚠️ Requires server-side FCM support: hackers-pub/hackerspub#251 must be merged and deployed first. The GraphQL schema in this PR includes registerFcmDeviceToken / unregisterFcmDeviceToken mutations that the server does not yet serve. After the server PR is deployed, re-run schema introspection to sync.

Test plan

  • ./gradlew assembleDebug build passes
  • Verify FCM token registration on login (check FcmTokenManager logs)
  • Verify push notification received in background after server FCM support is live
  • Verify notification permission prompt appears on first login
  • Verify FCM token unregistered on logout

🤖 Generated with Claude Code

- Add firebase-messaging dependency
- Implement HackersPubMessagingService for receiving FCM data messages
- Implement FcmTokenManager for token registration/unregistration
  via registerFcmDeviceToken/unregisterFcmDeviceToken GraphQL mutations
- Register FCM token on login, unregister on logout
- Request notification permission on login (not just app startup)
- Remove foreground polling (FCM replaces it; 15-min WorkManager
  polling remains as fallback)
- Handle GraphQL union error types in mutation responses
- Add FCM mutation types to local GraphQL schema

Requires server-side FCM support: hackers-pub/hackerspub#251

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dalinaum dalinaum marked this pull request as draft April 17, 2026 05:11
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