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