@@ -20,16 +20,16 @@ let _registerForRemoteNotificationsRanThisSession = false;
2020let _userNotificationCenterDelegate : UNUserNotificationCenterDelegateImpl ;
2121let _messagingConnected : boolean = null ;
2222let _firebaseRemoteMessageDelegate : FIRMessagingDelegateImpl ;
23- let _displayNotifications : boolean = true ;
24- let _showWhenInForeground : boolean = false ;
23+ let _showNotifications : boolean = true ;
24+ let _showNotificationsWhenInForeground : boolean = false ;
2525
2626// Track whether or not registration for remote notifications was request.
2727// This way we can suppress the "Allow notifications" consent popup until the listeners are passed in.
2828const NOTIFICATIONS_REGISTRATION_KEY = "Firebase-RegisterForRemoteNotifications" ;
2929
3030export function initFirebaseMessaging ( arg ) {
31- _displayNotifications = arg . displayNotifications === undefined ? _displayNotifications : ! ! arg . displayNotifications ;
32- _showWhenInForeground = arg . showWhenInForeground === undefined ? _showWhenInForeground : ! ! arg . showWhenInForeground ;
31+ _showNotifications = arg . showNotifications === undefined ? _showNotifications : ! ! arg . showNotifications ;
32+ _showNotificationsWhenInForeground = arg . showNotificationsWhenInForeground === undefined ? _showNotificationsWhenInForeground : ! ! arg . showNotificationsWhenInForeground ;
3333
3434 if ( arg . onMessageReceivedCallback !== undefined || arg . onPushTokenReceivedCallback !== undefined ) {
3535 if ( arg . onMessageReceivedCallback !== undefined ) {
@@ -393,7 +393,7 @@ function _registerForRemoteNotifications() {
393393 }
394394 } ) ;
395395
396- if ( _displayNotifications ) {
396+ if ( _showNotifications ) {
397397 _userNotificationCenterDelegate = UNUserNotificationCenterDelegateImpl . new ( ) . initWithCallback ( ( unnotification , actionIdentifier ?, inputText ?) => {
398398 // if the app is in the foreground then this method will receive the notification
399399 // if the app is in the background, and user has responded to interactive notification, then this method will receive the notification
@@ -551,7 +551,7 @@ class UNUserNotificationCenterDelegateImpl extends NSObject implements UNUserNot
551551 const userInfo = notification . request . content . userInfo ;
552552 const userInfoJSON = firebaseUtils . toJsObject ( userInfo ) ;
553553
554- if ( _showWhenInForeground || // Default value, in case we always want to show when in foreground.
554+ if ( _showNotificationsWhenInForeground || // Default value, in case we always want to show when in foreground.
555555 userInfoJSON [ "gcm.notification.showWhenInForeground" ] === "true" || // This is for FCM, ...
556556 userInfoJSON [ "showWhenInForeground" ] === true || // ...this is for non-FCM...
557557 ( userInfoJSON . aps && userInfoJSON . aps . showWhenInForeground === true ) // ...and this as well (so users can choose where to put it).
0 commit comments