Improved display of cached message preview in profile sections.

This commit is contained in:
23rd 2024-06-04 18:04:06 +03:00 committed by John Preston
parent 749b2e0e95
commit 9e3e7265d2
1 changed files with 5 additions and 5 deletions

View File

@ -1364,7 +1364,11 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupPersonalChannel(
auto &lifetime = preview->lifetime(); auto &lifetime = preview->lifetime();
using namespace Dialogs::Ui; using namespace Dialogs::Ui;
const auto previewView = lifetime.make_state<MessageView>(); const auto previewView = lifetime.make_state<MessageView>();
const auto previewUpdate = [=] { preview->update(); };
preview->resize(0, st::infoLabeled.style.font->height); preview->resize(0, st::infoLabeled.style.font->height);
if (!previewView->dependsOn(item)) {
previewView->prepare(item, nullptr, previewUpdate, {});
}
preview->paintRequest( preview->paintRequest(
) | rpl::start_with_next([=, fullId = item->fullId()]( ) | rpl::start_with_next([=, fullId = item->fullId()](
const QRect &rect) { const QRect &rect) {
@ -1393,11 +1397,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupPersonalChannel(
preview->rect(), preview->rect(),
tr::lng_contacts_loading(tr::now), tr::lng_contacts_loading(tr::now),
style::al_left); style::al_left);
previewView->prepare( previewView->prepare(item, nullptr, previewUpdate, {});
item,
nullptr,
[=] { preview->update(); },
{});
preview->update(); preview->update();
} }
}, preview->lifetime()); }, preview->lifetime());