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

Commit a3bd6e8

Browse files
Wrong FCM token returned #986
1 parent 427d0b0 commit a3bd6e8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/messaging/messaging.ios.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,15 @@ export function addOnPushTokenReceivedCallback(callback) {
152152
}
153153

154154
export function addBackgroundRemoteNotificationHandler(appDelegate) {
155-
appDelegate.prototype.applicationDidRegisterForRemoteNotificationsWithDeviceToken = (application: UIApplication, deviceToken: NSData) => {
156-
const token = deviceToken.description.replace(/[< >]/g, "");
157-
_pushToken = token;
158-
if (_receivedPushTokenCallback) {
159-
_receivedPushTokenCallback(token);
160-
}
161-
};
155+
if (typeof (FIRMessaging) === "undefined") {
156+
appDelegate.prototype.applicationDidRegisterForRemoteNotificationsWithDeviceToken = (application: UIApplication, deviceToken: NSData) => {
157+
const token = deviceToken.description.replace(/[< >]/g, "");
158+
_pushToken = token;
159+
if (_receivedPushTokenCallback) {
160+
_receivedPushTokenCallback(token);
161+
}
162+
};
163+
}
162164

163165
appDelegate.prototype.applicationDidReceiveRemoteNotificationFetchCompletionHandler = (app, notification, completionHandler) => {
164166
// Pass notification to auth and check if they can handle it (in case phone auth is being used), see https://firebase.google.com/docs/auth/ios/phone-auth

0 commit comments

Comments
 (0)