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

Commit 4bee083

Browse files
All init before the app has launched
1 parent ed31cd8 commit 4bee083

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/firebase.ios.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ firebase._receivedPushTokenCallback = null;
1313
firebase._gIDAuthentication = null;
1414
firebase._cachedInvitation = null;
1515
firebase._cachedDynamicLink = null;
16+
firebase._configured = false;
1617

1718
// Note that FIRApp.configure must be called only once, but not here (see https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/564)
1819

@@ -75,7 +76,10 @@ function addBackgroundRemoteNotificationHandler(appDelegate) {
7576
firebase.addAppDelegateMethods = appDelegate => {
7677
// we need the launchOptions for this one so it's a bit hard to use the UIApplicationDidFinishLaunchingNotification pattern we're using for other things
7778
appDelegate.prototype.applicationDidFinishLaunchingWithOptions = (application, launchOptions) => {
78-
FIRApp.configure();
79+
if (!firebase._configured) {
80+
firebase._configured = true;
81+
FIRApp.configure();
82+
}
7983
// If the app was terminated and the iOS is launching it in result of push notification tapped by the user, this will hold the notification data.
8084
if (launchOptions && typeof(FIRMessaging) !== "undefined") {
8185
const remoteNotification = launchOptions.objectForKey(UIApplicationLaunchOptionsRemoteNotificationKey);
@@ -615,7 +619,11 @@ firebase.init = arg => {
615619
if (FIROptions.defaultOptions() !== null) {
616620
FIROptions.defaultOptions().deepLinkURLScheme = utils.ios.getter(NSBundle, NSBundle.mainBundle).bundleIdentifier;
617621
}
618-
// FIRApp.configure();
622+
623+
if (!firebase._configured) {
624+
firebase._configured = true;
625+
FIRApp.configure();
626+
}
619627

620628
if (typeof(FIRDatabase) !== "undefined") {
621629
if (arg.persist) {

0 commit comments

Comments
 (0)