Page MenuHomePhabricator

D6228.id20787.diff
No OneTemporary

D6228.id20787.diff

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,
@@ -59,14 +58,6 @@
[action.payload.threadID]: [...set],
};
} else if (action.type === clearAndroidNotificationsActionType) {
- 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]: [],

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 8:45 AM (20 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2676348
Default Alt Text
D6228.id20787.diff (2 KB)

Event Timeline