implement changes
This commit is contained in:
@@ -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
|
if (!isNative) return
|
||||||
|
|
||||||
let count = await getBadgeCountAsync()
|
let count = await getBadgeCountAsync()
|
||||||
@@ -118,11 +121,11 @@ export async function decrementBadgeCount(by: number) {
|
|||||||
count = 0
|
count = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
await BackgroundNotificationHandler.setBadgeCountAsync(count)
|
await BackgroundNotificationHandler.setBadgeCountAsync(type, count)
|
||||||
await setBadgeCountAsync(count)
|
await setBadgeCountAsync(count)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resetBadgeCount() {
|
export async function resetBadgeCount(type: 'generic' | 'messages') {
|
||||||
await BackgroundNotificationHandler.setBadgeCountAsync(0)
|
await BackgroundNotificationHandler.setBadgeCountAsync(type, 0)
|
||||||
await setBadgeCountAsync(0)
|
await setBadgeCountAsync(0)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
|||||||
// update & broadcast
|
// update & broadcast
|
||||||
setNumUnread('')
|
setNumUnread('')
|
||||||
broadcast.postMessage({event: ''})
|
broadcast.postMessage({event: ''})
|
||||||
resetBadgeCount()
|
resetBadgeCount('generic')
|
||||||
},
|
},
|
||||||
|
|
||||||
async checkUnread({
|
async checkUnread({
|
||||||
|
|||||||
Reference in New Issue
Block a user