mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improved prize description for credits in box for giveaway creation.
This commit is contained in:
parent
51030e3c45
commit
19492f7e7b
2 changed files with 71 additions and 21 deletions
|
@ -2801,6 +2801,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_giveaway_prizes_just_premium#other" = "All prizes: **{count}** Telegram Premium subscriptions {duration}.";
|
"lng_giveaway_prizes_just_premium#other" = "All prizes: **{count}** Telegram Premium subscriptions {duration}.";
|
||||||
"lng_giveaway_prizes_additional#one" = "All prizes: **{count}** {prize} with Telegram Premium subscription {duration}.";
|
"lng_giveaway_prizes_additional#one" = "All prizes: **{count}** {prize} with Telegram Premium subscription {duration}.";
|
||||||
"lng_giveaway_prizes_additional#other" = "All prizes: **{count}** {prize} with Telegram Premium subscriptions {duration}.";
|
"lng_giveaway_prizes_additional#other" = "All prizes: **{count}** {prize} with Telegram Premium subscriptions {duration}.";
|
||||||
|
"lng_giveaway_additional_credits_about" = "Turn this on if you want to give the winners your own prizes in addition to Stars.";
|
||||||
|
"lng_giveaway_prizes_just_credits#one" = "All prizes: **{count}** Star.";
|
||||||
|
"lng_giveaway_prizes_just_credits#other" = "All prizes: **{count}** Stars.";
|
||||||
|
"lng_giveaway_prizes_additional_credits#one" = "All prizes: **{count}** {prize} with {amount}.";
|
||||||
|
"lng_giveaway_prizes_additional_credits#other" = "All prizes: **{count}** {prize} with {amount}.";
|
||||||
|
"lng_giveaway_prizes_additional_credits_amount#one" = "{count} Star";
|
||||||
|
"lng_giveaway_prizes_additional_credits_amount#other" = "{count} Stars";
|
||||||
"lng_giveaway_show_winners" = "Show winners";
|
"lng_giveaway_show_winners" = "Show winners";
|
||||||
"lng_giveaway_show_winners_about" = "Choose whether to make the list of winners public when the giveaway ends.";
|
"lng_giveaway_show_winners_about" = "Choose whether to make the list of winners public when the giveaway ends.";
|
||||||
|
|
||||||
|
|
|
@ -1052,29 +1052,31 @@ void CreateGiveawayBox(
|
||||||
const auto listOptions = (type == GiveawayType::SpecificUsers)
|
const auto listOptions = (type == GiveawayType::SpecificUsers)
|
||||||
? listOptionsSpecific
|
? listOptionsSpecific
|
||||||
: listOptionsRandom;
|
: listOptionsRandom;
|
||||||
Ui::AddSubsectionTitle(
|
if (type != GiveawayType::Credits) {
|
||||||
listOptions,
|
Ui::AddSubsectionTitle(
|
||||||
tr::lng_giveaway_duration_title(
|
listOptions,
|
||||||
lt_count,
|
tr::lng_giveaway_duration_title(
|
||||||
rpl::single(usersCount) | tr::to_count()),
|
lt_count,
|
||||||
st::giveawayGiftCodeChannelsSubsectionPadding);
|
rpl::single(usersCount) | tr::to_count()),
|
||||||
Ui::Premium::AddGiftOptions(
|
st::giveawayGiftCodeChannelsSubsectionPadding);
|
||||||
listOptions,
|
Ui::Premium::AddGiftOptions(
|
||||||
durationGroup,
|
listOptions,
|
||||||
state->apiOptions.options(usersCount),
|
durationGroup,
|
||||||
st::giveawayGiftCodeGiftOption,
|
state->apiOptions.options(usersCount),
|
||||||
true);
|
st::giveawayGiftCodeGiftOption,
|
||||||
|
true);
|
||||||
|
|
||||||
Ui::AddSkip(listOptions);
|
Ui::AddSkip(listOptions);
|
||||||
|
|
||||||
auto termsContainer = object_ptr<Ui::VerticalLayout>(listOptions);
|
auto termsContainer = object_ptr<Ui::VerticalLayout>(listOptions);
|
||||||
addTerms(termsContainer.data());
|
addTerms(termsContainer.data());
|
||||||
listOptions->add(object_ptr<Ui::DividerLabel>(
|
listOptions->add(object_ptr<Ui::DividerLabel>(
|
||||||
listOptions,
|
listOptions,
|
||||||
std::move(termsContainer),
|
std::move(termsContainer),
|
||||||
st::defaultBoxDividerLabelPadding));
|
st::defaultBoxDividerLabelPadding));
|
||||||
|
|
||||||
Ui::AddSkip(listOptions);
|
Ui::AddSkip(listOptions);
|
||||||
|
}
|
||||||
|
|
||||||
box->verticalLayout()->resizeToWidth(box->width());
|
box->verticalLayout()->resizeToWidth(box->width());
|
||||||
};
|
};
|
||||||
|
@ -1202,8 +1204,49 @@ void CreateGiveawayBox(
|
||||||
TextWithEntities{ duration },
|
TextWithEntities{ duration },
|
||||||
Ui::Text::RichLangValue);
|
Ui::Text::RichLangValue);
|
||||||
});
|
});
|
||||||
|
auto creditsAdditionalAbout = rpl::combine(
|
||||||
|
state->additionalPrize.value(),
|
||||||
|
state->sliderValue.value(),
|
||||||
|
creditsGroup->value()
|
||||||
|
) | rpl::map([=](QString prize, int users, int creditsIndex) {
|
||||||
|
const auto credits = creditsOption(creditsIndex).credits;
|
||||||
|
return prize.isEmpty()
|
||||||
|
? tr::lng_giveaway_prizes_just_credits(
|
||||||
|
tr::now,
|
||||||
|
lt_count,
|
||||||
|
credits,
|
||||||
|
Ui::Text::RichLangValue)
|
||||||
|
: tr::lng_giveaway_prizes_additional_credits(
|
||||||
|
tr::now,
|
||||||
|
lt_count,
|
||||||
|
users,
|
||||||
|
lt_prize,
|
||||||
|
TextWithEntities{ prize },
|
||||||
|
lt_amount,
|
||||||
|
tr::lng_giveaway_prizes_additional_credits_amount(
|
||||||
|
tr::now,
|
||||||
|
lt_count,
|
||||||
|
credits,
|
||||||
|
Ui::Text::RichLangValue),
|
||||||
|
Ui::Text::RichLangValue);
|
||||||
|
});
|
||||||
|
|
||||||
Ui::AddDividerText(additionalWrap, std::move(additionalAbout));
|
auto creditsValueType = typeGroup->value(
|
||||||
|
) | rpl::map(rpl::mappers::_1 == GiveawayType::Credits);
|
||||||
|
|
||||||
|
Ui::AddDividerText(
|
||||||
|
additionalWrap,
|
||||||
|
rpl::conditional(
|
||||||
|
additionalToggle->toggledValue(),
|
||||||
|
rpl::conditional(
|
||||||
|
rpl::duplicate(creditsValueType),
|
||||||
|
std::move(creditsAdditionalAbout),
|
||||||
|
std::move(additionalAbout)),
|
||||||
|
rpl::conditional(
|
||||||
|
rpl::duplicate(creditsValueType),
|
||||||
|
tr::lng_giveaway_additional_credits_about(),
|
||||||
|
tr::lng_giveaway_additional_about()
|
||||||
|
) | rpl::map(Ui::Text::WithEntities)));
|
||||||
Ui::AddSkip(additionalWrap);
|
Ui::AddSkip(additionalWrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue