2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 07:05:13 +00:00

Display channels promoted by proxy on top.

This commit is contained in:
John Preston
2018-05-11 17:03:53 +03:00
parent df9ec4b466
commit d3f85b4c4e
25 changed files with 392 additions and 387 deletions

View File

@@ -26,6 +26,10 @@ uint64 DialogPosFromDate(const QDateTime &date) {
return (uint64(date.toTime_t()) << 32) | (++DialogsPosToTopShift);
}
uint64 ProxyPromotedDialogPos() {
return 0xFFFFFFFFFFFF0001ULL;
}
uint64 PinnedDialogPos(int pinnedIndex) {
return 0xFFFFFFFF00000000ULL + pinnedIndex;
}
@@ -49,12 +53,22 @@ void Entry::cachePinnedIndex(int index) {
}
}
void Entry::cacheProxyPromoted(bool promoted) {
if (_isProxyPromoted != promoted) {
_isProxyPromoted = promoted;
updateChatListSortPosition();
updateChatListEntry();
}
}
bool Entry::needUpdateInChatList() const {
return inChatList(Dialogs::Mode::All) || shouldBeInChatList();
}
void Entry::updateChatListSortPosition() {
_sortKeyInChatList = isPinnedDialog()
_sortKeyInChatList = useProxyPromotion()
? ProxyPromotedDialogPos()
: isPinnedDialog()
? PinnedDialogPos(_pinnedIndex)
: DialogPosFromDate(adjustChatListDate());
if (needUpdateInChatList()) {