Repository navigation
Description
Bug Report
User-Reported Behavior
- On iOS: tapping an Omi notification opens the app but navigates to the last chat instead of the specific conversation
- On macOS beta: tapping a notification only shows the most recent notification, not the full notification history
Root Cause
The Flutter app is missing two critical FCM notification tap handlers:
1. FirebaseMessaging.onMessageOpenedApp — not registered (Background state)
When the app is in the background and a user taps an FCM push notification, Firebase fires FirebaseMessaging.onMessageOpenedApp. The message's data payload includes navigate_to (e.g. /chat/omi), but there is no listener registered for this event anywhere in the codebase.
File: app/lib/services/notifications/notification_service_fcm.dart
Method: listenForMessages() — only handles FirebaseMessaging.onMessage (foreground), not onMessageOpenedApp (background tap)
2. FirebaseMessaging.instance.getInitialMessage() — not called (Terminated state)
When the app is terminated and a user taps a notification to open it, getInitialMessage() should be called at startup to retrieve the triggering message and navigate accordingly. This is also absent.
3. iOS foreground notifications not shown for plugin type
In _shouldShowForegroundNotificationOnFCMMessageReceived(), only Android shows foreground notifications (return Platform.isAndroid). On iOS, plugin/chat notifications received while the app is in the foreground are silently dropped into a stream without triggering a visible notification or navigation.
Data Flow (for context)
Backend sends FCM via send_notification() with a full data payload:
# backend/utils/chat.py
ai_message = NotificationMessage(
notification_type='plugin',
navigate_to=f'/chat/{app_id}', # or '/chat/omi' for main
...
)
send_notification(user_id, app_name + ' says', message, NotificationMessage.get_message_as_dict(ai_message))The navigate_to field is present in the FCM payload — the app just never reads it on notification tap from background/terminated state.
Fix Required
In notification_service_fcm.dart, add to listenForMessages():
// Background: app in background, user taps notification
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
final navigateTo = message.data['navigate_to'];
if (navigateTo != null && navigateTo.isNotEmpty) {
NotificationUtil.handleDeepLink({'navigate_to': navigateTo});
}
});
// Terminated: app was closed, user taps notification to open
FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage? message) {
if (message != null) {
final navigateTo = message.data['navigate_to'];
if (navigateTo != null && navigateTo.isNotEmpty) {
NotificationUtil.handleDeepLink({'navigate_to': navigateTo});
}
}
});Also expose _handleAppLinkOrDeepLink as a public static method on NotificationUtil.
Affected Platforms
- iOS (primary)
- macOS beta
- Potentially Android (though foreground notification display works there)
Affected Notification Types
- Omi AI response notifications (
notification_type: 'plugin') - App plugin chat notifications
References
app/lib/services/notifications/notification_service_fcm.dart—listenForMessages()app/lib/services/notifications.dart—_handleAppLinkOrDeepLink()backend/utils/chat.py—send_chat_message_notification()backend/utils/app_integrations.py—send_app_notification()
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn review
Activity
fix(notifications): handle FCM background/terminated notification tap…
hugoaap-code commentedon Feb 25, 2026
yes Android presents same behaviour
aaravgarg commentedon Mar 11, 2026
@mdmohsin7 please close within this week mar 13
aaravgarg commentedon Apr 20, 2026
@mdmohsin7 bro
aryanorastar commentedon Aug 5, 2026
Opened a fix that resurrects closed unmerged #5127 with Gemini’s type-safe
navigate_toparsing applied:FirebaseMessaging.onMessageOpenedApp(background tap)getInitialMessage()(terminated tap)NotificationUtil.handleNavigateTo+ unit-testednavigateToFromFcmDataPR: will link after create.
aryanorastar commentedon Aug 5, 2026
Opened #11144 — resurrects closed unmerged #5127 with Gemini’s type-safe
navigate_toparsing:FirebaseMessaging.onMessageOpenedApp(background tap)getInitialMessage()(terminated tap)NotificationUtil.handleNavigateTo+ unit-testednavigateToFromFcmDatafix(app): wait for navigator before FCM cold-start navigate (BasedHar…
fix(app): const FCM navigate_to test maps for analyzer ratchet (Based…
chore(ci): retrigger checks after hermetic scope timeout (BasedHardwa…
fix(app): navigate from FCM background/terminated notification taps (#…
fix(app): open the chat when an iOS chat-answer push is tapped (#22286)