Browse Source

Improved silent messages support

master
Igor Zhukov 7 years ago
parent
commit
1a93895d4c
  1. 7
      app/js/messages_manager.js
  2. 3
      app/js/services.js

7
app/js/messages_manager.js

@ -197,8 +197,7 @@ angular.module('myApp.services') @@ -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') @@ -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') @@ -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) {

3
app/js/services.js

@ -3869,7 +3869,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -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

Loading…
Cancel
Save