Revert "Fixed blinking of message preview from user's personal channel."

This reverts commit 75e454f3fd.
This commit is contained in:
John Preston 2025-03-20 17:26:44 +04:00
parent c924fcb91f
commit c30a5782df
3 changed files with 8 additions and 20 deletions

View file

@ -150,8 +150,7 @@ void MessageView::prepare(
not_null<const HistoryItem*> item, not_null<const HistoryItem*> item,
Data::Forum *forum, Data::Forum *forum,
Fn<void()> customEmojiRepaint, Fn<void()> customEmojiRepaint,
ToPreviewOptions options, ToPreviewOptions options) {
Fn<void()> customLoadingFinishCallback) {
if (!forum) { if (!forum) {
_topics = nullptr; _topics = nullptr;
} else if (!_topics || _topics->forum() != forum) { } else if (!_topics || _topics->forum() != forum) {
@ -213,11 +212,9 @@ void MessageView::prepare(
if (!_loadingContext) { if (!_loadingContext) {
_loadingContext = std::make_unique<LoadingContext>(); _loadingContext = std::make_unique<LoadingContext>();
item->history()->session().downloaderTaskFinished( item->history()->session().downloaderTaskFinished(
) | rpl::start_with_next( ) | rpl::start_with_next([=] {
customLoadingFinishCallback _textCachedFor = nullptr;
? customLoadingFinishCallback }, _loadingContext->lifetime);
: Fn<void()>([=] { _textCachedFor = nullptr; }),
_loadingContext->lifetime);
} }
_loadingContext->context = std::move(preview.loadingContext); _loadingContext->context = std::move(preview.loadingContext);
} else { } else {

View file

@ -61,8 +61,7 @@ public:
not_null<const HistoryItem*> item, not_null<const HistoryItem*> item,
Data::Forum *forum, Data::Forum *forum,
Fn<void()> customEmojiRepaint, Fn<void()> customEmojiRepaint,
ToPreviewOptions options, ToPreviewOptions options);
Fn<void()> customLoadingFinishCallback = nullptr);
void paint( void paint(
Painter &p, Painter &p,

View file

@ -1698,18 +1698,10 @@ 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);
const auto prepare = [previewView, preview](
not_null<HistoryItem*> item) {
previewView->prepare(
item,
nullptr,
[=] { preview->update(); },
{},
[]{});
};
if (!previewView->dependsOn(item)) { if (!previewView->dependsOn(item)) {
prepare(item); previewView->prepare(item, nullptr, previewUpdate, {});
} }
preview->paintRequest( preview->paintRequest(
) | rpl::start_with_next([=, fullId = item->fullId()]( ) | rpl::start_with_next([=, fullId = item->fullId()](
@ -1739,7 +1731,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);
prepare(item); previewView->prepare(item, nullptr, previewUpdate, {});
preview->update(); preview->update();
} }
}, preview->lifetime()); }, preview->lifetime());