From f195fad22c24c72d86015c91e809efdad75e8403 Mon Sep 17 00:00:00 2001 From: Hailey Date: Mon, 10 Jun 2024 09:06:56 -0700 Subject: [PATCH] implement changes --- src/lib/notifications/notifications.ts | 11 +++++++---- src/state/queries/notifications/unread.tsx | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/notifications/notifications.ts b/src/lib/notifications/notifications.ts index 55a7948ef3..e89c93d598 100644 --- a/src/lib/notifications/notifications.ts +++ b/src/lib/notifications/notifications.ts @@ -109,7 +109,10 @@ export function useRequestNotificationsPermission() { } } -export async function decrementBadgeCount(by: number) { +export async function decrementBadgeCount( + type: 'generic' | 'messages', + by: number, +) { if (!isNative) return let count = await getBadgeCountAsync() @@ -118,11 +121,11 @@ export async function decrementBadgeCount(by: number) { count = 0 } - await BackgroundNotificationHandler.setBadgeCountAsync(count) + await BackgroundNotificationHandler.setBadgeCountAsync(type, count) await setBadgeCountAsync(count) } -export async function resetBadgeCount() { - await BackgroundNotificationHandler.setBadgeCountAsync(0) +export async function resetBadgeCount(type: 'generic' | 'messages') { + await BackgroundNotificationHandler.setBadgeCountAsync(type, 0) await setBadgeCountAsync(0) } diff --git a/src/state/queries/notifications/unread.tsx b/src/state/queries/notifications/unread.tsx index ffb8d03bc7..9b9357a4a6 100644 --- a/src/state/queries/notifications/unread.tsx +++ b/src/state/queries/notifications/unread.tsx @@ -119,7 +119,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { // update & broadcast setNumUnread('') broadcast.postMessage({event: ''}) - resetBadgeCount() + resetBadgeCount('generic') }, async checkUnread({