Overview
src/services/pushNotifications.ts carries three TODO markers — at lines 205, 209 and 350 — all reading variations of "Replace with actual API call when backend is ready". registerTokenWithBackend() therefore does not register anything, so no device can receive a push even though app.json configures expo-notifications, declares UIBackgroundModes: ["remote-notification"], and requests RECEIVE_BOOT_COMPLETED. src/components/mobile/NotificationSettings.tsx:72 has a matching // TODO: Sync with backend, so notification preferences are local-only. The whole notification surface — prompt, permission sheet, settings, store, channel setup — is built around a transport that does not exist.
Specifications
Features:
- Real token registration and de-registration endpoints wired up
- Notification preferences synchronised with the backend
- Token refresh handled when Expo rotates the push token
- Registration failures surfaced rather than silently swallowed
Tasks:
- Define the token-registration contract with the backend team and record it in
docs/NOTIFICATION_STRATEGY.md
- Implement
registerTokenWithBackend() and the corresponding unregister call on logout
- Wire
NotificationSettings.tsx preference changes to the API
- Handle token rotation via the Expo push-token listener
- Extend
tests/pushNotifications.test.ts and src/__tests__/services/pushNotifications.test.ts to cover registration, rotation and failure
Impacted Files:
src/services/pushNotifications.ts
src/components/mobile/NotificationSettings.tsx
src/services/pushChannelSetup.ts
docs/NOTIFICATION_STRATEGY.md
Acceptance Criteria
- A device receives a push notification end to end
- Preferences persist across reinstalls via the backend
- Token rotation re-registers automatically
- Registration failures are visible in Sentry
Overview
src/services/pushNotifications.tscarries three TODO markers — at lines 205, 209 and 350 — all reading variations of "Replace with actual API call when backend is ready".registerTokenWithBackend()therefore does not register anything, so no device can receive a push even thoughapp.jsonconfiguresexpo-notifications, declaresUIBackgroundModes: ["remote-notification"], and requestsRECEIVE_BOOT_COMPLETED.src/components/mobile/NotificationSettings.tsx:72has a matching// TODO: Sync with backend, so notification preferences are local-only. The whole notification surface — prompt, permission sheet, settings, store, channel setup — is built around a transport that does not exist.Specifications
Features:
Tasks:
docs/NOTIFICATION_STRATEGY.mdregisterTokenWithBackend()and the corresponding unregister call on logoutNotificationSettings.tsxpreference changes to the APItests/pushNotifications.test.tsandsrc/__tests__/services/pushNotifications.test.tsto cover registration, rotation and failureImpacted Files:
src/services/pushNotifications.tssrc/components/mobile/NotificationSettings.tsxsrc/services/pushChannelSetup.tsdocs/NOTIFICATION_STRATEGY.mdAcceptance Criteria