Skip to content

Commit

Permalink
feat!(ios): move FIRApp configure to pluginInitialize
Browse files Browse the repository at this point in the history
  • Loading branch information
erisu committed Sep 12, 2024
1 parent 27474eb commit a290e00
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ - (void)pluginInitialize {

if(![self usesFCM]) {
NSLog(@"[PushPlugin] Falling back onto APNS");
} else {
NSLog(@"[PushPlugin] Configuring Firebase App for FCM");
[FIRApp configure];
}
}

Expand Down Expand Up @@ -367,15 +370,8 @@ - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

if([self usesFCM]) {
NSLog(@"[PushPlugin] Setting APNS Token to FCM");
dispatch_async(dispatch_get_main_queue(), ^{
if([FIRApp defaultApp] == nil)
[FIRApp configure];

// Ensure the APNS token is passed to Firebase Messaging
[[FIRMessaging messaging] setAPNSToken:deviceToken];

[self initFirebaseMessaging:[self iOSOptions]];
});
[[FIRMessaging messaging] setAPNSToken:deviceToken];
[self initFirebaseMessaging:[self iOSOptions]];
}

// Check what Notifications the user has turned on. We registered for all three, but they may have manually disabled some or all of them.
Expand Down

0 comments on commit a290e00

Please sign in to comment.