From 1a93895d4c1dc26cbbc2ad57e6606e041da5248e Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Mon, 30 Jan 2017 17:22:13 +0300 Subject: [PATCH] Improved silent messages support --- app/js/messages_manager.js | 7 +++---- app/js/services.js | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/js/messages_manager.js b/app/js/messages_manager.js index 6358b6f8..533669bb 100644 --- a/app/js/messages_manager.js +++ b/app/js/messages_manager.js @@ -197,8 +197,7 @@ angular.module('myApp.services') maxSeenID && dialog.top_message > maxSeenID && message.pFlags.unread && - !message.pFlags.out && - !message.pFlags.silent + !message.pFlags.out ) { var notifyPeer = message.flags & 16 ? message.from_id : peerID NotificationsManager.getPeerMuted(notifyPeer).then(function (muted) { @@ -2784,6 +2783,7 @@ angular.module('myApp.services') notification.message = notificationMessage notification.key = 'msg' + message.mid notification.tag = peerString + notification.silent = message.pFlags.silent || false if (notificationPhoto.location && !notificationPhoto.location.empty) { MtpApiFileManager.downloadSmallFile(notificationPhoto.location, notificationPhoto.size).then(function (blob) { @@ -2954,8 +2954,7 @@ angular.module('myApp.services') } if (inboxUnread && - ($rootScope.selectedPeerID != peerID || $rootScope.idle.isIDLE) && - !message.pFlags.silent) { + ($rootScope.selectedPeerID != peerID || $rootScope.idle.isIDLE)) { var notifyPeer = message.flags & 16 ? message.from_id : peerID var notifyPeerToHandle = notificationsToHandle[notifyPeer] if (notifyPeerToHandle === undefined) { diff --git a/app/js/services.js b/app/js/services.js index b940194b..aac8c5d6 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -3869,7 +3869,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) notification = new Notification(data.title, { icon: data.image || '', body: data.message || '', - tag: data.tag || '' + tag: data.tag || '', + silent: data.silent || false }) } catch (e) { notificationsUiSupport = false