Fix spoiler / custom emoji in pinned bar unpause.

This commit is contained in:
John Preston 2022-12-30 14:27:00 +04:00
parent cabed9587b
commit b6ade7ce19
4 changed files with 19 additions and 5 deletions

View File

@ -6224,7 +6224,7 @@ void HistoryWidget::checkPinnedBarState() {
_pinnedBar = std::make_unique<Ui::PinnedBar>(this, [=] { _pinnedBar = std::make_unique<Ui::PinnedBar>(this, [=] {
return controller()->isGifPausedAtLeastFor( return controller()->isGifPausedAtLeastFor(
Window::GifPauseReason::Any); Window::GifPauseReason::Any);
}); }, controller()->gifPauseLevelChanged());
auto pinnedRefreshed = Info::Profile::SharedMediaCountValue( auto pinnedRefreshed = Info::Profile::SharedMediaCountValue(
_peer, _peer,
MsgId(0), // topicRootId MsgId(0), // topicRootId

View File

@ -442,7 +442,7 @@ void RepliesWidget::setupRootView() {
_rootView = std::make_unique<Ui::PinnedBar>(this, [=] { _rootView = std::make_unique<Ui::PinnedBar>(this, [=] {
return controller()->isGifPausedAtLeastFor( return controller()->isGifPausedAtLeastFor(
Window::GifPauseReason::Any); Window::GifPauseReason::Any);
}); }, controller()->gifPauseLevelChanged());
_rootView->setContent(rpl::combine( _rootView->setContent(rpl::combine(
RootViewContent( RootViewContent(
_history, _history,
@ -1592,7 +1592,7 @@ void RepliesWidget::checkPinnedBarState() {
_pinnedBar = std::make_unique<Ui::PinnedBar>(this, [=] { _pinnedBar = std::make_unique<Ui::PinnedBar>(this, [=] {
return controller()->isGifPausedAtLeastFor( return controller()->isGifPausedAtLeastFor(
Window::GifPauseReason::Any); Window::GifPauseReason::Any);
}); }, controller()->gifPauseLevelChanged());
auto pinnedRefreshed = Info::Profile::SharedMediaCountValue( auto pinnedRefreshed = Info::Profile::SharedMediaCountValue(
_history->peer, _history->peer,
_rootId, _rootId,

View File

@ -18,7 +18,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Ui { namespace Ui {
PinnedBar::PinnedBar(not_null<QWidget*> parent, Fn<bool()> customEmojiPaused) PinnedBar::PinnedBar(
not_null<QWidget*> parent,
Fn<bool()> customEmojiPaused,
rpl::producer<> customEmojiPausedChanges)
: _wrap(parent, object_ptr<RpWidget>(parent)) : _wrap(parent, object_ptr<RpWidget>(parent))
, _shadow(std::make_unique<PlainShadow>(_wrap.parentWidget())) , _shadow(std::make_unique<PlainShadow>(_wrap.parentWidget()))
, _customEmojiPaused(std::move(customEmojiPaused)) { , _customEmojiPaused(std::move(customEmojiPaused)) {
@ -30,6 +33,14 @@ PinnedBar::PinnedBar(not_null<QWidget*> parent, Fn<bool()> customEmojiPaused)
QPainter(_wrap.entity()).fillRect(clip, st::historyPinnedBg); QPainter(_wrap.entity()).fillRect(clip, st::historyPinnedBg);
}, lifetime()); }, lifetime());
_wrap.setAttribute(Qt::WA_OpaquePaintEvent); _wrap.setAttribute(Qt::WA_OpaquePaintEvent);
if (customEmojiPausedChanges) {
std::move(
customEmojiPausedChanges
) | rpl::start_with_next([=] {
_wrap.entity()->update();
}, lifetime());
}
} }
PinnedBar::~PinnedBar() { PinnedBar::~PinnedBar() {

View File

@ -22,7 +22,10 @@ class RpWidget;
class PinnedBar final { class PinnedBar final {
public: public:
PinnedBar(not_null<QWidget*> parent, Fn<bool()> customEmojiPaused); PinnedBar(
not_null<QWidget*> parent,
Fn<bool()> customEmojiPaused,
rpl::producer<> customEmojiPausedChanges);
~PinnedBar(); ~PinnedBar();
void show(); void show();