Disabled animation for first showing of right button in pinned bar.

This commit is contained in:
23rd 2022-06-29 14:18:08 +03:00 committed by John Preston
parent 6cc0d4f7d5
commit bcdcd7ee70

View file

@ -82,6 +82,7 @@ void PinnedBar::setContent(rpl::producer<Ui::MessageBarContent> content) {
}
void PinnedBar::setRightButton(object_ptr<Ui::RpWidget> button) {
const auto hasPrevious = (_right.button != nullptr);
if (auto previous = _right.button.release()) {
_right.previousButtonLifetime.make_state<RightButton>(
RightButton::fromRaw(std::move(previous)));
@ -94,8 +95,13 @@ void PinnedBar::setRightButton(object_ptr<Ui::RpWidget> 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());