diff --git a/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp b/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp index c1781ea03..c22904262 100644 --- a/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp +++ b/Telegram/SourceFiles/info/boosts/create_giveaway_box.cpp @@ -237,6 +237,11 @@ void CreateGiveawayBox( randomWrap->toggle(type == GiveawayType::Random, anim::type::instant); }, randomWrap->lifetime()); + randomWrap->toggleOn( + state->typeValue.value( + ) | rpl::map(rpl::mappers::_1 == GiveawayType::Random), + anim::type::instant); + const auto sliderContainer = randomWrap->entity()->add( object_ptr(randomWrap)); const auto fillSliderContainer = [=] { @@ -574,18 +579,19 @@ void CreateGiveawayBox( box->setStyle(stButton); auto button = object_ptr( box, - state->toAwardAmountChanged.events_starting_with( - rpl::empty_value() - ) | rpl::map([=] { - return (typeGroup->value() == GiveawayType::SpecificUsers) - ? tr::lng_giveaway_award() - : tr::lng_giveaway_start(); - }) | rpl::flatten_latest(), + rpl::conditional( + state->typeValue.value( + ) | rpl::map(rpl::mappers::_1 == GiveawayType::Random), + tr::lng_giveaway_start(), + tr::lng_giveaway_award()), st::giveawayGiftCodeStartButton); button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform); - button->resizeToWidth(box->width() - - stButton.buttonPadding.left() - - stButton.buttonPadding.right()); + state->typeValue.value( + ) | rpl::start_with_next([=, raw = button.data()] { + raw->resizeToWidth(box->width() + - stButton.buttonPadding.left() + - stButton.buttonPadding.right()); + }, button->lifetime()); button->setClickedCallback([=] { if (state->confirmButtonBusy) { return;