mirror of
https://github.com/moparisthebest/mail
synced 2025-01-08 12:08:07 -05:00
Catch notification error on Chrome for Android
This commit is contained in:
parent
44dac729aa
commit
4293031f1f
@ -4,8 +4,9 @@ var ngModule = angular.module('woUtil');
|
|||||||
ngModule.service('notification', Notif);
|
ngModule.service('notification', Notif);
|
||||||
module.exports = Notif;
|
module.exports = Notif;
|
||||||
|
|
||||||
function Notif(appConfig) {
|
function Notif(appConfig, axe) {
|
||||||
this._appConfig = appConfig;
|
this._appConfig = appConfig;
|
||||||
|
this._axe = axe;
|
||||||
|
|
||||||
if (window.Notification) {
|
if (window.Notification) {
|
||||||
this.hasPermission = Notification.permission === "granted";
|
this.hasPermission = Notification.permission === "granted";
|
||||||
@ -39,10 +40,17 @@ Notif.prototype.create = function(options) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var notification = new Notification(options.title, {
|
var notification;
|
||||||
body: options.message,
|
try {
|
||||||
icon: self._appConfig.config.iconPath
|
notification = new Notification(options.title, {
|
||||||
});
|
body: options.message,
|
||||||
|
icon: self._appConfig.config.iconPath
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
self._axe.error('Displaying notification failed: ' + err.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
notification.onclick = function() {
|
notification.onclick = function() {
|
||||||
window.focus();
|
window.focus();
|
||||||
options.onClick();
|
options.onClick();
|
||||||
|
Loading…
Reference in New Issue
Block a user