mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Optimized height refresh of chats list for chat filters with rules.
This commit is contained in:
parent
889fcb3939
commit
e314c68a56
2 changed files with 23 additions and 0 deletions
|
@ -2260,6 +2260,27 @@ void InnerWidget::handleChatListEntryRefreshes() {
|
||||||
std::abs(from - to) + event.moved.height);
|
std::abs(from - to) + event.moved.height);
|
||||||
}
|
}
|
||||||
}, lifetime());
|
}, 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) {
|
void InnerWidget::repaintCollapsedFolderRow(not_null<Data::Folder*> folder) {
|
||||||
|
|
|
@ -557,6 +557,8 @@ private:
|
||||||
base::flat_map<FilterId, int> _chatsFilterScrollStates;
|
base::flat_map<FilterId, int> _chatsFilterScrollStates;
|
||||||
|
|
||||||
std::unordered_map<FilterId, QImage> _chatsFilterTags;
|
std::unordered_map<FilterId, QImage> _chatsFilterTags;
|
||||||
|
bool _waitingAllChatListEntryRefreshesForTags = false;
|
||||||
|
|
||||||
Fn<void()> _loadMoreCallback;
|
Fn<void()> _loadMoreCallback;
|
||||||
Fn<void()> _loadMoreFilteredCallback;
|
Fn<void()> _loadMoreFilteredCallback;
|
||||||
rpl::event_stream<> _listBottomReached;
|
rpl::event_stream<> _listBottomReached;
|
||||||
|
|
Loading…
Add table
Reference in a new issue