Removed display of credits button in settings when user has no credits.

This commit is contained in:
23rd 2024-05-29 03:59:27 +03:00 committed by John Preston
parent 57ecc2be1d
commit 02bd2bca64
1 changed files with 23 additions and 13 deletions

View File

@ -491,20 +491,30 @@ void SetupPremium(
controller->setPremiumRef("settings"); controller->setPremiumRef("settings");
showOther(PremiumId()); showOther(PremiumId());
}); });
AddPremiumStar( {
AddButtonWithLabel( const auto wrap = container->add(
container, object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
tr::lng_credits_summary_title(), container,
object_ptr<Ui::VerticalLayout>(container)));
wrap->toggleOn(
controller->session().creditsValue( controller->session().creditsValue(
) | rpl::map([=](uint64 c) { ) | rpl::map(rpl::mappers::_1 > 0));
return c ? Lang::FormatCountToShort(c).string : QString{}; wrap->finishAnimating();
}), AddPremiumStar(
st::settingsButton), AddButtonWithLabel(
true wrap->entity(),
)->addClickHandler([=] { tr::lng_credits_summary_title(),
controller->setPremiumRef("settings"); controller->session().creditsValue(
showOther(CreditsId()); ) | rpl::map([=](uint64 c) {
}); return c ? Lang::FormatCountToShort(c).string : QString{};
}),
st::settingsButton),
true
)->addClickHandler([=] {
controller->setPremiumRef("settings");
showOther(CreditsId());
});
}
const auto button = AddButtonWithIcon( const auto button = AddButtonWithIcon(
container, container,
tr::lng_business_title(), tr::lng_business_title(),