Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3486913
D6228.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D6228.diff
View Options
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,13 @@
import { store, dispatch } from '../redux/redux-setup';
import { getFirebase } from './firebase';
+type CommAndroidNotificationsModuleType = {
+ +removeAllActiveNotificationsForThread: (threadID: string) => void,
+ ...
+};
+
+const CommAndroidNotifications: CommAndroidNotificationsModuleType =
+ NativeModules.CommAndroidNotifications;
const androidNotificationChannelID = 'default';
const vibrationSpec = [500, 500];
@@ -83,4 +91,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
@@ -40,10 +40,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';
@@ -53,6 +50,7 @@
androidNotificationChannelID,
handleAndroidMessage,
androidBackgroundMessageTask,
+ CommAndroidNotifications,
} from './android';
import {
CommIOSNotification,
@@ -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
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 6:19 AM (20 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2675673
Default Alt Text
D6228.diff (2 KB)
Attached To
Mode
D6228: Use native modules to clear notifications for a given thread
Attached
Detach File
Event Timeline
Log In to Comment