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

View file

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

View file

@ -1698,18 +1698,10 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupPersonalChannel(
auto &lifetime = preview->lifetime();
using namespace Dialogs::Ui;
const auto previewView = lifetime.make_state<MessageView>();
const auto previewUpdate = [=] { preview->update(); };
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)) {
prepare(item);
previewView->prepare(item, nullptr, previewUpdate, {});
}
preview->paintRequest(
) | rpl::start_with_next([=, fullId = item->fullId()](
@ -1739,7 +1731,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupPersonalChannel(
preview->rect(),
tr::lng_contacts_loading(tr::now),
style::al_left);
prepare(item);
previewView->prepare(item, nullptr, previewUpdate, {});
preview->update();
}
}, preview->lifetime());