mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Improve Notification probing
This commit is contained in:
parent
5623827433
commit
1c7fa956dc
1 changed files with 11 additions and 12 deletions
|
@ -30,21 +30,20 @@ function init(messageBus) {
|
|||
|
||||
|
||||
|
||||
try {
|
||||
if (!Notification) {
|
||||
Em.Logger.info('Discourse desktop notifications are disabled - not supported by browser');
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
Em.Logger.info('Discourse desktop notifications are disabled - not defined');
|
||||
if (!("Notification" in window)) {
|
||||
Em.Logger.info('Discourse desktop notifications are disabled - not supported by browser');
|
||||
return;
|
||||
}
|
||||
|
||||
if (Notification.permission === "granted") {
|
||||
havePermission = true;
|
||||
} else if (Notification.permission === "denied") {
|
||||
havePermission = false;
|
||||
return;
|
||||
try {
|
||||
if (Notification.permission === "granted") {
|
||||
havePermission = true;
|
||||
} else if (Notification.permission === "denied") {
|
||||
havePermission = false;
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
Em.Logger.warn('Unexpected error, Notification is defined on window but not a responding correctly ' + e);
|
||||
}
|
||||
|
||||
liveEnabled = true;
|
||||
|
|
Loading…
Reference in a new issue