diff options
Diffstat (limited to 'src/lib/hooks/useNotificationHandler.ts')
-rw-r--r-- | src/lib/hooks/useNotificationHandler.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/hooks/useNotificationHandler.ts b/src/lib/hooks/useNotificationHandler.ts index 625ec9e6a..69ae536d0 100644 --- a/src/lib/hooks/useNotificationHandler.ts +++ b/src/lib/hooks/useNotificationHandler.ts @@ -177,7 +177,14 @@ export function useNotificationsHandler() { Notifications.setNotificationHandler({ handleNotification: async e => { - if (e.request.trigger.type !== 'push') return DEFAULT_HANDLER_OPTIONS + if ( + e.request.trigger == null || + typeof e.request.trigger !== 'object' || + !('type' in e.request.trigger) || + e.request.trigger.type !== 'push' + ) { + return DEFAULT_HANDLER_OPTIONS + } logger.debug( 'Notifications: received', @@ -220,6 +227,9 @@ export function useNotificationsHandler() { if ( e.actionIdentifier === Notifications.DEFAULT_ACTION_IDENTIFIER && + e.notification.request.trigger != null && + typeof e.notification.request.trigger === 'object' && + 'type' in e.notification.request.trigger && e.notification.request.trigger.type === 'push' ) { logger.debug( |