From b6ade7ce19c20a88881a452495d47b97bd1738c4 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 30 Dec 2022 14:27:00 +0400 Subject: [PATCH] Fix spoiler / custom emoji in pinned bar unpause. --- Telegram/SourceFiles/history/history_widget.cpp | 2 +- .../history/view/history_view_replies_section.cpp | 4 ++-- Telegram/SourceFiles/ui/chat/pinned_bar.cpp | 13 ++++++++++++- Telegram/SourceFiles/ui/chat/pinned_bar.h | 5 ++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index d59109d47..174975de6 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -6224,7 +6224,7 @@ void HistoryWidget::checkPinnedBarState() { _pinnedBar = std::make_unique(this, [=] { return controller()->isGifPausedAtLeastFor( Window::GifPauseReason::Any); - }); + }, controller()->gifPauseLevelChanged()); auto pinnedRefreshed = Info::Profile::SharedMediaCountValue( _peer, MsgId(0), // topicRootId diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index 77508f538..b78d045af 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -442,7 +442,7 @@ void RepliesWidget::setupRootView() { _rootView = std::make_unique(this, [=] { return controller()->isGifPausedAtLeastFor( Window::GifPauseReason::Any); - }); + }, controller()->gifPauseLevelChanged()); _rootView->setContent(rpl::combine( RootViewContent( _history, @@ -1592,7 +1592,7 @@ void RepliesWidget::checkPinnedBarState() { _pinnedBar = std::make_unique(this, [=] { return controller()->isGifPausedAtLeastFor( Window::GifPauseReason::Any); - }); + }, controller()->gifPauseLevelChanged()); auto pinnedRefreshed = Info::Profile::SharedMediaCountValue( _history->peer, _rootId, diff --git a/Telegram/SourceFiles/ui/chat/pinned_bar.cpp b/Telegram/SourceFiles/ui/chat/pinned_bar.cpp index 2e2a0f598..ebb832a86 100644 --- a/Telegram/SourceFiles/ui/chat/pinned_bar.cpp +++ b/Telegram/SourceFiles/ui/chat/pinned_bar.cpp @@ -18,7 +18,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Ui { -PinnedBar::PinnedBar(not_null parent, Fn customEmojiPaused) +PinnedBar::PinnedBar( + not_null parent, + Fn customEmojiPaused, + rpl::producer<> customEmojiPausedChanges) : _wrap(parent, object_ptr(parent)) , _shadow(std::make_unique(_wrap.parentWidget())) , _customEmojiPaused(std::move(customEmojiPaused)) { @@ -30,6 +33,14 @@ PinnedBar::PinnedBar(not_null parent, Fn customEmojiPaused) QPainter(_wrap.entity()).fillRect(clip, st::historyPinnedBg); }, lifetime()); _wrap.setAttribute(Qt::WA_OpaquePaintEvent); + + if (customEmojiPausedChanges) { + std::move( + customEmojiPausedChanges + ) | rpl::start_with_next([=] { + _wrap.entity()->update(); + }, lifetime()); + } } PinnedBar::~PinnedBar() { diff --git a/Telegram/SourceFiles/ui/chat/pinned_bar.h b/Telegram/SourceFiles/ui/chat/pinned_bar.h index 848b3e3cc..fa9917eed 100644 --- a/Telegram/SourceFiles/ui/chat/pinned_bar.h +++ b/Telegram/SourceFiles/ui/chat/pinned_bar.h @@ -22,7 +22,10 @@ class RpWidget; class PinnedBar final { public: - PinnedBar(not_null parent, Fn customEmojiPaused); + PinnedBar( + not_null parent, + Fn customEmojiPaused, + rpl::producer<> customEmojiPausedChanges); ~PinnedBar(); void show();