File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
packages/firebase_messaging/firebase_messaging/ios/Classes Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -286,8 +286,11 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
286286 NSDictionary *notificationDict =
287287 [FLTFirebaseMessagingPlugin NSDictionaryFromUNNotification: notification];
288288
289- // Send an `onMessage` event
290- [_channel invokeMethod: @" Messaging#onMessage" arguments: notificationDict];
289+ // Don't send an event if contentAvailable is true - application:didReceiveRemoteNotification
290+ // will send the event for us, we don't want to duplicate them.
291+ if (!notificationDict[@" contentAvailable" ]) {
292+ [_channel invokeMethod: @" Messaging#onMessage" arguments: notificationDict];
293+ }
291294 }
292295
293296 // Forward on to any other delegates amd allow them to control presentation behavior.
@@ -398,10 +401,7 @@ - (void)application:(NSApplication *)application
398401 [FLTFirebaseMessagingPlugin remoteMessageUserInfoToDict: userInfo];
399402
400403 if ([NSApplication sharedApplication ].isActive ) {
401- // Only handle data-only messages from FCM.
402- if (userInfo[@" aps" ][@" alert" ] == nil ) {
403- [_channel invokeMethod: @" Messaging#onMessage" arguments: notificationDict];
404- }
404+ [_channel invokeMethod: @" Messaging#onMessage" arguments: notificationDict];
405405 } else {
406406 [_channel invokeMethod: @" Messaging#onBackgroundMessage" arguments: notificationDict];
407407 }
You can’t perform that action at this time.
0 commit comments