Added IE10+ notifications support
This commit is contained in:
parent
f607fdf72e
commit
65eb3a6ab6
@ -1818,6 +1818,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
function notifyAboutMessage (message) {
|
function notifyAboutMessage (message) {
|
||||||
|
console.warn('notify about message');
|
||||||
var peerID = getMessagePeer(message);
|
var peerID = getMessagePeer(message);
|
||||||
var fromUser = AppUsersManager.getUser(message.from_id);
|
var fromUser = AppUsersManager.getUser(message.from_id);
|
||||||
var fromPhoto = AppUsersManager.getUserPhoto(message.from_id, 'User');
|
var fromPhoto = AppUsersManager.getUserPhoto(message.from_id, 'User');
|
||||||
@ -3352,7 +3353,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
|
|
||||||
navigator.vibrate = navigator.vibrate || navigator.mozVibrate || navigator.webkitVibrate;
|
navigator.vibrate = navigator.vibrate || navigator.mozVibrate || navigator.webkitVibrate;
|
||||||
|
|
||||||
var notificationsUiSupport = ('Notification' in window) || ('mozNotification' in navigator);
|
var notificationsUiSupport = ('Notification' in window) ||
|
||||||
|
('mozNotification' in navigator) ||
|
||||||
|
window.external && window.external.msIsSiteMode();
|
||||||
var notificationsShown = {};
|
var notificationsShown = {};
|
||||||
var notificationIndex = 0;
|
var notificationIndex = 0;
|
||||||
var notificationsCount = 0;
|
var notificationsCount = 0;
|
||||||
@ -3495,7 +3498,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
function notify (data) {
|
function notify (data) {
|
||||||
// console.log('notify', $rootScope.idle.isIDLE, notificationsUiSupport);
|
console.log('notify', $rootScope.idle.isIDLE, notificationsUiSupport);
|
||||||
|
|
||||||
// FFOS Notification blob src bug workaround
|
// FFOS Notification blob src bug workaround
|
||||||
if (Config.Navigator.ffos) {
|
if (Config.Navigator.ffos) {
|
||||||
@ -3541,6 +3544,15 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
else if ('mozNotification' in navigator) {
|
else if ('mozNotification' in navigator) {
|
||||||
notification = navigator.mozNotification.createNotification(data.title, data.message || '', data.image || '');
|
notification = navigator.mozNotification.createNotification(data.title, data.message || '', data.image || '');
|
||||||
}
|
}
|
||||||
|
else if (window.external && window.external.msIsSiteMode()) {
|
||||||
|
window.external.msSiteModeClearIconOverlay();
|
||||||
|
console.log('notify', data.image, data.title);
|
||||||
|
window.external.msSiteModeSetIconOverlay('img/icons/icon16.png', data.title + (data.message ? ' ' + data.message : ''));
|
||||||
|
window.external.msSiteModeActivate();
|
||||||
|
notification = {
|
||||||
|
index: idx
|
||||||
|
};
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3585,19 +3597,27 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
if (notification.close) {
|
if (notification.close) {
|
||||||
notification.close();
|
notification.close();
|
||||||
}
|
}
|
||||||
|
else if (notification.index == notificationIndex &&
|
||||||
|
window.external && window.external.msIsSiteMode()) {
|
||||||
|
window.external.msSiteModeClearIconOverlay();
|
||||||
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
delete notificationsCount[key];
|
delete notificationsCount[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function notificationsClear() {
|
function notificationsClear() {
|
||||||
angular.forEach(notificationsShown, function (notification) {
|
if (window.external && window.external.msIsSiteMode()) {
|
||||||
try {
|
window.external.msSiteModeClearIconOverlay();
|
||||||
if (notification.close) {
|
} else {
|
||||||
notification.close()
|
angular.forEach(notificationsShown, function (notification) {
|
||||||
}
|
try {
|
||||||
} catch (e) {}
|
if (notification.close) {
|
||||||
});
|
notification.close()
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
});
|
||||||
|
}
|
||||||
notificationsShown = {};
|
notificationsShown = {};
|
||||||
notificationsCount = 0;
|
notificationsCount = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user