2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

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

@@ -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);