This repository was archived by the owner on Apr 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -313,21 +313,32 @@ firebase._processPendingNotifications = function () {
313313 }
314314} ;
315315
316+ firebase . _messagingConnectWithCompletion = function ( ) {
317+ return new Promise ( function ( resolve , reject ) {
318+
319+ FIRMessaging . messaging ( ) . connectWithCompletion ( function ( error ) {
320+
321+ if ( error ) {
322+ // this is not fatal and it scares the hell out of ppl so not logging it
323+ // console.log("Firebase was unable to connect to FCM. Error: " + error);
324+ return reject ( error ) ;
325+ }
326+
327+ firebase . _messagingConnected = true ;
328+ resolve ( ) ;
329+ } ) ;
330+
331+ } ) ;
332+ } ;
333+
316334firebase . _onTokenRefreshNotification = function ( token ) {
317335 firebase . _pushToken = token ;
318336
319337 if ( firebase . _receivedPushTokenCallback ) {
320338 firebase . _receivedPushTokenCallback ( token ) ;
321339 }
322340
323- FIRMessaging . messaging ( ) . connectWithCompletion ( function ( error ) {
324- if ( error ) {
325- // this is not fatal and it scares the hell out of ppl so not logging it
326- // console.log("Firebase was unable to connect to FCM. Error: " + error);
327- } else {
328- firebase . _messagingConnected = true ;
329- }
330- } ) ;
341+ firebase . _messagingConnectWithCompletion ( ) ;
331342} ;
332343
333344firebase . _registerForRemoteNotificationsRanThisSession = false ;
You can’t perform that action at this time.
0 commit comments