about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-09-11 14:28:13 -0700
committerGitHub <noreply@github.com>2023-09-11 14:28:13 -0700
commit977f9228f8a178868e877f0bfdcf9f43d7670d44 (patch)
tree9bf9aaa59dd819b5b63c13be87c467ce2b8ff555 /src
parent57c10cbcab542a96723a1a8f96d6f34caecb479c (diff)
downloadvoidsky-977f9228f8a178868e877f0bfdcf9f43d7670d44.tar.zst
Revert "Fix 1338 mark notifications read with timeout and on app state change (#1340)" (#1433)
This reverts commit d2e65d2a7f411e9eb1a1ea8d97ea148c4832b430.
Diffstat (limited to 'src')
-rw-r--r--src/view/screens/Notifications.tsx15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/view/screens/Notifications.tsx b/src/view/screens/Notifications.tsx
index 058f09034..3c257fac8 100644
--- a/src/view/screens/Notifications.tsx
+++ b/src/view/screens/Notifications.tsx
@@ -1,5 +1,5 @@
 import React from 'react'
-import {AppState, FlatList, View} from 'react-native'
+import {FlatList, View} from 'react-native'
 import {useFocusEffect} from '@react-navigation/native'
 import {observer} from 'mobx-react-lite'
 import {
@@ -18,7 +18,6 @@ import {s} from 'lib/styles'
 import {useAnalytics} from 'lib/analytics/analytics'
 import {isWeb} from 'platform/detection'
 
-const NOTIFICATION_MARK_READ_TIMEOUT = 5000
 type Props = NativeStackScreenProps<
   NotificationsTabNavigatorParams,
   'Notifications'
@@ -56,22 +55,10 @@ export const NotificationsScreen = withAuthRequired(
         const softResetSub = store.onScreenSoftReset(onPressLoadLatest)
         store.me.notifications.update()
         screen('Notifications')
-        // marks notifications read if the user opens the notifications tab for x seconds
-        // but doesn't open any notifications or any other tab
-        const markReadTimeout = setTimeout(() => {
-          store.me.notifications.markAllRead()
-        }, NOTIFICATION_MARK_READ_TIMEOUT) // mark all notifications as read after 3s
-        // marks notification read if the user suspends the app while in the notification tab
-        // then opens the app into the notification tab and then closes the app again
-        const markReadOnBlur = AppState.addEventListener('change', event => {
-          if (event === 'background') store.me.notifications.markAllRead()
-        })
 
         return () => {
           softResetSub.remove()
-          markReadOnBlur.remove()
           store.me.notifications.markAllRead()
-          clearTimeout(markReadTimeout) // in case we unmount before the timeout fires
         }
       }, [store, screen, onPressLoadLatest]),
     )