implement changes

This commit is contained in:
Hailey
2024-06-10 09:06:56 -07:00
parent 458005445f
commit f195fad22c
2 changed files with 8 additions and 5 deletions
+7 -4
View File
@@ -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)
}
+1 -1
View File
@@ -119,7 +119,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
// update & broadcast
setNumUnread('')
broadcast.postMessage({event: ''})
resetBadgeCount()
resetBadgeCount('generic')
},
async checkUnread({