Improve Notification probing
This commit is contained in:
parent
5623827433
commit
1c7fa956dc
|
@ -30,22 +30,21 @@ function init(messageBus) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
if (!("Notification" in window)) {
|
||||||
if (!Notification) {
|
|
||||||
Em.Logger.info('Discourse desktop notifications are disabled - not supported by browser');
|
Em.Logger.info('Discourse desktop notifications are disabled - not supported by browser');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
Em.Logger.info('Discourse desktop notifications are disabled - not defined');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
try {
|
||||||
if (Notification.permission === "granted") {
|
if (Notification.permission === "granted") {
|
||||||
havePermission = true;
|
havePermission = true;
|
||||||
} else if (Notification.permission === "denied") {
|
} else if (Notification.permission === "denied") {
|
||||||
havePermission = false;
|
havePermission = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Em.Logger.warn('Unexpected error, Notification is defined on window but not a responding correctly ' + e);
|
||||||
|
}
|
||||||
|
|
||||||
liveEnabled = true;
|
liveEnabled = true;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue