diff options
author | Hailey <me@haileyok.com> | 2024-05-16 12:21:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-16 12:21:29 -0700 |
commit | 72550df0e2c94bd17b86215d95ec1b7eb76fe30f (patch) | |
tree | 5221f484cef79e9474a8ca1d2fedeb06d80c0824 /src | |
parent | 5e8650a204cf4b52fa321e672801ce790b3cb554 (diff) | |
download | voidsky-72550df0e2c94bd17b86215d95ec1b7eb76fe30f.tar.zst |
Properly update badge for other unread notifications (#4052)
* decrement badge count for chats * handle decrement in `useMarkAsRead` * remove async * remove setting badge count * oops * update the number correctly * nit
Diffstat (limited to 'src')
-rw-r--r-- | src/state/queries/notifications/unread.tsx | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/state/queries/notifications/unread.tsx b/src/state/queries/notifications/unread.tsx index 80333b524..9d35ee19f 100644 --- a/src/state/queries/notifications/unread.tsx +++ b/src/state/queries/notifications/unread.tsx @@ -4,15 +4,14 @@ import React from 'react' import {AppState} from 'react-native' -import * as Notifications from 'expo-notifications' import {useQueryClient} from '@tanstack/react-query' import EventEmitter from 'eventemitter3' import BroadcastChannel from '#/lib/broadcast' import {logger} from '#/logger' -import {isNative} from '#/platform/detection' import {useMutedThreads} from '#/state/muted-threads' import {useAgent, useSession} from '#/state/session' +import {decrementBadgeCount} from 'lib/notifications/notifications' import {useModerationOpts} from '../../preferences/moderation-opts' import {truncateAndInvalidate} from '../util' import {RQKEY as RQKEY_NOTIFS} from './feed' @@ -120,9 +119,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { // update & broadcast setNumUnread('') broadcast.postMessage({event: ''}) - if (isNative) { - Notifications.setBadgeCountAsync(0) - } + decrementBadgeCount(Math.min(cacheRef.current.unreadCount, 30)) }, async checkUnread({ @@ -163,9 +160,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) { : unreadCount === 0 ? '' : String(unreadCount) - if (isNative) { - Notifications.setBadgeCountAsync(Math.min(unreadCount, 30)) - } // track last sync const now = new Date() |