diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index 199ee4cad..6720339c2 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -156,14 +156,15 @@ void GiftBox( // List. const auto group = std::make_shared(); - group->setChangedCallback([=](int value) { + const auto groupValueChangedCallback = [=](int value) { Expects(value < options.size() && value >= 0); auto text = tr::lng_premium_gift_button( tr::now, lt_cost, options[value].costTotal); state->buttonText.fire(std::move(text)); - }); + }; + group->setChangedCallback(groupValueChangedCallback); Ui::Premium::AddGiftOptions( buttonsParent, group, @@ -215,7 +216,7 @@ void GiftBox( }); box->addButton(std::move(button)); - group->setValue(0); + groupValueChangedCallback(0); Data::PeerPremiumValue( user diff --git a/Telegram/SourceFiles/settings/settings_premium.cpp b/Telegram/SourceFiles/settings/settings_premium.cpp index 82d4e4801..2b359b984 100644 --- a/Telegram/SourceFiles/settings/settings_premium.cpp +++ b/Telegram/SourceFiles/settings/settings_premium.cpp @@ -1653,7 +1653,7 @@ QPointer Premium::createPinnedToBottom( } else { #endif { - _radioGroup->setChangedCallback([=](int value) { + const auto callback = [=](int value) { const auto options = _controller->session().api().premium().subscriptionOptions(); if (options.empty()) { @@ -1665,8 +1665,9 @@ QPointer Premium::createPinnedToBottom( lt_cost, options[value].costPerMonth); _buttonText = std::move(text); - }); - _radioGroup->setValue(0); + }; + _radioGroup->setChangedCallback(callback); + callback(0); } _showFinished.events( diff --git a/Telegram/SourceFiles/ui/effects/premium_graphics.cpp b/Telegram/SourceFiles/ui/effects/premium_graphics.cpp index 2e9972257..a7ce3f922 100644 --- a/Telegram/SourceFiles/ui/effects/premium_graphics.cpp +++ b/Telegram/SourceFiles/ui/effects/premium_graphics.cpp @@ -1138,6 +1138,10 @@ void AddGiftOptions( stCheckbox, std::move(radioView)); radio->setAttribute(Qt::WA_TransparentForMouseEvents); + { // Paint the last frame instantly for the layer animation. + group->setValue(0); + radio->finishAnimating(); + } row->sizeValue( ) | rpl::start_with_next([=, margins = stCheckbox.margin](