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, [=] {
return controller()->isGifPausedAtLeastFor(
Window::GifPauseReason::Any);
});
}, controller()->gifPauseLevelChanged());
auto pinnedRefreshed = Info::Profile::SharedMediaCountValue(
_peer,
MsgId(0), // topicRootId

View File

@ -442,7 +442,7 @@ void RepliesWidget::setupRootView() {
_rootView = std::make_unique<Ui::PinnedBar>(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<Ui::PinnedBar>(this, [=] {
return controller()->isGifPausedAtLeastFor(
Window::GifPauseReason::Any);
});
}, controller()->gifPauseLevelChanged());
auto pinnedRefreshed = Info::Profile::SharedMediaCountValue(
_history->peer,
_rootId,

View File

@ -18,7 +18,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
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))
, _shadow(std::make_unique<PlainShadow>(_wrap.parentWidget()))
, _customEmojiPaused(std::move(customEmojiPaused)) {
@ -30,6 +33,14 @@ PinnedBar::PinnedBar(not_null<QWidget*> parent, Fn<bool()> 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() {

View File

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