Added ToS link to any box of entry from credits earn history.

This commit is contained in:
23rd
2025-11-25 18:59:37 +03:00
parent 8f1d40892e
commit 445576d568

View File

@@ -722,6 +722,19 @@ void FillCreditOptions(
}, content->lifetime());
}
[[nodiscard]] object_ptr<Ui::FlatLabel> CreateCreditsTermsLabel(
not_null<Ui::GenericBox*> box) {
return object_ptr<Ui::FlatLabel>(
box,
tr::lng_credits_box_out_about(
lt_link,
tr::lng_payments_terms_link(
) | Ui::Text::ToLink(
tr::lng_credits_box_out_about_link(tr::now)),
Ui::Text::WithEntities),
st::creditsBoxAboutDivider);
}
not_null<Ui::RpWidget*> AddBalanceWidget(
not_null<Ui::RpWidget*> parent,
not_null<Main::Session*> session,
@@ -887,17 +900,7 @@ void BoostCreditsBox(
AddCreditsBoostTable(controller->uiShow(), content, {}, b);
Ui::AddSkip(content);
box->addRow(
object_ptr<Ui::FlatLabel>(
box,
tr::lng_credits_box_out_about(
lt_link,
tr::lng_payments_terms_link(
) | Ui::Text::ToLink(
tr::lng_credits_box_out_about_link(tr::now)),
Ui::Text::WithEntities),
st::creditsBoxAboutDivider),
style::al_top);
box->addRow(CreateCreditsTermsLabel(box), style::al_top);
Ui::AddSkip(content);
box->addButton(tr::lng_box_ok(), [=] {
@@ -2004,17 +2007,7 @@ void GenericCreditsEntryBox(
const auto showNextToUpgrade = e.nextToUpgradeShow;
if (!isStarGift && e.credits.stars()) {
box->addRow(
object_ptr<Ui::FlatLabel>(
box,
tr::lng_credits_box_out_about(
lt_link,
tr::lng_payments_terms_link(
) | Ui::Text::ToLink(
tr::lng_credits_box_out_about_link(tr::now)),
Ui::Text::WithEntities),
st::creditsBoxAboutDivider),
style::al_top);
box->addRow(CreateCreditsTermsLabel(box), style::al_top);
} else if (starGiftCanManage) {
const auto hiddenPhrase = giftToChannelCanManage
? tr::lng_gift_hidden_hint_channel
@@ -2073,6 +2066,8 @@ void GenericCreditsEntryBox(
toggleVisibility(!e.savedToProfile);
return false;
});
} else if (e.credits.stars()) {
box->addRow(CreateCreditsTermsLabel(box), style::al_top);
} else {
addGiftLinkTON();
}