From bcdcd7ee709e720506278665a68b54d7fb9fcba0 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 29 Jun 2022 14:18:08 +0300 Subject: [PATCH] Disabled animation for first showing of right button in pinned bar. --- Telegram/SourceFiles/ui/chat/pinned_bar.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/ui/chat/pinned_bar.cpp b/Telegram/SourceFiles/ui/chat/pinned_bar.cpp index bc3dc09fe..a078ed63e 100644 --- a/Telegram/SourceFiles/ui/chat/pinned_bar.cpp +++ b/Telegram/SourceFiles/ui/chat/pinned_bar.cpp @@ -82,6 +82,7 @@ void PinnedBar::setContent(rpl::producer content) { } void PinnedBar::setRightButton(object_ptr button) { + const auto hasPrevious = (_right.button != nullptr); if (auto previous = _right.button.release()) { _right.previousButtonLifetime.make_state( RightButton::fromRaw(std::move(previous))); @@ -94,8 +95,13 @@ void PinnedBar::setRightButton(object_ptr button) { _right.button.create(_wrap.entity(), std::move(button)); if (_right.button) { _right.button->setParent(_wrap.entity()); - _right.button->setDuration(st::defaultMessageBar.duration); - _right.button->show(anim::type::normal); + if (hasPrevious) { + _right.button->setDuration(st::defaultMessageBar.duration); + _right.button->show(anim::type::normal); + } else { + _right.button->setDuration(0); + _right.button->show(anim::type::instant); + } } if (_bar) { updateControlsGeometry(_wrap.geometry());