From 3fd51a6bde6c2aa697fe1a183dbe59a3a9116597 Mon Sep 17 00:00:00 2001 From: Justin Toh Date: Mon, 10 Jul 2017 21:54:24 -0700 Subject: [PATCH] App: Fix bug related to notifications settings When the app loads the user notification preference from storage, it doesn't take into account whether permission has been given to the browser. Hence when the user allows notification in the app settings & block notifications in the browser setting, the notification toggle switch in the settings view would enter a weird state where it's set to true + disabled (should be set to false + disabledin such a scenario). --- src/App.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index 00ee2de..9e59382 100644 --- a/src/App.vue +++ b/src/App.vue @@ -82,8 +82,7 @@ export default { // app Settings workDuration: 1500, breakDuration: 300, - // allowNotification: true && !notifications.isBlocked(), - allowNotification: true, + allowNotification: true && !notifications.isBlocked(), // worker objects for our timer timerWorker: null, alarmWorker: null, @@ -217,7 +216,7 @@ export default { const { workDuration, breakDuration, allowNotification } = userSettings; this.workDuration = workDuration; this.breakDuration = breakDuration; - this.allowNotification = allowNotification; + this.allowNotification = allowNotification && !notifications.isBlocked(); // Update `timeRemaining` to newly loaded `workDuration` this.timeRemaining = workDuration;