|
|
@ -1,3 +1,4 @@ |
|
|
|
|
|
|
|
import { ResolutionUnitSpecifier } from "fast-png"; |
|
|
|
import AvatarElement from "../../components/avatar"; |
|
|
|
import AvatarElement from "../../components/avatar"; |
|
|
|
import DialogsContextMenu from "../../components/dialogsContextMenu"; |
|
|
|
import DialogsContextMenu from "../../components/dialogsContextMenu"; |
|
|
|
import { horizontalMenu } from "../../components/horizontalMenu"; |
|
|
|
import { horizontalMenu } from "../../components/horizontalMenu"; |
|
|
@ -336,11 +337,14 @@ export class AppDialogsManager { |
|
|
|
this.addFilter(filters[filterID]); |
|
|
|
this.addFilter(filters[filterID]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return this.loadDialogs(this.filterID); |
|
|
|
return this.loadDialogs(); |
|
|
|
}).then(result => { |
|
|
|
}).then(result => { |
|
|
|
//this.setPinnedDelimiter();
|
|
|
|
//this.setPinnedDelimiter();
|
|
|
|
//appSidebarLeft.onChatsScroll();
|
|
|
|
//appSidebarLeft.onChatsScroll();
|
|
|
|
this.loadDialogs(1); |
|
|
|
//this.loadDialogs(1);
|
|
|
|
|
|
|
|
appMessagesManager.getConversationsAll('', 1).then(() => { |
|
|
|
|
|
|
|
this.accumulateArchivedUnread(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -363,8 +367,9 @@ export class AppDialogsManager { |
|
|
|
this.doms = {}; |
|
|
|
this.doms = {}; |
|
|
|
this.loadedAll = false; |
|
|
|
this.loadedAll = false; |
|
|
|
this.lastActiveListElement = null; |
|
|
|
this.lastActiveListElement = null; |
|
|
|
|
|
|
|
this.loadDialogsPromise = undefined; |
|
|
|
this.chatList = this.chatLists[this.filterID]; |
|
|
|
this.chatList = this.chatLists[this.filterID]; |
|
|
|
this.loadDialogs(this.filterID); |
|
|
|
this.loadDialogs(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
public setFilterUnreadCount(filterID: number, folder?: Dialog[]) { |
|
|
|
public setFilterUnreadCount(filterID: number, folder?: Dialog[]) { |
|
|
@ -460,7 +465,7 @@ export class AppDialogsManager { |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async loadDialogs(folderID: number) { |
|
|
|
public async loadDialogs() { |
|
|
|
if(testScroll) { |
|
|
|
if(testScroll) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -474,7 +479,9 @@ export class AppDialogsManager { |
|
|
|
|
|
|
|
|
|
|
|
//return;
|
|
|
|
//return;
|
|
|
|
|
|
|
|
|
|
|
|
const storage = appMessagesManager.dialogsStorage.getFolder(folderID); |
|
|
|
const filterID = this.filterID; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const storage = appMessagesManager.dialogsStorage.getFolder(filterID); |
|
|
|
let offsetIndex = 0; |
|
|
|
let offsetIndex = 0; |
|
|
|
|
|
|
|
|
|
|
|
for(let i = storage.length - 1; i >= 0; --i) { |
|
|
|
for(let i = storage.length - 1; i >= 0; --i) { |
|
|
@ -492,17 +499,21 @@ export class AppDialogsManager { |
|
|
|
const loadCount = 50/*this.chatsLoadCount */; |
|
|
|
const loadCount = 50/*this.chatsLoadCount */; |
|
|
|
|
|
|
|
|
|
|
|
const getConversationPromise = (this.filterID > 1 ? appUsersManager.getContacts() as Promise<any> : Promise.resolve()).then(() => { |
|
|
|
const getConversationPromise = (this.filterID > 1 ? appUsersManager.getContacts() as Promise<any> : Promise.resolve()).then(() => { |
|
|
|
return appMessagesManager.getConversations('', offsetIndex, loadCount, folderID); |
|
|
|
return appMessagesManager.getConversations('', offsetIndex, loadCount, filterID); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.loadDialogsPromise = getConversationPromise; |
|
|
|
this.loadDialogsPromise = getConversationPromise; |
|
|
|
|
|
|
|
|
|
|
|
const result = await getConversationPromise; |
|
|
|
const result = await getConversationPromise; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.filterID != filterID) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//console.timeEnd('getDialogs time');
|
|
|
|
//console.timeEnd('getDialogs time');
|
|
|
|
|
|
|
|
|
|
|
|
if(result && result.dialogs && result.dialogs.length) { |
|
|
|
if(result && result.dialogs && result.dialogs.length) { |
|
|
|
result.dialogs.forEach((dialog: any) => { |
|
|
|
result.dialogs.forEach((dialog) => { |
|
|
|
this.addDialog(dialog); |
|
|
|
this.addDialog(dialog); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -524,7 +535,7 @@ export class AppDialogsManager { |
|
|
|
onChatsScroll = () => { |
|
|
|
onChatsScroll = () => { |
|
|
|
if(this.loadedAll || this.loadDialogsPromise) return; |
|
|
|
if(this.loadedAll || this.loadDialogsPromise) return; |
|
|
|
this.log('onChatsScroll'); |
|
|
|
this.log('onChatsScroll'); |
|
|
|
this.loadDialogs(this.filterID); |
|
|
|
this.loadDialogs(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public setListClickListener(list: HTMLUListElement, onFound?: () => void, withContext = false) { |
|
|
|
public setListClickListener(list: HTMLUListElement, onFound?: () => void, withContext = false) { |
|
|
|