From 5e8650a204cf4b52fa321e672801ce790b3cb554 Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 16 May 2024 12:15:35 -0700 Subject: [🐴] Decrement app badge when opening unread chat (#4040) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * decrement badge count for chats * handle decrement in `useMarkAsRead` * remove async * oops --- src/lib/hooks/useNotificationHandler.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib/hooks') 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, } } -- cgit 1.4.1