Page MenuHomePhabricator

D6228.id20919.diff
No OneTemporary

D6228.id20919.diff

diff --git a/native/push/android.js b/native/push/android.js
--- a/native/push/android.js
+++ b/native/push/android.js
@@ -1,6 +1,7 @@
// @flow
import invariant from 'invariant';
+import { NativeModules } from 'react-native';
import type { RemoteMessage } from 'react-native-firebase';
import { mergePrefixIntoBody } from 'lib/shared/notif-utils';
@@ -12,6 +13,8 @@
import { store, dispatch } from '../redux/redux-setup';
import { getFirebase } from './firebase';
+const { CommAndroidNotifications } = NativeModules;
+
const androidNotificationChannelID = 'default';
const vibrationSpec = [500, 500];
@@ -83,4 +86,5 @@
androidNotificationChannelID,
handleAndroidMessage,
androidBackgroundMessageTask,
+ CommAndroidNotifications,
};
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
@@ -41,10 +41,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';
@@ -54,6 +51,7 @@
androidNotificationChannelID,
handleAndroidMessage,
androidBackgroundMessageTask,
+ CommAndroidNotifications,
} from './android';
import { getFirebase } from './firebase';
import InAppNotif from './in-app-notif.react';
@@ -294,10 +292,9 @@
),
);
} else if (Platform.OS === 'android') {
- this.props.dispatch({
- type: clearAndroidNotificationsActionType,
- payload: { threadID: activeThread },
- });
+ 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]: [],

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 7:50 AM (19 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2676029
Default Alt Text
D6228.id20919.diff (2 KB)

Event Timeline