Receive Push Notification for New Assignment Dispatch
When a coordinator dispatches a new encrypted assignment to a peer mentor, the Notification Scenario Engine detects the database insert via a Supabase Edge Function webhook on the assignment_dispatches table. It enqueues a push notification payload through the Push Notification Gateway using FCM for Android and APNs for iOS. The Flutter Push Notification Service handles delivery in all three app lifecycle states: foreground (local notification displayed), background (system tray notification), and terminated (system tray notification on next device wake). The notification title indicates a new assignment is available and the body contains a brief non-sensitive preview. Tapping the notification deep-links the peer mentor to the Assignment Detail Screen.
User Story
Acceptance Criteria
- Given a coordinator dispatches an assignment to a peer mentor, when the database record is inserted, then the Edge Function triggers within 30 seconds and enqueues a push notification via FCM/APNs
- Given the peer mentor's app is in the foreground when the notification arrives, when the FCM message is received, then a local notification banner is displayed at the top of the screen
- Given the peer mentor's app is backgrounded or terminated, when the FCM message is received, then a system tray notification is displayed
- Given the peer mentor taps the push notification, when the app launches or comes to foreground, then the user is deep-linked directly to the relevant assignment detail
- Given the peer mentor has disabled the 'New Assignments' notification category in settings, when an assignment is dispatched, then no push notification is sent
Business Value
Timely notification of new assignments is the single most critical engagement trigger in the system. HLF survey data shows 40% of peer mentors were dissatisfied with follow-up, and delays in assignment acknowledgement directly reduce the quality of support delivered to end users. Without push notifications, peer mentors must manually poll the app to discover new assignments, leading to multi-day delays. Automated, immediate push delivery on assignment dispatch eliminates this gap and removes the coordinator's burden of chasing acknowledgement through phone calls.
Components
- Push Notification Service service
- Notification Scenario Engine service
- Push Notification Gateway infrastructure
- Notification Repository data
- Notifications Screen ui