@@ -58,29 +58,40 @@ firebase.areNotificationsEnabled = firebaseMessaging.areNotificationsEnabled;
58
58
59
59
firebase . functions = firebaseFunctions ;
60
60
61
+ NSNotificationCenter . defaultCenter . addObserverForNameObjectQueueUsingBlock (
62
+ UIApplicationDidFinishLaunchingNotification ,
63
+ null ,
64
+ NSOperationQueue . mainQueue ,
65
+ appNotification => {
66
+ if ( ! firebase . _configured ) {
67
+ firebase . _configured = true ;
68
+ if ( typeof ( FIRApp ) !== "undefined" ) {
69
+ FIRApp . configure ( ) ;
70
+ }
71
+ }
72
+ } ) ;
73
+
61
74
firebase . addAppDelegateMethods = appDelegate => {
62
75
// we need the launchOptions for this one so it's a bit hard to use the UIApplicationDidFinishLaunchingNotification pattern we're using for other things
63
- appDelegate . prototype . applicationDidFinishLaunchingWithOptions = ( application , launchOptions ) => {
64
- if ( ! firebase . _configured ) {
65
- firebase . _configured = true ;
66
- if ( typeof ( FIRApp ) !== "undefined" ) {
67
- FIRApp . configure ( ) ;
76
+ // however, let's not override 'applicationDidFinishLaunchingWithOptions' if we don't really need it:
77
+ if ( typeof ( FIRMessaging ) !== "undefined" || useExternalPushProvider || typeof ( FBSDKApplicationDelegate ) !== "undefined" ) {
78
+ appDelegate . prototype . applicationDidFinishLaunchingWithOptions = ( application , launchOptions ) => {
79
+ // If the app was terminated and iOS is launching it in result of a push notification tapped by the user, this will hold the notification data.
80
+ if ( launchOptions ) {
81
+ const remoteNotification = launchOptions . objectForKey ( UIApplicationLaunchOptionsRemoteNotificationKey ) ;
82
+ if ( remoteNotification ) {
83
+ firebaseMessaging . handleRemoteNotification ( application , remoteNotification ) ;
84
+ }
68
85
}
69
- }
70
86
71
- // If the app was terminated and iOS is launching it in result of a push notification tapped by the user, this will hold the notification data.
72
- if ( launchOptions ) {
73
- const remoteNotification = launchOptions . objectForKey ( UIApplicationLaunchOptionsRemoteNotificationKey ) ;
74
- if ( remoteNotification ) {
75
- firebaseMessaging . handleRemoteNotification ( application , remoteNotification ) ;
87
+ // Firebase Facebook authentication
88
+ if ( typeof ( FBSDKApplicationDelegate ) !== "undefined" ) {
89
+ FBSDKApplicationDelegate . sharedInstance ( ) . applicationDidFinishLaunchingWithOptions ( application , launchOptions ) ;
76
90
}
77
- }
78
- // Firebase Facebook authentication
79
- if ( typeof ( FBSDKApplicationDelegate ) !== "undefined" ) {
80
- FBSDKApplicationDelegate . sharedInstance ( ) . applicationDidFinishLaunchingWithOptions ( application , launchOptions ) ;
81
- }
82
- return true ;
83
- } ;
91
+
92
+ return true ;
93
+ } ;
94
+ }
84
95
85
96
// there's no notification event to hook into for this one, so using the appDelegate
86
97
if ( typeof ( FBSDKApplicationDelegate ) !== "undefined" || typeof ( GIDSignIn ) !== "undefined" || typeof ( FIRInvites ) !== "undefined" || typeof ( FIRDynamicLink ) !== "undefined" ) {
0 commit comments