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 @@ -2,7 +2,13 @@ import * as Haptics from 'expo-haptics'; import * as React from 'react'; -import { AppRegistry, Platform, Alert, LogBox } from 'react-native'; +import { + AppRegistry, + Platform, + Alert, + LogBox, + NativeModules, +} 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'; @@ -41,10 +47,7 @@ import { activeMessageListSelector } from '../navigation/nav-selectors'; import { NavContext } from '../navigation/navigation-context'; import type { RootNavigationProp } from '../navigation/root-navigator.react'; -import { - recordNotifPermissionAlertActionType, - clearAndroidNotificationsActionType, -} from '../redux/action-types'; +import { recordNotifPermissionAlertActionType } from '../redux/action-types'; import { useSelector } from '../redux/redux-utils'; import { RootContext, type RootContextType } from '../root-context'; import type { EventSubscription } from '../types/react-native'; @@ -294,10 +297,9 @@ ), ); } else if (Platform.OS === 'android') { - this.props.dispatch({ - type: clearAndroidNotificationsActionType, - payload: { threadID: activeThread }, - }); + NativeModules.CommAndroidNotifications.removeAllActiveNotificationsForThread( + activeThread, + ); } } diff --git a/native/push/reducer.js b/native/push/reducer.js --- a/native/push/reducer.js +++ b/native/push/reducer.js @@ -12,7 +12,6 @@ rescindAndroidNotificationActionType, type Action, } from '../redux/action-types'; -import { getFirebase } from './firebase'; type RecordAndroidNotificationPayload = { +threadID: string, @@ -62,11 +61,6 @@ if (!state[action.payload.threadID]) { return state; } - for (const notifID of state[action.payload.threadID]) { - getFirebase() - .notifications() - .android.removeDeliveredNotificationsByTag(notifID); - } return { ...state, [action.payload.threadID]: [],