Improved read messages
This commit is contained in:
parent
1d0709bcf6
commit
694584ec9f
@ -1515,7 +1515,9 @@ angular.module('myApp.services')
|
|||||||
random_id: randomIDS,
|
random_id: randomIDS,
|
||||||
id: updates.id
|
id: updates.id
|
||||||
}, {
|
}, {
|
||||||
_: isChannel ? 'updateNewChannelMessage' : 'updateNewMessage',
|
_: isChannel
|
||||||
|
? 'updateNewChannelMessage'
|
||||||
|
: 'updateNewMessage',
|
||||||
message: message,
|
message: message,
|
||||||
pts: updates.pts,
|
pts: updates.pts,
|
||||||
pts_count: updates.pts_count
|
pts_count: updates.pts_count
|
||||||
@ -2846,9 +2848,21 @@ angular.module('myApp.services')
|
|||||||
function handleNewDialogs () {
|
function handleNewDialogs () {
|
||||||
$timeout.cancel(newDialogsHandlePromise)
|
$timeout.cancel(newDialogsHandlePromise)
|
||||||
newDialogsHandlePromise = false
|
newDialogsHandlePromise = false
|
||||||
angular.forEach(newDialogsToHandle, function (dialog) {
|
var newMaxSeenID = 0
|
||||||
pushDialogToStorage(dialog)
|
angular.forEach(newDialogsToHandle, function (dialog, peerID) {
|
||||||
|
if (dialog.reload) {
|
||||||
|
reloadConversation(peerID)
|
||||||
|
delete newDialogsToHandle[peerID]
|
||||||
|
} else {
|
||||||
|
pushDialogToStorage(dialog)
|
||||||
|
if (!AppPeersManager.isChannel(peerID)) {
|
||||||
|
newMaxSeenID = Math.max(newMaxSeenID, dialog.top_message || 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
if (newMaxSeenID !== false) {
|
||||||
|
incrementMaxSeenID(newMaxSeenID)
|
||||||
|
}
|
||||||
$rootScope.$broadcast('dialogs_multiupdate', newDialogsToHandle)
|
$rootScope.$broadcast('dialogs_multiupdate', newDialogsToHandle)
|
||||||
newDialogsToHandle = {}
|
newDialogsToHandle = {}
|
||||||
}
|
}
|
||||||
@ -2898,6 +2912,15 @@ angular.module('myApp.services')
|
|||||||
var message = update.message
|
var message = update.message
|
||||||
var peerID = getMessagePeer(message)
|
var peerID = getMessagePeer(message)
|
||||||
var historyStorage = historiesStorage[peerID]
|
var historyStorage = historiesStorage[peerID]
|
||||||
|
var foundDialog = getDialogByPeerID(peerID)
|
||||||
|
|
||||||
|
if (!foundDialog.length) {
|
||||||
|
newDialogsToHandle[peerID] = {reload: true}
|
||||||
|
if (!newDialogsHandlePromise) {
|
||||||
|
newDialogsHandlePromise = $timeout(handleNewDialogs, 0)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
if (update._ == 'updateNewChannelMessage') {
|
if (update._ == 'updateNewChannelMessage') {
|
||||||
var chat = AppChatsManager.getChat(-peerID)
|
var chat = AppChatsManager.getChat(-peerID)
|
||||||
@ -2960,23 +2983,11 @@ angular.module('myApp.services')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var foundDialog = getDialogByPeerID(peerID)
|
|
||||||
var dialog
|
|
||||||
var inboxUnread = !message.pFlags.out && message.pFlags.unread
|
var inboxUnread = !message.pFlags.out && message.pFlags.unread
|
||||||
|
var dialog = foundDialog[0]
|
||||||
if (foundDialog.length) {
|
dialog.top_message = message.mid
|
||||||
dialog = foundDialog[0]
|
if (inboxUnread) {
|
||||||
dialog.top_message = message.mid
|
dialog.unread_count++
|
||||||
if (inboxUnread) {
|
|
||||||
dialog.unread_count++
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
SearchIndexManager.indexObject(peerID, AppPeersManager.getPeerSearchText(peerID), dialogsIndex)
|
|
||||||
dialog = {
|
|
||||||
peerID: peerID,
|
|
||||||
unread_count: inboxUnread ? 1 : 0,
|
|
||||||
top_message: message.mid
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dialog.index = generateDialogIndex(message.date)
|
dialog.index = generateDialogIndex(message.date)
|
||||||
|
|
||||||
@ -3011,10 +3022,6 @@ angular.module('myApp.services')
|
|||||||
notificationsHandlePromise = $timeout(handleNotifications, 1000)
|
notificationsHandlePromise = $timeout(handleNotifications, 1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AppPeersManager.isChannel(peerID)) {
|
|
||||||
incrementMaxSeenID(message.id)
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'updateEditMessage':
|
case 'updateEditMessage':
|
||||||
@ -3325,8 +3332,9 @@ angular.module('myApp.services')
|
|||||||
var hasUpdated = false
|
var hasUpdated = false
|
||||||
angular.forEach(dialogsResult.dialogs, function (dialog) {
|
angular.forEach(dialogsResult.dialogs, function (dialog) {
|
||||||
if (dialog.top_message) {
|
if (dialog.top_message) {
|
||||||
|
var wasBefore = getDialogByPeerID(dialog.peerID).length > 0
|
||||||
saveConversation(dialog)
|
saveConversation(dialog)
|
||||||
if (getDialogByPeerID(dialog.peerID).length) {
|
if (wasBefore) {
|
||||||
$rootScope.$broadcast('dialog_top', dialog)
|
$rootScope.$broadcast('dialog_top', dialog)
|
||||||
} else {
|
} else {
|
||||||
updatedDialogs[dialog.peerID] = dialog
|
updatedDialogs[dialog.peerID] = dialog
|
||||||
|
@ -70,8 +70,9 @@
|
|||||||
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_link">
|
<div class="md_modal_iconed_section_wrap md_modal_iconed_section_link">
|
||||||
<i class="md_modal_section_icon md_modal_section_icon_more"></i>
|
<i class="md_modal_section_icon md_modal_section_icon_more"></i>
|
||||||
|
|
||||||
<div class="md_modal_section_link_wrap">
|
<div class="md_modal_section_link_wrap" ng-switch="chatFull.chat.pFlags.left || chatFull.chat.pFlags.kicked || chatFull.chat._ == 'chatForbidden'">
|
||||||
<a class="md_modal_section_link" ng-click="flushHistory(true)" my-i18n="group_modal_menu_clear_history"></a>
|
<a ng-switch-when="true" class="md_modal_section_link" ng-click="flushHistory(false)" my-i18n="group_modal_menu_delete_group"></a>
|
||||||
|
<a ng-switch-default class="md_modal_section_link" ng-click="flushHistory(true)" my-i18n="group_modal_menu_clear_history"></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user