mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 05:07:10 +02:00
Fixed blinking of message preview from user's personal channel.
This commit is contained in:
parent
97afb4e01a
commit
75e454f3fd
3 changed files with 20 additions and 8 deletions
|
@ -150,7 +150,8 @@ void MessageView::prepare(
|
|||
not_null<const HistoryItem*> item,
|
||||
Data::Forum *forum,
|
||||
Fn<void()> customEmojiRepaint,
|
||||
ToPreviewOptions options) {
|
||||
ToPreviewOptions options,
|
||||
Fn<void()> customLoadingFinishCallback) {
|
||||
if (!forum) {
|
||||
_topics = nullptr;
|
||||
} else if (!_topics || _topics->forum() != forum) {
|
||||
|
@ -212,9 +213,11 @@ void MessageView::prepare(
|
|||
if (!_loadingContext) {
|
||||
_loadingContext = std::make_unique<LoadingContext>();
|
||||
item->history()->session().downloaderTaskFinished(
|
||||
) | rpl::start_with_next([=] {
|
||||
_textCachedFor = nullptr;
|
||||
}, _loadingContext->lifetime);
|
||||
) | rpl::start_with_next(
|
||||
customLoadingFinishCallback
|
||||
? customLoadingFinishCallback
|
||||
: Fn<void()>([=] { _textCachedFor = nullptr; }),
|
||||
_loadingContext->lifetime);
|
||||
}
|
||||
_loadingContext->context = std::move(preview.loadingContext);
|
||||
} else {
|
||||
|
|
|
@ -61,7 +61,8 @@ public:
|
|||
not_null<const HistoryItem*> item,
|
||||
Data::Forum *forum,
|
||||
Fn<void()> customEmojiRepaint,
|
||||
ToPreviewOptions options);
|
||||
ToPreviewOptions options,
|
||||
Fn<void()> customLoadingFinishCallback = nullptr);
|
||||
|
||||
void paint(
|
||||
Painter &p,
|
||||
|
|
|
@ -1657,10 +1657,18 @@ 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)) {
|
||||
previewView->prepare(item, nullptr, previewUpdate, {});
|
||||
prepare(item);
|
||||
}
|
||||
preview->paintRequest(
|
||||
) | rpl::start_with_next([=, fullId = item->fullId()](
|
||||
|
@ -1690,7 +1698,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupPersonalChannel(
|
|||
preview->rect(),
|
||||
tr::lng_contacts_loading(tr::now),
|
||||
style::al_left);
|
||||
previewView->prepare(item, nullptr, previewUpdate, {});
|
||||
prepare(item);
|
||||
preview->update();
|
||||
}
|
||||
}, preview->lifetime());
|
||||
|
|
Loading…
Add table
Reference in a new issue