mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Optimized height refresh of chats list for chat filters with rules.
This commit is contained in:
@@ -2260,6 +2260,27 @@ void InnerWidget::handleChatListEntryRefreshes() {
|
||||
std::abs(from - to) + event.moved.height);
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
session().data().chatListEntryRefreshes(
|
||||
) | rpl::filter([=](const Event &event) {
|
||||
if (_waitingAllChatListEntryRefreshesForTags) {
|
||||
return false;
|
||||
}
|
||||
if (event.existenceChanged) {
|
||||
if (event.key.entry()->inChatList(_filterId)) {
|
||||
_waitingAllChatListEntryRefreshesForTags = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}) | rpl::start_with_next([=](const Event &event) {
|
||||
Ui::PostponeCall(crl::guard(this, [=] {
|
||||
_waitingAllChatListEntryRefreshesForTags = false;
|
||||
if (_shownList->updateHeights(_narrowRatio)) {
|
||||
refresh();
|
||||
}
|
||||
}));
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void InnerWidget::repaintCollapsedFolderRow(not_null<Data::Folder*> folder) {
|
||||
|
||||
@@ -557,6 +557,8 @@ private:
|
||||
base::flat_map<FilterId, int> _chatsFilterScrollStates;
|
||||
|
||||
std::unordered_map<FilterId, QImage> _chatsFilterTags;
|
||||
bool _waitingAllChatListEntryRefreshesForTags = false;
|
||||
|
||||
Fn<void()> _loadMoreCallback;
|
||||
Fn<void()> _loadMoreFilteredCallback;
|
||||
rpl::event_stream<> _listBottomReached;
|
||||
|
||||
Reference in New Issue
Block a user