Fixed finishing of toggle animations in peer permissions box.

This commit is contained in:
23rd 2023-01-31 18:31:32 +03:00 committed by John Preston
parent a8a9b638bb
commit 7881cb8946
2 changed files with 10 additions and 4 deletions

View file

@ -224,8 +224,15 @@ not_null<Ui::SettingsButton*> SendMediaToggle(
toggleButton->setToggleLocked(locked.has_value());
struct State final {
Ui::Animations::Simple animation;
rpl::lifetime finishAnimatingLifetime;
};
const auto state = button->lifetime().make_state<State>();
rpl::duplicate(
checkedValue
) | rpl::start_with_next([=] {
button->finishAnimating();
toggleButton->finishAnimating();
}, state->finishAnimatingLifetime);
const auto label = Ui::CreateChild<Ui::FlatLabel>(
button,
rpl::combine(
@ -303,6 +310,7 @@ not_null<Ui::SettingsButton*> SendMediaToggle(
) | rpl::start_with_next([=] {
if (!handleLocked()) {
toggleMedia(!button->toggled());
state->finishAnimatingLifetime.destroy();
}
}, toggleButton->lifetime());
@ -969,9 +977,7 @@ EditFlagsControl<ChatRestrictions, Ui::RpWidget> CreateEditRestrictions(
auto wrap = object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
container,
object_ptr<Ui::VerticalLayout>(container));
if (locked.has_value()) {
wrap->hide(anim::type::instant);
}
wrap->hide(anim::type::instant);
SendMediaToggle(
container,
state->restrictions.events_starting_with(

@ -1 +1 @@
Subproject commit a5020ac5bc2752319c10a9749fc973d9fb58c710
Subproject commit 5535a3fe5720272015dea2ff608bb759634ba7e5