Disable badge incrementing for DMs (#4088)

* disable badge increments for dms

* revert decrementing in js for dms

* reset badge on read notifications

* remove some other code

* prevent duplicate notification events
This commit is contained in:
Hailey 2024-05-17 16:05:32 -07:00 committed by GitHub
parent 49314e2d1f
commit d2c81c9d3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 24 additions and 28 deletions

View file

@ -113,10 +113,16 @@ export function useRequestNotificationsPermission() {
)
}
export async function decrementBadgeCount(by = 1) {
export async function decrementBadgeCount(by: number | 'reset' = 1) {
if (!isNative) return
const currCount = await getBadgeCountAsync()
if (by === 'reset') {
await setBadgeCountAsync(0)
return
}
let newCount = currCount - by
if (newCount < 0) {
newCount = 0