Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit f184451

Browse files
committed
ignore non-gcm messages
1 parent 1003ff4 commit f184451

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/messaging/messaging.ios.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,10 @@ class FirebaseNotificationDelegateObserverImpl implements DelegateObserver {
559559
public userNotificationCenterWillPresentNotificationWithCompletionHandler(center: UNUserNotificationCenter, notification: UNNotification, completionHandler: (p1: UNNotificationPresentationOptions) => void, next: () => void): void {
560560
const userInfo = notification.request.content.userInfo;
561561
const userInfoJSON = firebaseUtils.toJsObject(userInfo);
562+
if (!userInfoJSON["gcm.message_id"]) { // not a firebase message!
563+
next();
564+
return;
565+
}
562566

563567
if (_showNotificationsWhenInForeground || // Default value, in case we always want to show when in foreground.
564568
userInfoJSON["gcm.notification.showWhenInForeground"] === "true" || // This is for FCM, ...
@@ -575,6 +579,12 @@ class FirebaseNotificationDelegateObserverImpl implements DelegateObserver {
575579
}
576580

577581
public userNotificationCenterDidReceiveNotificationResponseWithCompletionHandler(center: UNUserNotificationCenter, response: UNNotificationResponse, completionHandler: () => void, next: () => void): void {
582+
const userInfo = response.notification.request.content.userInfo;
583+
const userInfoJSON = firebaseUtils.toJsObject(userInfo);
584+
if (!userInfoJSON["gcm.message_id"]) { // not a firebase message!
585+
next();
586+
return;
587+
}
578588
// let's ignore "dismiss" actions
579589
if (response && response.actionIdentifier === UNNotificationDismissActionIdentifier) {
580590
completionHandler();

0 commit comments

Comments
 (0)