|
|
|
@ -174,7 +174,7 @@ export class AppMessagesManager {
@@ -174,7 +174,7 @@ export class AppMessagesManager {
|
|
|
|
|
public newMessagesToHandle: {[peerId: string]: Set<number>} = {}; |
|
|
|
|
public newDialogsHandlePromise = 0; |
|
|
|
|
public newDialogsToHandle: {[peerId: string]: {reload: true} | Dialog} = {}; |
|
|
|
|
public newUpdatesAfterReloadToHandle: {[peerId: string]: Set<any>} = {}; |
|
|
|
|
public newUpdatesAfterReloadToHandle: {[peerId: string]: Set<Update>} = {}; |
|
|
|
|
|
|
|
|
|
private notificationsHandlePromise = 0; |
|
|
|
|
private notificationsToHandle: {[peerId: string]: { |
|
|
|
@ -207,10 +207,58 @@ export class AppMessagesManager {
@@ -207,10 +207,58 @@ export class AppMessagesManager {
|
|
|
|
|
|
|
|
|
|
constructor() { |
|
|
|
|
this.dialogsStorage = new DialogsStorage(this, appChatsManager, appPeersManager, serverTimeManager); |
|
|
|
|
this.filtersStorage = new FiltersStorage(this, appPeersManager, appUsersManager, appNotificationsManager, /* apiManager, */ rootScope); |
|
|
|
|
this.filtersStorage = new FiltersStorage(this, appPeersManager, appUsersManager, appNotificationsManager, apiUpdatesManager, /* apiManager, */ rootScope); |
|
|
|
|
|
|
|
|
|
rootScope.on('apiUpdate', (e) => { |
|
|
|
|
this.handleUpdate(e); |
|
|
|
|
rootScope.addMultipleEventsListeners({ |
|
|
|
|
updateMessageID: this.onUpdateMessageId, |
|
|
|
|
|
|
|
|
|
updateNewDiscussionMessage: this.onUpdateNewMessage, |
|
|
|
|
updateNewMessage: this.onUpdateNewMessage, |
|
|
|
|
updateNewChannelMessage: this.onUpdateNewMessage, |
|
|
|
|
|
|
|
|
|
updateDialogUnreadMark: this.onUpdateDialogUnreadMark, |
|
|
|
|
|
|
|
|
|
updateFolderPeers: this.onUpdateFolderPeers, |
|
|
|
|
|
|
|
|
|
updateDialogPinned: this.onUpdateDialogPinned, |
|
|
|
|
|
|
|
|
|
updatePinnedDialogs: this.onUpdatePinnedDialogs, |
|
|
|
|
|
|
|
|
|
updateEditMessage: this.onUpdateEditMessage, |
|
|
|
|
updateEditChannelMessage: this.onUpdateEditMessage, |
|
|
|
|
|
|
|
|
|
updateReadChannelDiscussionInbox: this.onUpdateReadHistory, |
|
|
|
|
updateReadChannelDiscussionOutbox: this.onUpdateReadHistory, |
|
|
|
|
updateReadHistoryInbox: this.onUpdateReadHistory, |
|
|
|
|
updateReadHistoryOutbox: this.onUpdateReadHistory, |
|
|
|
|
updateReadChannelInbox: this.onUpdateReadHistory, |
|
|
|
|
updateReadChannelOutbox: this.onUpdateReadHistory, |
|
|
|
|
|
|
|
|
|
updateChannelReadMessagesContents: this.onUpdateReadMessagesContents, |
|
|
|
|
updateReadMessagesContents: this.onUpdateReadMessagesContents, |
|
|
|
|
|
|
|
|
|
updateChannelAvailableMessages: this.onUpdateChannelAvailableMessages, |
|
|
|
|
|
|
|
|
|
updateDeleteMessages: this.onUpdateDeleteMessages, |
|
|
|
|
updateDeleteChannelMessages: this.onUpdateDeleteMessages, |
|
|
|
|
|
|
|
|
|
updateChannel: this.onUpdateChannel, |
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
updateChannelReload: this.onUpdateChannelReload, |
|
|
|
|
|
|
|
|
|
updateChannelMessageViews: this.onUpdateChannelMessageViews, |
|
|
|
|
|
|
|
|
|
updateServiceNotification: this.onUpdateServiceNotification, |
|
|
|
|
|
|
|
|
|
updatePinnedMessages: this.onUpdatePinnedMessages, |
|
|
|
|
updatePinnedChannelMessages: this.onUpdatePinnedMessages, |
|
|
|
|
|
|
|
|
|
updateNotifySettings: this.onUpdateNotifySettings, |
|
|
|
|
|
|
|
|
|
updateNewScheduledMessage: this.onUpdateNewScheduledMessage, |
|
|
|
|
|
|
|
|
|
updateDeleteScheduledMessages: this.onUpdateDeleteScheduledMessages |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// ! Invalidate notify settings, can optimize though
|
|
|
|
@ -2900,7 +2948,7 @@ export class AppMessagesManager {
@@ -2900,7 +2948,7 @@ export class AppMessagesManager {
|
|
|
|
|
}).then(bool => { |
|
|
|
|
if(bool) { |
|
|
|
|
const pFlags: Update.updateDialogPinned['pFlags'] = pinned ? {pinned} : {}; |
|
|
|
|
this.handleUpdate({ |
|
|
|
|
this.onUpdateDialogPinned({ |
|
|
|
|
_: 'updateDialogPinned', |
|
|
|
|
peer: appPeersManager.getDialogPeer(peerId), |
|
|
|
|
folder_id: filterId, |
|
|
|
@ -2921,7 +2969,7 @@ export class AppMessagesManager {
@@ -2921,7 +2969,7 @@ export class AppMessagesManager {
|
|
|
|
|
}).then(bool => { |
|
|
|
|
if(bool) { |
|
|
|
|
const pFlags: Update.updateDialogUnreadMark['pFlags'] = unread ? {unread} : {}; |
|
|
|
|
this.handleUpdate({ |
|
|
|
|
this.onUpdateDialogUnreadMark({ |
|
|
|
|
_: 'updateDialogUnreadMark', |
|
|
|
|
peer: appPeersManager.getDialogPeer(peerId), |
|
|
|
|
pFlags |
|
|
|
@ -3059,7 +3107,7 @@ export class AppMessagesManager {
@@ -3059,7 +3107,7 @@ export class AppMessagesManager {
|
|
|
|
|
|
|
|
|
|
if(this.newUpdatesAfterReloadToHandle[peerId] !== undefined) { |
|
|
|
|
for(const update of this.newUpdatesAfterReloadToHandle[peerId]) { |
|
|
|
|
this.handleUpdate(update); |
|
|
|
|
apiUpdatesManager.saveUpdate(update); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
delete this.newUpdatesAfterReloadToHandle[peerId]; |
|
|
|
@ -3927,13 +3975,7 @@ export class AppMessagesManager {
@@ -3927,13 +3975,7 @@ export class AppMessagesManager {
|
|
|
|
|
this.notificationsToHandle = {}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
public handleUpdate(update: Update) { |
|
|
|
|
/* if(DEBUG) { |
|
|
|
|
this.log.debug('handleUpdate', update._, update); |
|
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
switch(update._) { |
|
|
|
|
case 'updateMessageID': { |
|
|
|
|
private onUpdateMessageId = (update: Update.updateMessageID) => { |
|
|
|
|
const randomId = update.random_id; |
|
|
|
|
const pendingData = this.pendingByRandomId[randomId]; |
|
|
|
|
//this.log('AMM updateMessageID:', update, pendingData);
|
|
|
|
@ -3954,13 +3996,9 @@ export class AppMessagesManager {
@@ -3954,13 +3996,9 @@ export class AppMessagesManager {
|
|
|
|
|
this.pendingByMessageId[mid] = randomId; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'updateNewDiscussionMessage': |
|
|
|
|
case 'updateNewMessage': |
|
|
|
|
case 'updateNewChannelMessage': { |
|
|
|
|
private onUpdateNewMessage = (update: Update.updateNewDiscussionMessage | Update.updateNewMessage | Update.updateNewChannelMessage) => { |
|
|
|
|
const message = update.message as MyMessage; |
|
|
|
|
const peerId = this.getMessagePeer(message); |
|
|
|
|
const storage = this.getMessagesStorage(peerId); |
|
|
|
@ -3980,7 +4018,7 @@ export class AppMessagesManager {
@@ -3980,7 +4018,7 @@ export class AppMessagesManager {
|
|
|
|
|
message |
|
|
|
|
} as Update.updateNewDiscussionMessage; |
|
|
|
|
|
|
|
|
|
this.handleUpdate(update); |
|
|
|
|
this.onUpdateNewMessage(update); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!foundDialog.length && !isLocalThreadUpdate) { |
|
|
|
@ -4000,7 +4038,7 @@ export class AppMessagesManager {
@@ -4000,7 +4038,7 @@ export class AppMessagesManager {
|
|
|
|
|
const set = this.newUpdatesAfterReloadToHandle[peerId] ?? (this.newUpdatesAfterReloadToHandle[peerId] = new Set()); |
|
|
|
|
if(set.has(update)) { |
|
|
|
|
this.log.error('here we go again', peerId); |
|
|
|
|
break; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.newDialogsToHandle[peerId] = {reload: true}; |
|
|
|
@ -4008,13 +4046,13 @@ export class AppMessagesManager {
@@ -4008,13 +4046,13 @@ export class AppMessagesManager {
|
|
|
|
|
this.newUpdatesAfterReloadToHandle[peerId].add(update); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* if(update._ === 'updateNewChannelMessage') { |
|
|
|
|
const chat = appChatsManager.getChat(-peerId); |
|
|
|
|
if(chat.pFlags && (chat.pFlags.left || chat.pFlags.kicked)) { |
|
|
|
|
break; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} */ |
|
|
|
|
|
|
|
|
@ -4070,7 +4108,7 @@ export class AppMessagesManager {
@@ -4070,7 +4108,7 @@ export class AppMessagesManager {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(isLocalThreadUpdate) { |
|
|
|
|
break; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const dialog = foundDialog[0]; |
|
|
|
@ -4107,11 +4145,9 @@ export class AppMessagesManager {
@@ -4107,11 +4145,9 @@ export class AppMessagesManager {
|
|
|
|
|
this.notificationsHandlePromise = window.setTimeout(this.handleNotifications, 0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'updateDialogUnreadMark': { |
|
|
|
|
private onUpdateDialogUnreadMark = (update: Update.updateDialogUnreadMark) => { |
|
|
|
|
//this.log('updateDialogUnreadMark', update);
|
|
|
|
|
const peerId = appPeersManager.getPeerId((update.peer as DialogPeer.dialogPeer).peer); |
|
|
|
|
const foundDialog = this.getDialogByPeerId(peerId); |
|
|
|
@ -4130,11 +4166,10 @@ export class AppMessagesManager {
@@ -4130,11 +4166,10 @@ export class AppMessagesManager {
|
|
|
|
|
|
|
|
|
|
rootScope.broadcast('dialogs_multiupdate', {peerId: dialog}); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'updateFolderPeers': { // only 0 and 1 folders
|
|
|
|
|
// only 0 and 1 folders
|
|
|
|
|
private onUpdateFolderPeers = (update: Update.updateFolderPeers) => { |
|
|
|
|
//this.log('updateFolderPeers', update);
|
|
|
|
|
const peers = update.folder_peers; |
|
|
|
|
|
|
|
|
@ -4161,10 +4196,9 @@ export class AppMessagesManager {
@@ -4161,10 +4196,9 @@ export class AppMessagesManager {
|
|
|
|
|
this.dialogsStorage.pushDialog(dialog); // need for simultaneously updatePinnedDialogs
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
case 'updateDialogPinned': { |
|
|
|
|
private onUpdateDialogPinned = (update: Update.updateDialogPinned) => { |
|
|
|
|
const folderId = update.folder_id ?? 0; |
|
|
|
|
//this.log('updateDialogPinned', update);
|
|
|
|
|
const peerId = appPeersManager.getPeerId((update.peer as DialogPeer.dialogPeer).peer); |
|
|
|
@ -4196,11 +4230,9 @@ export class AppMessagesManager {
@@ -4196,11 +4230,9 @@ export class AppMessagesManager {
|
|
|
|
|
|
|
|
|
|
this.dialogsStorage.generateIndexForDialog(dialog); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'updatePinnedDialogs': { |
|
|
|
|
private onUpdatePinnedDialogs = (update: Update.updatePinnedDialogs) => { |
|
|
|
|
const folderId = update.folder_id ?? 0; |
|
|
|
|
|
|
|
|
|
const handleOrder = (order: number[]) => { |
|
|
|
@ -4264,24 +4296,21 @@ export class AppMessagesManager {
@@ -4264,24 +4296,21 @@ export class AppMessagesManager {
|
|
|
|
|
}); */ |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//this.log('before order:', this.dialogsStorage[0].map(d => d.peerId));
|
|
|
|
|
|
|
|
|
|
handleOrder(update.order.map(peer => appPeersManager.getPeerId((peer as DialogPeer.dialogPeer).peer))); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'updateEditMessage': |
|
|
|
|
case 'updateEditChannelMessage': { |
|
|
|
|
private onUpdateEditMessage = (update: Update.updateEditMessage | Update.updateEditChannelMessage) => { |
|
|
|
|
const message = update.message as MyMessage; |
|
|
|
|
const peerId = this.getMessagePeer(message); |
|
|
|
|
const mid = this.generateMessageId(message.id); |
|
|
|
|
const storage = this.getMessagesStorage(peerId); |
|
|
|
|
if(storage[mid] === undefined) { |
|
|
|
|
break; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// console.trace(dT(), 'edit message', message)
|
|
|
|
@ -4312,15 +4341,11 @@ export class AppMessagesManager {
@@ -4312,15 +4341,11 @@ export class AppMessagesManager {
|
|
|
|
|
rootScope.broadcast('dialogs_multiupdate', updatedDialogs); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
case 'updateReadChannelDiscussionInbox': |
|
|
|
|
case 'updateReadChannelDiscussionOutbox': |
|
|
|
|
case 'updateReadHistoryInbox': |
|
|
|
|
case 'updateReadHistoryOutbox': |
|
|
|
|
case 'updateReadChannelInbox': |
|
|
|
|
case 'updateReadChannelOutbox': { |
|
|
|
|
private onUpdateReadHistory = (update: Update.updateReadChannelDiscussionInbox | Update.updateReadChannelDiscussionOutbox |
|
|
|
|
| Update.updateReadHistoryInbox | Update.updateReadHistoryOutbox |
|
|
|
|
| Update.updateReadChannelInbox | Update.updateReadChannelOutbox) => { |
|
|
|
|
const channelId = (update as Update.updateReadChannelInbox).channel_id; |
|
|
|
|
const maxId = this.generateMessageId((update as Update.updateReadChannelInbox).max_id || (update as Update.updateReadChannelDiscussionInbox).read_max_id); |
|
|
|
|
const threadId = this.generateMessageId((update as Update.updateReadChannelDiscussionInbox).top_msg_id); |
|
|
|
@ -4420,12 +4445,9 @@ export class AppMessagesManager {
@@ -4420,12 +4445,9 @@ export class AppMessagesManager {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'updateChannelReadMessagesContents': |
|
|
|
|
case 'updateReadMessagesContents': { |
|
|
|
|
private onUpdateReadMessagesContents = (update: Update.updateChannelReadMessagesContents | Update.updateReadMessagesContents) => { |
|
|
|
|
const channelId = (update as Update.updateChannelReadMessagesContents).channel_id; |
|
|
|
|
const mids = (update as Update.updateReadMessagesContents).messages.map(id => this.generateMessageId(id)); |
|
|
|
|
const peerId = channelId ? -channelId : this.getMessageById(mids[0]).peerId; |
|
|
|
@ -4437,10 +4459,9 @@ export class AppMessagesManager {
@@ -4437,10 +4459,9 @@ export class AppMessagesManager {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
rootScope.broadcast('messages_media_read', {peerId, mids}); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
case 'updateChannelAvailableMessages': { |
|
|
|
|
private onUpdateChannelAvailableMessages = (update: Update.updateChannelAvailableMessages) => { |
|
|
|
|
const channelId: number = update.channel_id; |
|
|
|
|
const messages: number[] = []; |
|
|
|
|
const peerId: number = -channelId; |
|
|
|
@ -4454,17 +4475,17 @@ export class AppMessagesManager {
@@ -4454,17 +4475,17 @@ export class AppMessagesManager {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
(update as any as Update.updateDeleteChannelMessages).messages = messages; |
|
|
|
|
} |
|
|
|
|
this.onUpdateDeleteMessages(update as any as Update.updateDeleteChannelMessages); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
case 'updateDeleteMessages': |
|
|
|
|
case 'updateDeleteChannelMessages': { |
|
|
|
|
private onUpdateDeleteMessages = (update: Update.updateDeleteMessages | Update.updateDeleteChannelMessages) => { |
|
|
|
|
const channelId: number = (update as Update.updateDeleteChannelMessages).channel_id; |
|
|
|
|
//const messages = (update as any as Update.updateDeleteChannelMessages).messages;
|
|
|
|
|
const messages = (update as any as Update.updateDeleteChannelMessages).messages.map(id => this.generateMessageId(id)); |
|
|
|
|
const peerId: number = channelId ? -channelId : this.getMessageById(messages[0]).peerId; |
|
|
|
|
|
|
|
|
|
if(!peerId) { |
|
|
|
|
break; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
apiManager.clearCache('messages.getSearchCounters', (params) => { |
|
|
|
@ -4515,10 +4536,9 @@ export class AppMessagesManager {
@@ -4515,10 +4536,9 @@ export class AppMessagesManager {
|
|
|
|
|
this.reloadConversation(peerId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
case 'updateChannel': { |
|
|
|
|
private onUpdateChannel = (update: Update.updateChannel) => { |
|
|
|
|
const channelId: number = update.channel_id; |
|
|
|
|
const peerId = -channelId; |
|
|
|
|
const channel = appChatsManager.getChat(channelId); |
|
|
|
@ -4545,12 +4565,9 @@ export class AppMessagesManager {
@@ -4545,12 +4565,9 @@ export class AppMessagesManager {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
case 'updateChannelReload': { |
|
|
|
|
private onUpdateChannelReload = (update: any) => { |
|
|
|
|
// @ts-ignore
|
|
|
|
|
const channelId: number = update.channel_id; |
|
|
|
|
const peerId = -channelId; |
|
|
|
@ -4561,11 +4578,9 @@ export class AppMessagesManager {
@@ -4561,11 +4578,9 @@ export class AppMessagesManager {
|
|
|
|
|
this.reloadConversation(-channelId).then(() => { |
|
|
|
|
rootScope.broadcast('history_reload', peerId); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'updateChannelMessageViews': { |
|
|
|
|
private onUpdateChannelMessageViews = (update: Update.updateChannelMessageViews) => { |
|
|
|
|
const views = update.views; |
|
|
|
|
//const mid = update.id;
|
|
|
|
|
const mid = this.generateMessageId(update.id); |
|
|
|
@ -4574,10 +4589,9 @@ export class AppMessagesManager {
@@ -4574,10 +4589,9 @@ export class AppMessagesManager {
|
|
|
|
|
message.views = views; |
|
|
|
|
rootScope.broadcast('message_views', {mid, views}); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
case 'updateServiceNotification': { |
|
|
|
|
private onUpdateServiceNotification = (update: Update.updateServiceNotification) => { |
|
|
|
|
//this.log('updateServiceNotification', update);
|
|
|
|
|
const fromId = 777000; |
|
|
|
|
const peerId = fromId; |
|
|
|
@ -4607,17 +4621,14 @@ export class AppMessagesManager {
@@ -4607,17 +4621,14 @@ export class AppMessagesManager {
|
|
|
|
|
|
|
|
|
|
if(update.inbox_date) { |
|
|
|
|
this.pendingTopMsgs[peerId] = messageId; |
|
|
|
|
this.handleUpdate({ |
|
|
|
|
this.onUpdateNewMessage({ |
|
|
|
|
_: 'updateNewMessage', |
|
|
|
|
message |
|
|
|
|
} as any); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'updatePinnedMessages': |
|
|
|
|
case 'updatePinnedChannelMessages': { |
|
|
|
|
private onUpdatePinnedMessages = (update: Update.updatePinnedMessages | Update.updatePinnedChannelMessages) => { |
|
|
|
|
const channelId = update._ === 'updatePinnedChannelMessages' ? update.channel_id : undefined; |
|
|
|
|
const peerId = channelId ? -channelId : appPeersManager.getPeerId((update as Update.updatePinnedMessages).peer); |
|
|
|
|
|
|
|
|
@ -4670,11 +4681,9 @@ export class AppMessagesManager {
@@ -4670,11 +4681,9 @@ export class AppMessagesManager {
|
|
|
|
|
rootScope.broadcast('peer_pinned_messages', {peerId, mids: messages, pinned: werePinned}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'updateNotifySettings': { |
|
|
|
|
private onUpdateNotifySettings = (update: Update.updateNotifySettings) => { |
|
|
|
|
const {peer, notify_settings} = update; |
|
|
|
|
if(peer._ === 'notifyPeer') { |
|
|
|
|
const peerId = appPeersManager.getPeerId((peer as NotifyPeer.notifyPeer).peer); |
|
|
|
@ -4685,12 +4694,9 @@ export class AppMessagesManager {
@@ -4685,12 +4694,9 @@ export class AppMessagesManager {
|
|
|
|
|
rootScope.broadcast('dialog_notify_settings', dialog); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/////this.log('updateNotifySettings', peerId, notify_settings);
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'updateNewScheduledMessage': { |
|
|
|
|
private onUpdateNewScheduledMessage = (update: Update.updateNewScheduledMessage) => { |
|
|
|
|
const message = update.message as MyMessage; |
|
|
|
|
const peerId = this.getMessagePeer(message); |
|
|
|
|
|
|
|
|
@ -4712,11 +4718,9 @@ export class AppMessagesManager {
@@ -4712,11 +4718,9 @@ export class AppMessagesManager {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
case 'updateDeleteScheduledMessages': { |
|
|
|
|
private onUpdateDeleteScheduledMessages = (update: Update.updateDeleteScheduledMessages) => { |
|
|
|
|
const peerId = appPeersManager.getPeerId(update.peer); |
|
|
|
|
|
|
|
|
|
const storage = this.scheduledMessagesStorage[peerId]; |
|
|
|
@ -4726,11 +4730,7 @@ export class AppMessagesManager {
@@ -4726,11 +4730,7 @@ export class AppMessagesManager {
|
|
|
|
|
|
|
|
|
|
rootScope.broadcast('scheduled_delete', {peerId, mids}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
private updateMessageRepliesIfNeeded(threadMessage: MyMessage) { |
|
|
|
|
try { // * на всякий случай, скорее всего это не понадобится
|
|
|
|
|