diff --git a/native/push/push-handler.react.js b/native/push/push-handler.react.js --- a/native/push/push-handler.react.js +++ b/native/push/push-handler.react.js @@ -12,7 +12,6 @@ } from 'react-native'; import type { RemoteMessage, NotificationOpen } from 'react-native-firebase'; import { Notification as InAppNotification } from 'react-native-in-app-message'; -import NotificationsIOS from 'react-native-notifications'; import { useDispatch } from 'react-redux'; import { @@ -279,7 +278,7 @@ updateBadgeCount() { const curUnreadCount = this.props.unreadCount; if (Platform.OS === 'ios') { - NotificationsIOS.setBadgesCount(curUnreadCount); + CommIOSNotifications.setBadgesCount(curUnreadCount); } else if (Platform.OS === 'android') { getFirebase().notifications().setBadge(curUnreadCount); } @@ -287,7 +286,7 @@ clearAllNotifs() { if (Platform.OS === 'ios') { - NotificationsIOS.removeAllDeliveredNotifications(); + CommIOSNotifications.removeAllDeliveredNotifications(); } else if (Platform.OS === 'android') { getFirebase().notifications().removeAllDeliveredNotifications(); } @@ -299,7 +298,7 @@ return; } if (Platform.OS === 'ios') { - NotificationsIOS.getDeliveredNotifications(notifications => + CommIOSNotifications.getDeliveredNotifications(notifications => PushHandler.clearDeliveredIOSNotificationsForThread( activeThread, notifications, @@ -324,7 +323,7 @@ } } if (identifiersToClear) { - NotificationsIOS.removeDeliveredNotifications(identifiersToClear); + CommIOSNotifications.removeDeliveredNotifications(identifiersToClear); } } @@ -475,7 +474,9 @@ notification.getData().managedAps && notification.getData().managedAps.action === 'CLEAR' ) { - notification.finish(NotificationsIOS.FetchResult.NoData); + notification.finish( + CommIOSNotifications.getConstants().FETCH_RESULT_NO_DATA, + ); return; } if (Date.now() < this.appStarted + 1500) { @@ -484,13 +485,17 @@ // callback shouldn't be triggered at all. To avoid weirdness we are // ignoring any foreground notification received within the first second // of the app being started, since they are most likely to be erroneous. - notification.finish(NotificationsIOS.FetchResult.NoData); + notification.finish( + CommIOSNotifications.getConstants().FETCH_RESULT_NO_DATA, + ); return; } const threadID = notification.getData().threadID; if (!threadID) { console.log('Notification with missing threadID received!'); - notification.finish(NotificationsIOS.FetchResult.NoData); + notification.finish( + CommIOSNotifications.getConstants().FETCH_RESULT_NO_DATA, + ); return; } const messageInfos = notification.getData().messageInfos; @@ -507,7 +512,9 @@ 'Non-rescind foreground notification without alert received!', ); } - notification.finish(NotificationsIOS.FetchResult.NewData); + notification.finish( + CommIOSNotifications.getConstants().FETCH_RESULT_NEW_DATA, + ); }; onPushNotifBootsApp() { @@ -524,13 +531,17 @@ const threadID = notification.getData().threadID; if (!threadID) { console.log('Notification with missing threadID received!'); - notification.finish(NotificationsIOS.FetchResult.NoData); + notification.finish( + CommIOSNotifications.getConstants().FETCH_RESULT_NO_DATA, + ); return; } const messageInfos = notification.getData().messageInfos; this.saveMessageInfos(messageInfos); this.onPressNotificationForThread(threadID, true); - notification.finish(NotificationsIOS.FetchResult.NewData); + notification.finish( + CommIOSNotifications.getConstants().FETCH_RESULT_NEW_DATA, + ); }; showInAppNotification(threadID: string, message: string, title?: ?string) {