Service Layer high complexity mobile
0
Dependencies
0
Dependents
4
Entities
0
Integrations

Description

Core Flutter client-side service managing FCM/APNs token registration, foreground/background/terminated message handling, and local notification display. Listens to Firebase messaging streams and routes payloads to the correct feature screen. Syncs device token to Supabase on login.

Feature: Push Notifications & Scenario-Based Alerts

push-notification-service

Responsibilities

  • Register and refresh FCM/APNs device token
  • Handle foreground, background, and terminated notification events
  • Display local notifications when app is in foreground
  • Route notification tap to correct screen via deep link
  • Sync device token to Supabase push_notification_configs

Interfaces

initialize()
getDeviceToken()
onMessageReceived(message)
onMessageOpenedApp(message)
onBackgroundMessage(message)
showLocalNotification(payload)
navigateFromNotification(data)
subscribeToTopic(topic)
unsubscribeFromTopic(topic)

Sub-Components (1)

FCM Token Manager
component medium

Handles device token lifecycle including initial registration, token refresh events, and syncing the current token to Supabase so the backend can address notifications to this device.

  • Obtain initial FCM token on first launch
  • Listen for token refresh and update Supabase record
  • Remove token on logout to stop receiving notifications