mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added terms to bottom of giveaway box for prepaid giveaways.
This commit is contained in:
parent
f7ab8298cf
commit
97bd865916
1 changed files with 44 additions and 21 deletions
|
@ -648,6 +648,24 @@ void CreateGiveawayBox(
|
||||||
Settings::AddSkip(countriesContainer);
|
Settings::AddSkip(countriesContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto addTerms = [=](not_null<Ui::VerticalLayout*> c) {
|
||||||
|
auto terms = object_ptr<Ui::FlatLabel>(
|
||||||
|
c,
|
||||||
|
tr::lng_premium_gift_terms(
|
||||||
|
lt_link,
|
||||||
|
tr::lng_premium_gift_terms_link(
|
||||||
|
) | rpl::map([](const QString &t) {
|
||||||
|
return Ui::Text::Link(t, 1);
|
||||||
|
}),
|
||||||
|
Ui::Text::WithEntities),
|
||||||
|
st::boxDividerLabel);
|
||||||
|
terms->setLink(1, std::make_shared<LambdaClickHandler>([=] {
|
||||||
|
box->closeBox();
|
||||||
|
Settings::ShowPremium(&peer->session(), QString());
|
||||||
|
}));
|
||||||
|
c->add(std::move(terms));
|
||||||
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
const auto dateContainer = randomWrap->entity()->add(
|
const auto dateContainer = randomWrap->entity()->add(
|
||||||
object_ptr<Ui::VerticalLayout>(randomWrap));
|
object_ptr<Ui::VerticalLayout>(randomWrap));
|
||||||
|
@ -685,12 +703,29 @@ void CreateGiveawayBox(
|
||||||
});
|
});
|
||||||
|
|
||||||
Settings::AddSkip(dateContainer);
|
Settings::AddSkip(dateContainer);
|
||||||
Settings::AddDividerText(
|
if (prepaid) {
|
||||||
dateContainer,
|
auto terms = object_ptr<Ui::VerticalLayout>(dateContainer);
|
||||||
tr::lng_giveaway_date_about(
|
terms->add(object_ptr<Ui::FlatLabel>(
|
||||||
lt_count,
|
terms,
|
||||||
state->sliderValue.value() | tr::to_count()));
|
tr::lng_giveaway_date_about(
|
||||||
Settings::AddSkip(dateContainer);
|
lt_count,
|
||||||
|
state->sliderValue.value() | tr::to_count()),
|
||||||
|
st::boxDividerLabel));
|
||||||
|
Settings::AddSkip(terms.data());
|
||||||
|
Settings::AddSkip(terms.data());
|
||||||
|
addTerms(terms.data());
|
||||||
|
dateContainer->add(object_ptr<Ui::DividerLabel>(
|
||||||
|
dateContainer,
|
||||||
|
std::move(terms),
|
||||||
|
st::settingsDividerLabelPadding));
|
||||||
|
} else {
|
||||||
|
Settings::AddDividerText(
|
||||||
|
dateContainer,
|
||||||
|
tr::lng_giveaway_date_about(
|
||||||
|
lt_count,
|
||||||
|
state->sliderValue.value() | tr::to_count()));
|
||||||
|
Settings::AddSkip(dateContainer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto durationGroup = std::make_shared<Ui::RadiobuttonGroup>(0);
|
const auto durationGroup = std::make_shared<Ui::RadiobuttonGroup>(0);
|
||||||
|
@ -718,23 +753,11 @@ void CreateGiveawayBox(
|
||||||
|
|
||||||
Settings::AddSkip(listOptions);
|
Settings::AddSkip(listOptions);
|
||||||
|
|
||||||
auto terms = object_ptr<Ui::FlatLabel>(
|
auto termsContainer = object_ptr<Ui::VerticalLayout>(listOptions);
|
||||||
listOptions,
|
addTerms(termsContainer.data());
|
||||||
tr::lng_premium_gift_terms(
|
|
||||||
lt_link,
|
|
||||||
tr::lng_premium_gift_terms_link(
|
|
||||||
) | rpl::map([](const QString &t) {
|
|
||||||
return Ui::Text::Link(t, 1);
|
|
||||||
}),
|
|
||||||
Ui::Text::WithEntities),
|
|
||||||
st::boxDividerLabel);
|
|
||||||
terms->setLink(1, std::make_shared<LambdaClickHandler>([=] {
|
|
||||||
box->closeBox();
|
|
||||||
Settings::ShowPremium(&peer->session(), QString());
|
|
||||||
}));
|
|
||||||
listOptions->add(object_ptr<Ui::DividerLabel>(
|
listOptions->add(object_ptr<Ui::DividerLabel>(
|
||||||
listOptions,
|
listOptions,
|
||||||
std::move(terms),
|
std::move(termsContainer),
|
||||||
st::settingsDividerLabelPadding));
|
st::settingsDividerLabelPadding));
|
||||||
|
|
||||||
box->verticalLayout()->resizeToWidth(box->width());
|
box->verticalLayout()->resizeToWidth(box->width());
|
||||||
|
|
Loading…
Add table
Reference in a new issue