diff options
author | Hailey <me@haileyok.com> | 2024-05-17 16:05:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-17 16:05:32 -0700 |
commit | d2c81c9d3d6aebae9c73a7567875e0165cfb1f08 (patch) | |
tree | 428f283a80530d71603d2cad87e62d85d20d2bf7 /src/lib/notifications | |
parent | 49314e2d1f20d7471f1d05ce2b118bd030c44aa2 (diff) | |
download | voidsky-d2c81c9d3d6aebae9c73a7567875e0165cfb1f08.tar.zst |
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
Diffstat (limited to 'src/lib/notifications')
-rw-r--r-- | src/lib/notifications/notifications.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/notifications/notifications.ts b/src/lib/notifications/notifications.ts index 6f28608f4..f9fbdb8bf 100644 --- a/src/lib/notifications/notifications.ts +++ b/src/lib/notifications/notifications.ts @@ -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 |