|
|
@ -109,21 +109,21 @@ export type MessagesStorage = { |
|
|
|
export type MyMessageActionType = Message.messageService['action']['_']; |
|
|
|
export type MyMessageActionType = Message.messageService['action']['_']; |
|
|
|
|
|
|
|
|
|
|
|
export class AppMessagesManager { |
|
|
|
export class AppMessagesManager { |
|
|
|
public static MESSAGE_ID_INCREMENT = 0x10000; |
|
|
|
private static MESSAGE_ID_INCREMENT = 0x10000; |
|
|
|
public static MESSAGE_ID_OFFSET = 0xFFFFFFFF; |
|
|
|
private static MESSAGE_ID_OFFSET = 0xFFFFFFFF; |
|
|
|
|
|
|
|
|
|
|
|
public messagesStorageByPeerId: {[peerId: string]: MessagesStorage} = {}; |
|
|
|
private messagesStorageByPeerId: {[peerId: string]: MessagesStorage} = {}; |
|
|
|
public groupedMessagesStorage: {[groupId: string]: MessagesStorage} = {}; // will be used for albums
|
|
|
|
public groupedMessagesStorage: {[groupId: string]: MessagesStorage} = {}; // will be used for albums
|
|
|
|
public scheduledMessagesStorage: {[peerId: string]: MessagesStorage} = {}; |
|
|
|
private scheduledMessagesStorage: {[peerId: string]: MessagesStorage} = {}; |
|
|
|
public historiesStorage: { |
|
|
|
private historiesStorage: { |
|
|
|
[peerId: string]: HistoryStorage |
|
|
|
[peerId: string]: HistoryStorage |
|
|
|
} = {}; |
|
|
|
} = {}; |
|
|
|
public threadsStorage: { |
|
|
|
private threadsStorage: { |
|
|
|
[peerId: string]: { |
|
|
|
[peerId: string]: { |
|
|
|
[threadId: string]: HistoryStorage |
|
|
|
[threadId: string]: HistoryStorage |
|
|
|
} |
|
|
|
} |
|
|
|
} = {}; |
|
|
|
} = {}; |
|
|
|
public searchesStorage: { |
|
|
|
private searchesStorage: { |
|
|
|
[peerId: string]: Partial<{ |
|
|
|
[peerId: string]: Partial<{ |
|
|
|
[inputFilter in MyInputMessagesFilter]: { |
|
|
|
[inputFilter in MyInputMessagesFilter]: { |
|
|
|
count?: number, |
|
|
|
count?: number, |
|
|
@ -134,11 +134,11 @@ export class AppMessagesManager { |
|
|
|
public pinnedMessages: {[peerId: string]: PinnedStorage} = {}; |
|
|
|
public pinnedMessages: {[peerId: string]: PinnedStorage} = {}; |
|
|
|
|
|
|
|
|
|
|
|
public threadsServiceMessagesIdsStorage: {[peerId_threadId: string]: number} = {}; |
|
|
|
public threadsServiceMessagesIdsStorage: {[peerId_threadId: string]: number} = {}; |
|
|
|
public threadsToReplies: { |
|
|
|
private threadsToReplies: { |
|
|
|
[peerId_threadId: string]: string; |
|
|
|
[peerId_threadId: string]: string; |
|
|
|
} = {}; |
|
|
|
} = {}; |
|
|
|
|
|
|
|
|
|
|
|
public pendingByRandomId: { |
|
|
|
private pendingByRandomId: { |
|
|
|
[randomId: string]: { |
|
|
|
[randomId: string]: { |
|
|
|
peerId: number, |
|
|
|
peerId: number, |
|
|
|
tempId: number, |
|
|
|
tempId: number, |
|
|
@ -146,12 +146,11 @@ export class AppMessagesManager { |
|
|
|
storage: MessagesStorage |
|
|
|
storage: MessagesStorage |
|
|
|
} |
|
|
|
} |
|
|
|
} = {}; |
|
|
|
} = {}; |
|
|
|
public pendingByMessageId: {[mid: string]: string} = {}; |
|
|
|
private pendingByMessageId: {[mid: string]: string} = {}; |
|
|
|
public pendingAfterMsgs: any = {}; |
|
|
|
private pendingAfterMsgs: any = {}; |
|
|
|
public pendingTopMsgs: {[peerId: string]: number} = {}; |
|
|
|
public pendingTopMsgs: {[peerId: string]: number} = {}; |
|
|
|
public sendFilePromise: CancellablePromise<void> = Promise.resolve(); |
|
|
|
private tempNum = 0; |
|
|
|
public tempNum = 0; |
|
|
|
private tempFinalizeCallbacks: { |
|
|
|
public tempFinalizeCallbacks: { |
|
|
|
|
|
|
|
[tempId: string]: { |
|
|
|
[tempId: string]: { |
|
|
|
[callbackName: string]: Partial<{ |
|
|
|
[callbackName: string]: Partial<{ |
|
|
|
deferred: CancellablePromise<void>, |
|
|
|
deferred: CancellablePromise<void>, |
|
|
@ -160,20 +159,20 @@ export class AppMessagesManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} = {}; |
|
|
|
} = {}; |
|
|
|
|
|
|
|
|
|
|
|
public sendSmthLazyLoadQueue = new LazyLoadQueueBase(1); |
|
|
|
private sendSmthLazyLoadQueue = new LazyLoadQueueBase(1); |
|
|
|
|
|
|
|
|
|
|
|
public needSingleMessages: {[peerId: string]: number[]} = {}; |
|
|
|
private needSingleMessages: {[peerId: string]: number[]} = {}; |
|
|
|
private fetchSingleMessagesPromise: Promise<void> = null; |
|
|
|
private fetchSingleMessagesPromise: Promise<void> = null; |
|
|
|
|
|
|
|
|
|
|
|
public maxSeenId = 0; |
|
|
|
private maxSeenId = 0; |
|
|
|
|
|
|
|
|
|
|
|
public migratedFromTo: {[peerId: number]: number} = {}; |
|
|
|
public migratedFromTo: {[peerId: number]: number} = {}; |
|
|
|
public migratedToFrom: {[peerId: number]: number} = {}; |
|
|
|
public migratedToFrom: {[peerId: number]: number} = {}; |
|
|
|
|
|
|
|
|
|
|
|
public newMessagesHandleTimeout = 0; |
|
|
|
private newMessagesHandleTimeout = 0; |
|
|
|
public newMessagesToHandle: {[peerId: string]: Set<number>} = {}; |
|
|
|
private newMessagesToHandle: {[peerId: string]: Set<number>} = {}; |
|
|
|
public newDialogsHandlePromise: Promise<any>; |
|
|
|
private newDialogsHandlePromise: Promise<any>; |
|
|
|
public newDialogsToHandle: {[peerId: string]: Dialog} = {}; |
|
|
|
private newDialogsToHandle: {[peerId: string]: Dialog} = {}; |
|
|
|
public newUpdatesAfterReloadToHandle: {[peerId: string]: Set<Update>} = {}; |
|
|
|
public newUpdatesAfterReloadToHandle: {[peerId: string]: Set<Update>} = {}; |
|
|
|
|
|
|
|
|
|
|
|
private notificationsHandlePromise = 0; |
|
|
|
private notificationsHandlePromise = 0; |
|
|
@ -4371,7 +4370,8 @@ export class AppMessagesManager { |
|
|
|
const photo = appPhotosManager.getPhoto('' + tempId); |
|
|
|
const photo = appPhotosManager.getPhoto('' + tempId); |
|
|
|
if(/* photo._ !== 'photoEmpty' */photo) { |
|
|
|
if(/* photo._ !== 'photoEmpty' */photo) { |
|
|
|
const newPhoto = message.media.photo as MyPhoto; |
|
|
|
const newPhoto = message.media.photo as MyPhoto; |
|
|
|
const cacheContext = appDownloadManager.getCacheContext(newPhoto); |
|
|
|
const newPhotoSize = newPhoto.sizes[newPhoto.sizes.length - 1]; |
|
|
|
|
|
|
|
const cacheContext = appDownloadManager.getCacheContext(newPhoto, newPhotoSize.type); |
|
|
|
const oldCacheContext = appDownloadManager.getCacheContext(photo, 'full'); |
|
|
|
const oldCacheContext = appDownloadManager.getCacheContext(photo, 'full'); |
|
|
|
Object.assign(cacheContext, oldCacheContext); |
|
|
|
Object.assign(cacheContext, oldCacheContext); |
|
|
|
|
|
|
|
|
|
|
|