Improved push notifications for Chrome
This commit is contained in:
parent
edbdba582e
commit
db5315d7e4
@ -60,13 +60,15 @@ self.addEventListener('push', function(event) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
var closePromise = notificationPromise.catch(function () {
|
var closePromise = notificationPromise.catch(function () {
|
||||||
console.log('[SW] Closing all notifications on push')
|
console.log('[SW] Closing all notifications on push', hasActiveWindows)
|
||||||
if (userInvisibleSupported || hasActiveWindows) {
|
if (userInvisibleSupported) {
|
||||||
return closeAllNotifications()
|
return closeAllNotifications()
|
||||||
}
|
}
|
||||||
var promise = self.registration.showNotification('Telegram').then(function () {
|
var promise = self.registration.showNotification('Telegram').then(function () {
|
||||||
|
// if (hasActiveWindows) {
|
||||||
// return closeAllNotifications()
|
// return closeAllNotifications()
|
||||||
setTimeout(closeAllNotifications, 100)
|
// }
|
||||||
|
setTimeout(closeAllNotifications, hasActiveWindows ? 0 : 100)
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.error('Show notification error', error)
|
console.error('Show notification error', error)
|
||||||
})
|
})
|
||||||
|
@ -3627,12 +3627,14 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
|
|
||||||
$rootScope.$on('push_notification_click', function (e, notificationData) {
|
$rootScope.$on('push_notification_click', function (e, notificationData) {
|
||||||
if (notificationData.action == 'push_settings') {
|
if (notificationData.action == 'push_settings') {
|
||||||
|
topMessagesPromise.then(function () {
|
||||||
$modal.open({
|
$modal.open({
|
||||||
templateUrl: templateUrl('settings_modal'),
|
templateUrl: templateUrl('settings_modal'),
|
||||||
controller: 'SettingsModalController',
|
controller: 'SettingsModalController',
|
||||||
windowClass: 'settings_modal_window mobile_modal',
|
windowClass: 'settings_modal_window mobile_modal',
|
||||||
backdrop: 'single'
|
backdrop: 'single'
|
||||||
})
|
})
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (notificationData.action == 'mute1d') {
|
if (notificationData.action == 'mute1d') {
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
importScripts('js/lib/push_worker.js')
|
importScripts('js/lib/push_worker.js')
|
||||||
|
|
||||||
// Version 50
|
// Version 53
|
Loading…
Reference in New Issue
Block a user