about summary refs log tree commit diff
path: root/src/lib/hooks/useNotificationHandler.ts
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-05-16 12:15:35 -0700
committerGitHub <noreply@github.com>2024-05-16 12:15:35 -0700
commit5e8650a204cf4b52fa321e672801ce790b3cb554 (patch)
tree74ed00ea36605acf344c983d637ff8ae4855c429 /src/lib/hooks/useNotificationHandler.ts
parent4bceabc21cacd865f5b10684142485faca2c9bb4 (diff)
downloadvoidsky-5e8650a204cf4b52fa321e672801ce790b3cb554.tar.zst
[🐴] Decrement app badge when opening unread chat (#4040)
* decrement badge count for chats

* handle decrement in `useMarkAsRead`

* remove async

* oops
Diffstat (limited to 'src/lib/hooks/useNotificationHandler.ts')
-rw-r--r--src/lib/hooks/useNotificationHandler.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/hooks/useNotificationHandler.ts b/src/lib/hooks/useNotificationHandler.ts
index 6f5fbd66b..e288ac3ad 100644
--- a/src/lib/hooks/useNotificationHandler.ts
+++ b/src/lib/hooks/useNotificationHandler.ts
@@ -169,10 +169,11 @@ export function useNotificationsHandler() {
           payload.reason === 'chat-message' &&
           payload.recipientDid === currentAccount?.did
         ) {
+          const isCurrentConvo = payload.convoId === currentConvoId
           return {
-            shouldShowAlert: payload.convoId !== currentConvoId,
+            shouldShowAlert: !isCurrentConvo,
             shouldPlaySound: false,
-            shouldSetBadge: false,
+            shouldSetBadge: !isCurrentConvo,
           }
         }