Skip to content

Commit

Permalink
App: Fix bug related to notifications settings
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
tohjustin committed Jul 11, 2017
1 parent 9f2ddf9 commit 3fd51a6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3fd51a6

Please sign in to comment.