|
|
@ -3468,7 +3468,7 @@ angular.module('myApp.services', ['myApp.i18n']) |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.service('NotificationsManager', function ($rootScope, $window, $timeout, $interval, $q, MtpApiManager, AppPeersManager, IdleManager, Storage, AppRuntimeManager) { |
|
|
|
.service('NotificationsManager', function ($rootScope, $window, $timeout, $interval, $q, _, MtpApiManager, AppPeersManager, IdleManager, Storage, AppRuntimeManager) { |
|
|
|
|
|
|
|
|
|
|
|
navigator.vibrate = navigator.vibrate || navigator.mozVibrate || navigator.webkitVibrate; |
|
|
|
navigator.vibrate = navigator.vibrate || navigator.mozVibrate || navigator.webkitVibrate; |
|
|
|
|
|
|
|
|
|
|
@ -3478,8 +3478,9 @@ angular.module('myApp.services', ['myApp.i18n']) |
|
|
|
var notificationsCount = 0; |
|
|
|
var notificationsCount = 0; |
|
|
|
var vibrateSupport = !!navigator.vibrate; |
|
|
|
var vibrateSupport = !!navigator.vibrate; |
|
|
|
var peerSettings = {}; |
|
|
|
var peerSettings = {}; |
|
|
|
var faviconBackupEl = $('link[rel="icon"]'), |
|
|
|
var faviconBackupEl = $('link[rel="icon"]:first'), |
|
|
|
faviconNewEl = $('<link rel="icon" href="favicon_unread.ico" type="image/x-icon" />'); |
|
|
|
faviconNewEl = $('<link rel="icon" href="favicon_unread.ico" type="image/x-icon" />'); |
|
|
|
|
|
|
|
var langNotificationsPluralize = _.pluralize('page_title_pluralize_notifications'); |
|
|
|
|
|
|
|
|
|
|
|
var titleBackup = document.title, |
|
|
|
var titleBackup = document.title, |
|
|
|
titlePromise; |
|
|
|
titlePromise; |
|
|
@ -3490,7 +3491,7 @@ angular.module('myApp.services', ['myApp.i18n']) |
|
|
|
|
|
|
|
|
|
|
|
if (!newVal) { |
|
|
|
if (!newVal) { |
|
|
|
document.title = titleBackup; |
|
|
|
document.title = titleBackup; |
|
|
|
$('link[rel="icon"]').replaceWith(faviconBackupEl); |
|
|
|
$('link[rel="icon"]:first').replaceWith(faviconBackupEl); |
|
|
|
notificationsClear(); |
|
|
|
notificationsClear(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
titleBackup = document.title; |
|
|
|
titleBackup = document.title; |
|
|
@ -3499,16 +3500,13 @@ angular.module('myApp.services', ['myApp.i18n']) |
|
|
|
var time = tsNow(); |
|
|
|
var time = tsNow(); |
|
|
|
if (!notificationsCount || time % 2000 > 1000) { |
|
|
|
if (!notificationsCount || time % 2000 > 1000) { |
|
|
|
document.title = titleBackup; |
|
|
|
document.title = titleBackup; |
|
|
|
var curFav = $('link[rel="icon"]'); |
|
|
|
var curFav = $('link[rel="icon"]:first'); |
|
|
|
if (curFav.attr('href').indexOf('favicon_unread') != -1) { |
|
|
|
if (curFav.attr('href').indexOf('favicon_unread') != -1) { |
|
|
|
curFav.replaceWith(faviconBackupEl); |
|
|
|
curFav.replaceWith(faviconBackupEl); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
document.title = notificationsCount > 1 |
|
|
|
document.title = langNotificationsPluralize(notificationsCount); |
|
|
|
? (notificationsCount + ' notifications') |
|
|
|
$('link[rel="icon"]:first').replaceWith(faviconNewEl); |
|
|
|
: '1 notification'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('link[rel="icon"]').replaceWith(faviconNewEl); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
}, 1000); |
|
|
|
} |
|
|
|
} |
|
|
|