From 68a0700f7fc9930969922f97fa4c59ca480a5e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Fri, 21 Feb 2020 15:47:10 +0100 Subject: [PATCH] Removing notifications completely from safari --- src/components/VinlottisPage.vue | 3 +++ src/mixins/ServiceWorkerMixin.js | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/VinlottisPage.vue b/src/components/VinlottisPage.vue index c4d071a..260c06c 100644 --- a/src/components/VinlottisPage.vue +++ b/src/components/VinlottisPage.vue @@ -73,6 +73,9 @@ export default { }, computed: { notificationAllowed: function() { + if (!("PushManager" in window)) { + return false; + } return ( Notification.permission !== "granted" || !this.pushAllowed || diff --git a/src/mixins/ServiceWorkerMixin.js b/src/mixins/ServiceWorkerMixin.js index d1af105..51f4e3e 100644 --- a/src/mixins/ServiceWorkerMixin.js +++ b/src/mixins/ServiceWorkerMixin.js @@ -4,8 +4,10 @@ var serviceWorkerRegistrationMixin = { console.log("Nettleseren din støtter ikke service-workers."); return; } - if (Notification.permission !== "granted") { - localStorage.removeItem("push"); + if ("PushManager" in window) { + if (Notification.permission !== "granted") { + localStorage.removeItem("push"); + } } this.registerPushListener(); this.registerServiceWorker();