Dispatch notifier_enabled when permission given if we don't already have it.

This commit is contained in:
David Baker 2015-07-21 15:35:30 -07:00
parent aaa96f1ac1
commit 9af09de7d4
1 changed files with 11 additions and 4 deletions

View File

@ -55,17 +55,24 @@ module.exports = {
global.Notification.requestPermission(function() {
if (callback) {
callback();
dis.dispatch({
action: "notifier_enabled",
value: true
});
}
});
}
if (!global.localStorage) return;
global.localStorage.setItem('notifications_enabled', 'true');
if (this.havePermission) {
dis.dispatch({
action: "notifier_enabled",
value: true
});
}
}
else {
if (!global.localStorage) return;
global.localStorage.setItem('notifications_enabled', 'false');