[temp] updates.differenceTooLong
This commit is contained in:
parent
d4c2f8bbb4
commit
cf9244d38f
@ -160,8 +160,8 @@ export default class ConnectionStatusComponent {
|
||||
clearInterval(interval);
|
||||
}
|
||||
};
|
||||
setTime();
|
||||
const interval = setInterval(setTime, 1e3);
|
||||
setTime();
|
||||
|
||||
const a = this.getA('ConnectionStatus.Reconnect', () => apiManager.forceReconnectTimeout());
|
||||
this.setStatusText('ConnectionStatus.ReconnectIn', [timerSpan, a]);
|
||||
|
@ -247,7 +247,7 @@ export class ApiUpdatesManager {
|
||||
|
||||
const promise = apiManager.invokeApi('updates.getDifference', {
|
||||
pts: updatesState.pts,
|
||||
// pts_total_limit: 1200,
|
||||
pts_total_limit: first && false ? 1200 : undefined,
|
||||
date: updatesState.date,
|
||||
qts: -1
|
||||
}, {
|
||||
|
@ -325,10 +325,11 @@ export class AppDialogsManager {
|
||||
}
|
||||
});
|
||||
|
||||
/* rootScope.addEventListener('state_cleared', () => {
|
||||
rootScope.addEventListener('state_cleared', () => {
|
||||
appUsersManager.clear();
|
||||
appChatsManager.clear();
|
||||
}); */
|
||||
appMessagesManager.clear();
|
||||
});
|
||||
|
||||
const foldersScrollable = new ScrollableX(this.folders.menuScrollContainer);
|
||||
bottomPart.prepend(this.folders.menuScrollContainer);
|
||||
|
@ -114,17 +114,17 @@ export class AppMessagesManager {
|
||||
private static MESSAGE_ID_INCREMENT = 0x10000;
|
||||
private static MESSAGE_ID_OFFSET = 0xFFFFFFFF;
|
||||
|
||||
private messagesStorageByPeerId: {[peerId: string]: MessagesStorage} = {};
|
||||
public groupedMessagesStorage: {[groupId: string]: MessagesStorage} = {}; // will be used for albums
|
||||
private scheduledMessagesStorage: {[peerId: string]: MessagesStorage} = {};
|
||||
private messagesStorageByPeerId: {[peerId: string]: MessagesStorage};
|
||||
public groupedMessagesStorage: {[groupId: string]: MessagesStorage}; // will be used for albums
|
||||
private scheduledMessagesStorage: {[peerId: string]: MessagesStorage};
|
||||
private historiesStorage: {
|
||||
[peerId: string]: HistoryStorage
|
||||
} = {};
|
||||
};
|
||||
private threadsStorage: {
|
||||
[peerId: string]: {
|
||||
[threadId: string]: HistoryStorage
|
||||
}
|
||||
} = {};
|
||||
};
|
||||
private searchesStorage: {
|
||||
[peerId: string]: Partial<{
|
||||
[inputFilter in MyInputMessagesFilter]: {
|
||||
@ -132,13 +132,13 @@ export class AppMessagesManager {
|
||||
history: number[]
|
||||
}
|
||||
}>
|
||||
} = {};
|
||||
public pinnedMessages: {[peerId: string]: PinnedStorage} = {};
|
||||
};
|
||||
public pinnedMessages: {[peerId: string]: PinnedStorage};
|
||||
|
||||
public threadsServiceMessagesIdsStorage: {[peerId_threadId: string]: number} = {};
|
||||
public threadsServiceMessagesIdsStorage: {[peerId_threadId: string]: number};
|
||||
private threadsToReplies: {
|
||||
[peerId_threadId: string]: string;
|
||||
} = {};
|
||||
};
|
||||
|
||||
private pendingByRandomId: {
|
||||
[randomId: string]: {
|
||||
@ -197,6 +197,8 @@ export class AppMessagesManager {
|
||||
private typings: {[peerId: string]: {type: SendMessageAction['_'], timeout?: number}} = {};
|
||||
|
||||
constructor() {
|
||||
this.clear();
|
||||
|
||||
rootScope.addMultipleEventsListeners({
|
||||
updateMessageID: this.onUpdateMessageId,
|
||||
|
||||
@ -307,6 +309,21 @@ export class AppMessagesManager {
|
||||
});
|
||||
}
|
||||
|
||||
public clear() {
|
||||
this.messagesStorageByPeerId = {};
|
||||
this.groupedMessagesStorage = {};
|
||||
this.scheduledMessagesStorage = {};
|
||||
this.historiesStorage = {};
|
||||
this.threadsStorage = {};
|
||||
this.searchesStorage = {};
|
||||
this.pinnedMessages = {};
|
||||
this.threadsServiceMessagesIdsStorage = {};
|
||||
this.threadsToReplies = {};
|
||||
|
||||
this.dialogsStorage && this.dialogsStorage.clear();
|
||||
this.filtersStorage && this.filtersStorage.clear();
|
||||
}
|
||||
|
||||
public construct() {
|
||||
this.filtersStorage = new FiltersStorage(this, appPeersManager, appUsersManager, appNotificationsManager, appStateManager, apiUpdatesManager, /* apiManager, */ rootScope);
|
||||
this.dialogsStorage = new DialogsStorage(this, appChatsManager, appPeersManager, appUsersManager, appDraftsManager, appNotificationsManager, appStateManager, apiUpdatesManager, serverTimeManager);
|
||||
|
@ -30,26 +30,21 @@ import { SliceEnd } from "../../helpers/slicedArray";
|
||||
export default class DialogsStorage {
|
||||
private storage: AppStateManager['storages']['dialogs'];
|
||||
|
||||
private dialogs: {[peerId: string]: Dialog} = {};
|
||||
public byFolders: {[folderId: number]: Dialog[]} = {};
|
||||
private dialogs: {[peerId: string]: Dialog};
|
||||
public byFolders: {[folderId: number]: Dialog[]};
|
||||
|
||||
private allDialogsLoaded: {[folder_id: number]: boolean};
|
||||
private dialogsOffsetDate: {[folder_id: number]: number};
|
||||
private pinnedOrders: {[folder_id: number]: number[]};
|
||||
private dialogsNum: number;
|
||||
|
||||
private dialogsIndex = new SearchIndex<number>();
|
||||
private dialogsIndex: SearchIndex<number>;
|
||||
|
||||
private cachedResults: {
|
||||
query: string,
|
||||
count: number,
|
||||
dialogs: Dialog[],
|
||||
folderId: number
|
||||
} = {
|
||||
query: '',
|
||||
count: 0,
|
||||
dialogs: [],
|
||||
folderId: 0
|
||||
};
|
||||
|
||||
constructor(private appMessagesManager: AppMessagesManager,
|
||||
@ -62,10 +57,9 @@ export default class DialogsStorage {
|
||||
private apiUpdatesManager: ApiUpdatesManager,
|
||||
private serverTimeManager: ServerTimeManager
|
||||
) {
|
||||
this.clear();
|
||||
this.storage = this.appStateManager.storages.dialogs;
|
||||
|
||||
this.reset();
|
||||
|
||||
rootScope.addEventListener('language_change', (e) => {
|
||||
const peerId = appUsersManager.getSelf().id;
|
||||
const dialog = this.getDialogOnly(peerId);
|
||||
@ -123,7 +117,9 @@ export default class DialogsStorage {
|
||||
this.appStateManager.pushToState('allDialogsLoaded', this.allDialogsLoaded);
|
||||
}
|
||||
|
||||
public reset() {
|
||||
public clear() {
|
||||
this.dialogs = {};
|
||||
this.byFolders = {};
|
||||
this.allDialogsLoaded = {};
|
||||
this.dialogsOffsetDate = {};
|
||||
this.pinnedOrders = {
|
||||
@ -131,6 +127,13 @@ export default class DialogsStorage {
|
||||
1: []
|
||||
};
|
||||
this.dialogsNum = 0;
|
||||
this.dialogsIndex = new SearchIndex<number>();
|
||||
this.cachedResults = {
|
||||
query: '',
|
||||
count: 0,
|
||||
dialogs: [],
|
||||
folderId: 0
|
||||
};
|
||||
}
|
||||
|
||||
public resetPinnedOrder(folderId: number) {
|
||||
|
@ -29,8 +29,8 @@ export type MyDialogFilter = Modify<DialogFilter, {
|
||||
const START_ORDER_INDEX = 1;
|
||||
|
||||
export default class FiltersStorage {
|
||||
public filters: {[filterId: string]: MyDialogFilter} = {};
|
||||
private orderIndex = START_ORDER_INDEX;
|
||||
public filters: {[filterId: string]: MyDialogFilter};
|
||||
private orderIndex: number;
|
||||
|
||||
constructor(private appMessagesManager: AppMessagesManager,
|
||||
private appPeersManager: AppPeersManager,
|
||||
@ -40,6 +40,7 @@ export default class FiltersStorage {
|
||||
private apiUpdatesManager: ApiUpdatesManager,
|
||||
/* private apiManager: ApiManagerProxy, */
|
||||
private rootScope: typeof _rootScope) {
|
||||
this.clear();
|
||||
|
||||
this.appStateManager.getState().then((state) => {
|
||||
this.filters = state.filters;
|
||||
@ -76,6 +77,11 @@ export default class FiltersStorage {
|
||||
});
|
||||
}
|
||||
|
||||
public clear() {
|
||||
this.filters = {};
|
||||
this.orderIndex = START_ORDER_INDEX;
|
||||
}
|
||||
|
||||
private onUpdateDialogFilter = (update: Update.updateDialogFilter) => {
|
||||
if(update.filter) {
|
||||
this.saveDialogFilter(update.filter as any);
|
||||
|
Loading…
x
Reference in New Issue
Block a user