2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Allow editing charge-for-message privacy.

This commit is contained in:
John Preston
2025-02-11 19:26:20 +04:00
parent 909b01241b
commit f2aa3afbbb
8 changed files with 327 additions and 42 deletions

View File

@@ -356,10 +356,16 @@ void AddMessagesPrivacyButton(
not_null<Ui::VerticalLayout*> container) {
const auto session = &controller->session();
const auto privacy = &session->api().globalPrivacy();
auto label = rpl::conditional(
auto label = rpl::combine(
privacy->newRequirePremium(),
tr::lng_edit_privacy_contacts_and_premium(),
tr::lng_edit_privacy_everyone());
privacy->newChargeStars()
) | rpl::map([=](bool requirePremium, int chargeStars) {
return chargeStars
? tr::lng_edit_privacy_paid()
: requirePremium
? tr::lng_edit_privacy_contacts_and_premium()
: tr::lng_edit_privacy_everyone();
}) | rpl::flatten_latest();
const auto &st = st::settingsButtonNoIcon;
const auto button = AddButtonWithLabel(
container,