From b029889f27bbbb0cb7376c462106b0eb0650a808 Mon Sep 17 00:00:00 2001 From: dpschen Date: Mon, 22 Nov 2021 19:03:27 +0000 Subject: [PATCH] fix: check for notification api (#1043) Co-authored-by: Dominik Pschenitschni Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1043 Reviewed-by: konrad Co-authored-by: dpschen Co-committed-by: dpschen --- src/models/task.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/models/task.js b/src/models/task.js index d83f35a60..c03342370 100644 --- a/src/models/task.js +++ b/src/models/task.js @@ -7,6 +7,8 @@ import {REPEAT_MODE_DEFAULT} from './constants/taskRepeatModes' import SubscriptionModel from '@/models/subscription' import {parseDateOrNull} from '@/helpers/parseDateOrNull' +const SUPPORTS_TRIGGERED_NOTIFICATION = 'Notification' in window && 'showTrigger' in Notification.prototype + export default class TaskModel extends AbstractModel { defaultColor = '198CFF' @@ -161,7 +163,7 @@ export default class TaskModel extends AbstractModel { } async cancelScheduledNotifications() { - if (!(Notification && 'showTrigger' in Notification.prototype)) { + if (!SUPPORTS_TRIGGERED_NOTIFICATION) { console.debug('This browser does not support triggered notifications') return } @@ -196,7 +198,7 @@ export default class TaskModel extends AbstractModel { return } - if (!(Notification && 'showTrigger' in Notification.prototype)) { + if (!SUPPORTS_TRIGGERED_NOTIFICATION) { console.debug('This browser does not support triggered notifications') return }