mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-25 15:03:03 +02:00
Fix glitching userpics in monoforum.
This commit is contained in:
parent
7dadaa1b28
commit
ee3d70f879
1 changed files with 13 additions and 1 deletions
|
@ -283,6 +283,12 @@ void SubsectionTabs::setupSlider(
|
|||
}
|
||||
}, scroll->lifetime());
|
||||
|
||||
using ImagePointer = std::shared_ptr<Ui::DynamicImage>;
|
||||
struct Cache {
|
||||
base::flat_map<not_null<PeerData*>, ImagePointer> userpics;
|
||||
};
|
||||
const auto cache = std::make_shared<Cache>();
|
||||
|
||||
_refreshed.events_starting_with_copy(
|
||||
rpl::empty
|
||||
) | rpl::start_with_next([=] {
|
||||
|
@ -291,6 +297,7 @@ void SubsectionTabs::setupSlider(
|
|||
return _controller->isGifPausedAtLeastFor(
|
||||
Window::GifPauseReason::Any);
|
||||
};
|
||||
auto updated = Cache();
|
||||
auto sections = std::vector<Ui::SubsectionTab>();
|
||||
auto activeIndex = -1;
|
||||
for (const auto &item : _slice) {
|
||||
|
@ -337,9 +344,13 @@ void SubsectionTabs::setupSlider(
|
|||
} else if (const auto sublist = item.thread->asSublist()) {
|
||||
const auto peer = sublist->sublistPeer();
|
||||
if (vertical) {
|
||||
auto was = cache->userpics[peer];
|
||||
auto userpic = updated.userpics[peer] = was
|
||||
? was
|
||||
: Ui::MakeUserpicThumbnail(peer);
|
||||
sections.push_back({
|
||||
.text = peer->shortName(),
|
||||
.userpic = Ui::MakeUserpicThumbnail(peer),
|
||||
.userpic = std::move(userpic),
|
||||
});
|
||||
} else {
|
||||
sections.push_back({
|
||||
|
@ -359,6 +370,7 @@ void SubsectionTabs::setupSlider(
|
|||
auto §ion = sections.back();
|
||||
section.badges = item.badges;
|
||||
}
|
||||
*cache = std::move(updated);
|
||||
|
||||
auto scrollSavingThread = (Data::Thread*)nullptr;
|
||||
auto scrollSavingShift = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue