@@ -14,8 +14,7 @@ firebase._gIDAuthentication = null;
1414firebase . _cachedInvitation = null ;
1515firebase . _cachedDynamicLink = null ;
1616
17- // Note that this must be done only once
18- FIRApp . configure ( ) ;
17+ // Note that FIRApp.configure must be called only once, but not here (see https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/564)
1918
2019/**
2120 * Workaround function to call the `dispatch_get_main_queue(...)` for iOS
@@ -58,10 +57,9 @@ const handleRemoteNotification = (app, userInfo) => {
5857 }
5958} ;
6059
61- const addBackgroundRemoteNotificationHandler = appDelegate => {
60+ function addBackgroundRemoteNotificationHandler ( appDelegate ) {
6261 if ( typeof ( FIRMessaging ) !== "undefined" ) {
6362 appDelegate . prototype . applicationDidReceiveRemoteNotificationFetchCompletionHandler = ( app , notification , completionHandler ) => {
64-
6563 // 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
6664 if ( FIRAuth . auth ( ) . canHandleNotification ( notification ) ) {
6765 completionHandler ( UIBackgroundFetchResult . NoData ) ;
@@ -72,11 +70,12 @@ const addBackgroundRemoteNotificationHandler = appDelegate => {
7270 handleRemoteNotification ( app , notification ) ;
7371 } ;
7472 }
75- } ;
73+ }
7674
7775firebase . addAppDelegateMethods = appDelegate => {
7876 // we need the launchOptions for this one so it's a bit hard to use the UIApplicationDidFinishLaunchingNotification pattern we're using for other things
7977 appDelegate . prototype . applicationDidFinishLaunchingWithOptions = ( application , launchOptions ) => {
78+ FIRApp . configure ( ) ;
8079 // 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.
8180 if ( launchOptions && typeof ( FIRMessaging ) !== "undefined" ) {
8281 const remoteNotification = launchOptions . objectForKey ( UIApplicationLaunchOptionsRemoteNotificationKey ) ;
@@ -367,7 +366,7 @@ firebase._messagingConnectWithCompletion = () => {
367366
368367 if ( error ) {
369368 // this is not fatal and it scares the hell out of ppl so not logging it
370- // console.log("Firebase was unable to connect to FCM. Error: " + error);
369+ console . log ( "Firebase was unable to connect to FCM. Error: " + error ) ;
371370 return reject ( error ) ;
372371 }
373372
@@ -474,9 +473,9 @@ function getAppDelegate() {
474473 class UIApplicationDelegateImpl extends UIResponder implements UIApplicationDelegate {
475474 public static ObjCProtocols = [ UIApplicationDelegate ] ;
476475
477- static new ( ) : UIApplicationDelegateImpl {
478- return < UIApplicationDelegateImpl > super . new ( ) ;
479- }
476+ // static new(): UIApplicationDelegateImpl {
477+ // return <UIApplicationDelegateImpl>super.new();
478+ // }
480479 }
481480
482481 application . ios . delegate = UIApplicationDelegateImpl ;
@@ -616,6 +615,7 @@ firebase.init = arg => {
616615 if ( FIROptions . defaultOptions ( ) !== null ) {
617616 FIROptions . defaultOptions ( ) . deepLinkURLScheme = utils . ios . getter ( NSBundle , NSBundle . mainBundle ) . bundleIdentifier ;
618617 }
618+ // FIRApp.configure();
619619
620620 if ( typeof ( FIRDatabase ) !== "undefined" ) {
621621 if ( arg . persist ) {
0 commit comments