mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-27 07:52:57 +02:00
Added support of maximum amount of credits to withdraw from app config.
This commit is contained in:
parent
388803ffdb
commit
c93e948bb3
5 changed files with 18 additions and 2 deletions
|
@ -6577,6 +6577,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_bot_earn_learn_credits_out_about" = "You can withdraw Stars using Fragment, or use Stars to advertise your bot. {link}";
|
||||
"lng_self_earn_learn_credits_out_about" = "You can withdraw from 10 Stars using Fragment. {link}";
|
||||
"lng_bot_earn_out_ph" = "Enter amount to withdraw";
|
||||
"lng_bot_earn_out_ph_max" = "Enter amount to withdraw (max. {amount})";
|
||||
"lng_bot_earn_balance_password_title" = "Two-step verification";
|
||||
"lng_bot_earn_balance_password_description" = "Please enter your password to collect.";
|
||||
"lng_bot_earn_credits_out_minimal" = "You cannot withdraw less than {link}.";
|
||||
|
|
|
@ -89,6 +89,10 @@ int AppConfig::starrefCommissionMax() const {
|
|||
return get<int>(u"starref_max_commission_permille"_q, 900);
|
||||
}
|
||||
|
||||
int AppConfig::starsWithdrawMax() const {
|
||||
return get<int>(u"stars_revenue_withdrawal_max"_q, 100);
|
||||
}
|
||||
|
||||
float64 AppConfig::starsWithdrawRate() const {
|
||||
return get<float64>(u"stars_usd_withdraw_rate_x1000"_q, 1300) / 1000.;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
[[nodiscard]] int starrefCommissionMin() const;
|
||||
[[nodiscard]] int starrefCommissionMax() const;
|
||||
|
||||
[[nodiscard]] int starsWithdrawMax() const;
|
||||
[[nodiscard]] float64 starsWithdrawRate() const;
|
||||
[[nodiscard]] float64 currencyWithdrawRate() const;
|
||||
[[nodiscard]] bool paidMessagesAvailable() const;
|
||||
|
|
|
@ -2615,9 +2615,15 @@ void AddWithdrawalWidget(
|
|||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
container,
|
||||
object_ptr<Ui::VerticalLayout>(container)));
|
||||
const auto starsWithdrawMax = CreditsAmount(
|
||||
controller->session().appConfig().starsWithdrawMax());
|
||||
const auto input = Ui::AddInputFieldForCredits(
|
||||
withdrawalWrap->entity(),
|
||||
rpl::duplicate(availableBalanceValue));
|
||||
rpl::duplicate(
|
||||
availableBalanceValue
|
||||
) | rpl::map([=](CreditsAmount amount) {
|
||||
return (amount > starsWithdrawMax) ? starsWithdrawMax : amount;
|
||||
}));
|
||||
|
||||
Ui::AddSkip(withdrawalWrap->entity());
|
||||
Ui::AddSkip(withdrawalWrap->entity());
|
||||
|
|
|
@ -175,7 +175,11 @@ not_null<MaskedInputField*> AddInputFieldForCredits(
|
|||
const auto input = CreateChild<NumberInput>(
|
||||
inputContainer,
|
||||
st,
|
||||
tr::lng_bot_earn_out_ph(),
|
||||
tr::lng_bot_earn_out_ph_max(
|
||||
lt_amount,
|
||||
currentValue.value() | rpl::map([](CreditsAmount amount) {
|
||||
return QString::number(amount.whole());
|
||||
})),
|
||||
QString::number(currentValue.current().whole()),
|
||||
currentValue.current().whole());
|
||||
rpl::duplicate(
|
||||
|
|
Loading…
Add table
Reference in a new issue