disable push notification update post/thread since while in the background

This commit is contained in:
Elias Nahum
2022-09-03 04:28:31 -04:00
parent 94f7f3e1c2
commit b3ad01d374

View File

@@ -3,7 +3,7 @@
import {Platform} from 'react-native';
import {updatePostSinceCache, updatePostsInThreadsSinceCache} from '@actions/local/notification';
// import {updatePostSinceCache, updatePostsInThreadsSinceCache} from '@actions/local/notification';
import {fetchDirectChannelsInfo, fetchMyChannel, switchToChannelById} from '@actions/remote/channel';
import {fetchPostsForChannel, fetchPostThread} from '@actions/remote/post';
import {forceLogoutIfNecessary} from '@actions/remote/session';
@@ -101,15 +101,15 @@ export const backgroundNotification = async (serverUrl: string, notification: No
const lastDisconnectedAt = await getWebSocketLastDisconnected(database);
if (lastDisconnectedAt) {
if (Platform.OS === 'ios') {
const isCRTEnabled = await getIsCRTEnabled(database);
const isThreadNotification = isCRTEnabled && Boolean(notification.payload?.root_id);
if (isThreadNotification) {
updatePostsInThreadsSinceCache(serverUrl, notification);
} else {
updatePostSinceCache(serverUrl, notification);
}
}
// if (Platform.OS === 'ios') {
// const isCRTEnabled = await getIsCRTEnabled(database);
// const isThreadNotification = isCRTEnabled && Boolean(notification.payload?.root_id);
// if (isThreadNotification) {
// updatePostsInThreadsSinceCache(serverUrl, notification);
// } else {
// updatePostSinceCache(serverUrl, notification);
// }
// }
await fetchNotificationData(serverUrl, notification, true);
}