2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Use a single Ui::UnreadStoryOutlineGradient.

This commit is contained in:
John Preston
2023-07-17 20:47:44 +04:00
parent 04f1a7be02
commit 734c5c6740
7 changed files with 53 additions and 32 deletions

View File

@@ -531,11 +531,37 @@ void Stories::loadMore(StorySourcesList list) {
}
}, [](const MTPDstories_allStoriesNotModified &) {
});
preloadListsMore();
}).fail([=] {
_loadMoreRequestId[index] = 0;
}).send();
}
void Stories::preloadListsMore() {
if (_loadMoreRequestId[static_cast<int>(StorySourcesList::NotHidden)]
|| _loadMoreRequestId[static_cast<int>(StorySourcesList::Hidden)]) {
return;
}
const auto loading = [&](StorySourcesList list) {
return _loadMoreRequestId[static_cast<int>(list)] != 0;
};
const auto countLoaded = [&](StorySourcesList list) {
const auto index = static_cast<int>(list);
return _sourcesLoaded[index] || !_sourcesStates[index].isEmpty();
};
if (loading(StorySourcesList::NotHidden)
|| loading(StorySourcesList::Hidden)) {
return;
} else if (!countLoaded(StorySourcesList::NotHidden)) {
loadMore(StorySourcesList::NotHidden);
} else if (!countLoaded(StorySourcesList::Hidden)) {
loadMore(StorySourcesList::Hidden);
} else if (!archiveCountKnown()) {
archiveLoadMore();
}
}
void Stories::sendResolveRequests() {
if (!_resolveSent.empty()) {
return;