diff options
Diffstat (limited to 'src/lib/hooks/useNotificationHandler.ts')
-rw-r--r-- | src/lib/hooks/useNotificationHandler.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/hooks/useNotificationHandler.ts b/src/lib/hooks/useNotificationHandler.ts index b5566f8a6..9c9522aa5 100644 --- a/src/lib/hooks/useNotificationHandler.ts +++ b/src/lib/hooks/useNotificationHandler.ts @@ -4,7 +4,7 @@ import {CommonActions, useNavigation} from '@react-navigation/native' import {useQueryClient} from '@tanstack/react-query' import {useAccountSwitcher} from '#/lib/hooks/useAccountSwitcher' -import {NavigationProp} from '#/lib/routes/types' +import {type NavigationProp} from '#/lib/routes/types' import {logEvent} from '#/lib/statsig/statsig' import {Logger} from '#/logger' import {isAndroid} from '#/platform/detection' @@ -41,10 +41,11 @@ type NotificationPayload = } const DEFAULT_HANDLER_OPTIONS = { - shouldShowAlert: false, + shouldShowBanner: false, + shouldShowList: false, shouldPlaySound: false, shouldSetBadge: true, -} +} satisfies Notifications.NotificationBehavior // These need to stay outside the hook to persist between account switches let storedPayload: NotificationPayload | undefined @@ -195,11 +196,13 @@ export function useNotificationsHandler() { payload.reason === 'chat-message' && payload.recipientDid === currentAccount?.did ) { + const shouldAlert = payload.convoId !== currentConvoId return { - shouldShowAlert: payload.convoId !== currentConvoId, + shouldShowList: shouldAlert, + shouldShowBanner: shouldAlert, shouldPlaySound: false, shouldSetBadge: false, - } + } satisfies Notifications.NotificationBehavior } // Any notification other than a chat message should invalidate the unread page |