From f083f181e2c8aa0af3ac1381303f61792d5975f5 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Wed, 14 Sep 2022 12:45:21 +0000 Subject: [PATCH] fix: only warn once if triggeredNotifications are not supported (#2344) Co-authored-by: Dominik Pschenitschni Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/2344 Reviewed-by: konrad Co-authored-by: Dominik Pschenitschni Co-committed-by: Dominik Pschenitschni --- src/models/task.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/models/task.ts b/src/models/task.ts index d5e698fb..3d1a99bd 100644 --- a/src/models/task.ts +++ b/src/models/task.ts @@ -21,9 +21,13 @@ import UserModel from './user' import AttachmentModel from './attachment' import SubscriptionModel from './subscription' -const SUPPORTS_TRIGGERED_NOTIFICATION = 'Notification' in window && 'showTrigger' in Notification.prototype export const TASK_DEFAULT_COLOR = '#1973ff' +const SUPPORTS_TRIGGERED_NOTIFICATION = 'Notification' in window && 'showTrigger' in Notification.prototype +if (!SUPPORTS_TRIGGERED_NOTIFICATION) { + console.debug('This browser does not support triggered notifications') +} + export function getHexColor(hexColor: string) { if (hexColor === '' || hexColor === '#') { return TASK_DEFAULT_COLOR @@ -176,7 +180,6 @@ export default class TaskModel extends AbstractModel implements ITask { async cancelScheduledNotifications() { if (!SUPPORTS_TRIGGERED_NOTIFICATION) { - console.debug('This browser does not support triggered notifications') return } @@ -211,7 +214,6 @@ export default class TaskModel extends AbstractModel implements ITask { } if (!SUPPORTS_TRIGGERED_NOTIFICATION) { - console.debug('This browser does not support triggered notifications') return }