Skip to content

[Enhancement] Push notification token registration is stubbed with three TODOs and never reaches a backend #1004

Description

@RUKAYAT-CODER

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions