fix: only warn once if triggeredNotifications are not supported (#2344)
continuous-integration/drone/push Build is passing Details

Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: #2344
Reviewed-by: konrad <k@knt.li>
Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:
Dominik Pschenitschni 2022-09-14 12:45:21 +00:00 committed by konrad
parent db8b8812af
commit f083f181e2
1 changed files with 5 additions and 3 deletions

View File

@ -21,9 +21,13 @@ import UserModel from './user'
import AttachmentModel from './attachment' import AttachmentModel from './attachment'
import SubscriptionModel from './subscription' import SubscriptionModel from './subscription'
const SUPPORTS_TRIGGERED_NOTIFICATION = 'Notification' in window && 'showTrigger' in Notification.prototype
export const TASK_DEFAULT_COLOR = '#1973ff' 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) { export function getHexColor(hexColor: string) {
if (hexColor === '' || hexColor === '#') { if (hexColor === '' || hexColor === '#') {
return TASK_DEFAULT_COLOR return TASK_DEFAULT_COLOR
@ -176,7 +180,6 @@ export default class TaskModel extends AbstractModel<ITask> implements ITask {
async cancelScheduledNotifications() { async cancelScheduledNotifications() {
if (!SUPPORTS_TRIGGERED_NOTIFICATION) { if (!SUPPORTS_TRIGGERED_NOTIFICATION) {
console.debug('This browser does not support triggered notifications')
return return
} }
@ -211,7 +214,6 @@ export default class TaskModel extends AbstractModel<ITask> implements ITask {
} }
if (!SUPPORTS_TRIGGERED_NOTIFICATION) { if (!SUPPORTS_TRIGGERED_NOTIFICATION) {
console.debug('This browser does not support triggered notifications')
return return
} }