diff --git a/app/js/lib/push_worker.js b/app/js/lib/push_worker.js index 517093b7..fc479d80 100644 --- a/app/js/lib/push_worker.js +++ b/app/js/lib/push_worker.js @@ -54,13 +54,13 @@ self.addEventListener('push', function(event) { var closePromise = notificationPromise.catch(function () { console.log('[SW] Closing all notifications on push', hasActiveWindows) - if (userInvisibleIsSupported()) { + if (userInvisibleIsSupported() || hasActiveWindows) { return closeAllNotifications() } var promise = self.registration.showNotification('Telegram').then(function () { - // if (hasActiveWindows) { - // return closeAllNotifications() - // } + if (hasActiveWindows) { + return closeAllNotifications() + } setTimeout(closeAllNotifications, hasActiveWindows ? 0 : 100) }).catch(function (error) { console.error('Show notification error', error) @@ -133,6 +133,8 @@ function fireNotification(obj, settings, lang) { tag = 'unknown_peer' } + console.log('[SW] show notify', title, body, icon, obj) + var notificationPromise = self.registration.showNotification(title, { body: body, icon: icon,