[🐴] Decrement app badge when opening unread chat (#4040)

* decrement badge count for chats

* handle decrement in `useMarkAsRead`

* remove async

* oops
This commit is contained in:
Hailey 2024-05-16 12:15:35 -07:00 committed by GitHub
parent 4bceabc21c
commit 5e8650a204
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 6 deletions

View file

@ -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,
}
}