about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-05-17 09:23:46 -0700
committerGitHub <noreply@github.com>2024-05-17 09:23:46 -0700
commit5e312d5f3a7796b38d31836461e07bfae7f36129 (patch)
treebffd3338c7452e487a793df28184431e21ffb756 /src
parentdd4c8d8e4f5c5d84f11fe2412b3a2fa8f5d21157 (diff)
downloadvoidsky-5e312d5f3a7796b38d31836461e07bfae7f36129.tar.zst
[🐴] Don't always show notification for everything (#4083)
* don't always show a notification

* nit
Diffstat (limited to 'src')
-rw-r--r--src/lib/hooks/useNotificationHandler.ts2
-rw-r--r--src/lib/notifications/notifications.ts4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/hooks/useNotificationHandler.ts b/src/lib/hooks/useNotificationHandler.ts
index e288ac3ad..3f1cd439d 100644
--- a/src/lib/hooks/useNotificationHandler.ts
+++ b/src/lib/hooks/useNotificationHandler.ts
@@ -41,7 +41,7 @@ type NotificationPayload =
     }
 
 const DEFAULT_HANDLER_OPTIONS = {
-  shouldShowAlert: true,
+  shouldShowAlert: false,
   shouldPlaySound: false,
   shouldSetBadge: true,
 }
diff --git a/src/lib/notifications/notifications.ts b/src/lib/notifications/notifications.ts
index 1182bfcbb..6f28608f4 100644
--- a/src/lib/notifications/notifications.ts
+++ b/src/lib/notifications/notifications.ts
@@ -71,12 +71,14 @@ export function useNotificationsRegistration() {
 
 export function useRequestNotificationsPermission() {
   const gate = useGate()
+  const {currentAccount} = useSession()
 
   return React.useCallback(
     async (context: 'StartOnboarding' | 'AfterOnboarding' | 'Login') => {
       const permissions = await Notifications.getPermissionsAsync()
 
       if (
+        !currentAccount ||
         !isNative ||
         permissions?.status === 'granted' ||
         (permissions?.status === 'denied' && !permissions?.canAskAgain)
@@ -107,7 +109,7 @@ export function useRequestNotificationsPermission() {
         getPushToken(true)
       }
     },
-    [gate],
+    [gate, currentAccount],
   )
 }