Add bio privacy section.

This commit is contained in:
John Preston 2023-05-30 18:41:02 +04:00
parent 8b22f9dcac
commit e90642f3a0
4 changed files with 66 additions and 0 deletions

View File

@ -584,6 +584,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_settings_forwards_privacy" = "Forwarded messages";
"lng_settings_profile_photo_privacy" = "Profile photo";
"lng_settings_voices_privacy" = "Voice messages";
"lng_settings_bio_privacy" = "Bio";
"lng_settings_privacy_premium" = "Only subscribers of {link} can restrict receiving voice messages.";
"lng_settings_privacy_premium_link" = "Telegram Premium";
"lng_settings_passcode_disable" = "Disable Passcode";
@ -999,6 +1000,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_edit_privacy_groups_always_title" = "Always allow";
"lng_edit_privacy_groups_never_title" = "Never allow";
"lng_edit_privacy_about_title" = "Bio privacy settings";
"lng_edit_privacy_about_header" = "Who can see my bio";
"lng_edit_privacy_about_always_empty" = "Always allow";
"lng_edit_privacy_about_never_empty" = "Never allow";
"lng_edit_privacy_about_exceptions" = "These users will or will not be able to see your profile bio regardless of the settings above.";
"lng_edit_privacy_about_always_title" = "Always allow";
"lng_edit_privacy_about_never_title" = "Never allow";
"lng_edit_privacy_calls_title" = "Voice calls privacy";
"lng_edit_privacy_calls_header" = "Who can call you";
"lng_edit_privacy_calls_always_empty" = "Always allow";

View File

@ -1284,4 +1284,39 @@ auto VoicesPrivacyController::exceptionsDescription() const
return tr::lng_edit_privacy_voices_exceptions();
}
UserPrivacy::Key AboutPrivacyController::key() const {
return Key::About;
}
rpl::producer<QString> AboutPrivacyController::title() const {
return tr::lng_edit_privacy_about_title();
}
rpl::producer<QString> AboutPrivacyController::optionsTitleKey() const {
return tr::lng_edit_privacy_about_header();
}
rpl::producer<QString> AboutPrivacyController::exceptionButtonTextKey(
Exception exception) const {
switch (exception) {
case Exception::Always: return tr::lng_edit_privacy_about_always_empty();
case Exception::Never: return tr::lng_edit_privacy_about_never_empty();
}
Unexpected("Invalid exception value.");
}
rpl::producer<QString> AboutPrivacyController::exceptionBoxTitle(
Exception exception) const {
switch (exception) {
case Exception::Always: return tr::lng_edit_privacy_about_always_title();
case Exception::Never: return tr::lng_edit_privacy_about_never_title();
}
Unexpected("Invalid exception value.");
}
auto AboutPrivacyController::exceptionsDescription() const
-> rpl::producer<QString> {
return tr::lng_edit_privacy_about_exceptions();
}
} // namespace Settings

View File

@ -270,4 +270,21 @@ private:
};
class AboutPrivacyController final : public EditPrivacyController {
public:
using Option = EditPrivacyBox::Option;
using Exception = EditPrivacyBox::Exception;
Key key() const override;
rpl::producer<QString> title() const override;
rpl::producer<QString> optionsTitleKey() const override;
rpl::producer<QString> exceptionButtonTextKey(
Exception exception) const override;
rpl::producer<QString> exceptionBoxTitle(
Exception exception) const override;
rpl::producer<QString> exceptionsDescription() const override;
};
} // namespace Settings

View File

@ -310,6 +310,11 @@ void SetupPrivacy(
{ &st::settingsPremiumIconVoice, kIconRed },
Key::Voices,
[=] { return std::make_unique<VoicesPrivacyController>(session); });
add(
tr::lng_settings_bio_privacy(),
{ &st::settingsIconAccount, kIconDarkOrange },
Key::About,
[] { return std::make_unique<AboutPrivacyController>(); });
session->api().userPrivacy().reload(Api::UserPrivacy::Key::AddedByPhone);