mirror of https://github.com/procxx/kepka.git
Add forwards and profile photo privacy settings.
This commit is contained in:
parent
a34e998c42
commit
81862215b4
|
@ -359,6 +359,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_settings_calls_peer_to_peer" = "Peer-to-peer in calls";
|
"lng_settings_calls_peer_to_peer" = "Peer-to-peer in calls";
|
||||||
"lng_settings_groups_invite" = "Groups";
|
"lng_settings_groups_invite" = "Groups";
|
||||||
"lng_settings_group_privacy_about" = "Change who can add you to groups and channels.";
|
"lng_settings_group_privacy_about" = "Change who can add you to groups and channels.";
|
||||||
|
"lng_settings_forwards_privacy" = "Forwarded messages";
|
||||||
|
"lng_settings_profile_photo_privacy" = "Profile photo";
|
||||||
"lng_settings_sessions_about" = "Control your sessions on other devices.";
|
"lng_settings_sessions_about" = "Control your sessions on other devices.";
|
||||||
"lng_settings_passcode_disable" = "Disable passcode";
|
"lng_settings_passcode_disable" = "Disable passcode";
|
||||||
"lng_settings_password_disable" = "Disable cloud password";
|
"lng_settings_password_disable" = "Disable cloud password";
|
||||||
|
@ -640,6 +642,23 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_edit_privacy_calls_p2p_contacts" = "My contacts";
|
"lng_edit_privacy_calls_p2p_contacts" = "My contacts";
|
||||||
"lng_edit_privacy_calls_p2p_nobody" = "Nobody";
|
"lng_edit_privacy_calls_p2p_nobody" = "Nobody";
|
||||||
|
|
||||||
|
"lng_edit_privacy_forwards_title" = "Forwarded messages privacy";
|
||||||
|
"lng_edit_privacy_forwards_header" = "Who can add link to my account when forwarding my messages";
|
||||||
|
"lng_edit_privacy_forwards_warning" = "When forwarded to other chats, messages you send will not link back to your account.";
|
||||||
|
"lng_edit_privacy_forwards_always_empty" = "Always allow";
|
||||||
|
"lng_edit_privacy_forwards_never_empty" = "Never allow";
|
||||||
|
"lng_edit_privacy_forwards_exceptions" = "These settings will override the values above.";
|
||||||
|
"lng_edit_privacy_forwards_always_title" = "Always allow";
|
||||||
|
"lng_edit_privacy_forwards_never_title" = "Never allow";
|
||||||
|
|
||||||
|
"lng_edit_privacy_profile_photo_title" = "Profile photo privacy";
|
||||||
|
"lng_edit_privacy_profile_photo_header" = "Who can see my profile photo";
|
||||||
|
"lng_edit_privacy_profile_photo_always_empty" = "Always allow";
|
||||||
|
"lng_edit_privacy_profile_photo_never_empty" = "Never allow";
|
||||||
|
"lng_edit_privacy_profile_photo_exceptions" = "These settings will override the values above.";
|
||||||
|
"lng_edit_privacy_profile_photo_always_title" = "Always allow";
|
||||||
|
"lng_edit_privacy_profile_photo_never_title" = "Never allow";
|
||||||
|
|
||||||
"lng_self_destruct_title" = "Account self-destruction";
|
"lng_self_destruct_title" = "Account self-destruction";
|
||||||
"lng_self_destruct_description" = "If you don't come online at least once within this period, your account will be deleted along with all groups, messages and contacts.";
|
"lng_self_destruct_description" = "If you don't come online at least once within this period, your account will be deleted along with all groups, messages and contacts.";
|
||||||
"lng_self_destruct_months#one" = "{count} month";
|
"lng_self_destruct_months#one" = "{count} month";
|
||||||
|
|
|
@ -176,6 +176,10 @@ MTPInputPrivacyKey ApiWrap::Privacy::Input(Key key) {
|
||||||
return MTP_inputPrivacyKeyStatusTimestamp();
|
return MTP_inputPrivacyKeyStatusTimestamp();
|
||||||
case Privacy::Key::CallsPeer2Peer:
|
case Privacy::Key::CallsPeer2Peer:
|
||||||
return MTP_inputPrivacyKeyPhoneP2P();
|
return MTP_inputPrivacyKeyPhoneP2P();
|
||||||
|
case Privacy::Key::Forwards:
|
||||||
|
return MTP_inputPrivacyKeyForwards();
|
||||||
|
case Privacy::Key::ProfilePhoto:
|
||||||
|
return MTP_inputPrivacyKeyProfilePhoto();
|
||||||
}
|
}
|
||||||
Unexpected("Key in ApiWrap::Privacy::Input.");
|
Unexpected("Key in ApiWrap::Privacy::Input.");
|
||||||
}
|
}
|
||||||
|
@ -2211,6 +2215,10 @@ void ApiWrap::handlePrivacyChange(
|
||||||
case mtpc_inputPrivacyKeyPhoneCall: return Key::Calls;
|
case mtpc_inputPrivacyKeyPhoneCall: return Key::Calls;
|
||||||
case mtpc_privacyKeyPhoneP2P:
|
case mtpc_privacyKeyPhoneP2P:
|
||||||
case mtpc_inputPrivacyKeyPhoneP2P: return Key::CallsPeer2Peer;
|
case mtpc_inputPrivacyKeyPhoneP2P: return Key::CallsPeer2Peer;
|
||||||
|
case mtpc_privacyKeyForwards:
|
||||||
|
case mtpc_inputPrivacyKeyForwards: return Key::Forwards;
|
||||||
|
case mtpc_privacyKeyProfilePhoto:
|
||||||
|
case mtpc_inputPrivacyKeyProfilePhoto: return Key::ProfilePhoto;
|
||||||
}
|
}
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}();
|
}();
|
||||||
|
|
|
@ -379,6 +379,8 @@ public:
|
||||||
Calls,
|
Calls,
|
||||||
Invites,
|
Invites,
|
||||||
CallsPeer2Peer,
|
CallsPeer2Peer,
|
||||||
|
Forwards,
|
||||||
|
ProfilePhoto,
|
||||||
};
|
};
|
||||||
enum class Option {
|
enum class Option {
|
||||||
Everyone,
|
Everyone,
|
||||||
|
|
|
@ -85,6 +85,7 @@ settingsSubsectionTitle: FlatLabel(defaultFlatLabel) {
|
||||||
linkFontOver: font(boxFontSize semibold underline);
|
linkFontOver: font(boxFontSize semibold underline);
|
||||||
}
|
}
|
||||||
textFg: windowActiveTextFg;
|
textFg: windowActiveTextFg;
|
||||||
|
minWidth: 240px;
|
||||||
}
|
}
|
||||||
settingsSubsectionTitlePadding: margins(22px, 7px, 10px, 9px);
|
settingsSubsectionTitlePadding: margins(22px, 7px, 10px, 9px);
|
||||||
settingsBackgroundPadding: margins(22px, 11px, 10px, 12px);
|
settingsBackgroundPadding: margins(22px, 11px, 10px, 12px);
|
||||||
|
|
|
@ -290,7 +290,11 @@ void LastSeenPrivacyController::confirmSave(bool someAreDisallowed, FnMut<void()
|
||||||
Auth().settings().setLastSeenWarningSeen(true);
|
Auth().settings().setLastSeenWarningSeen(true);
|
||||||
Local::writeUserSettings();
|
Local::writeUserSettings();
|
||||||
};
|
};
|
||||||
auto box = Box<ConfirmBox>(lang(lng_edit_privacy_lastseen_warning), lang(lng_continue), lang(lng_cancel), std::move(callback));
|
auto box = Box<ConfirmBox>(
|
||||||
|
lang(lng_edit_privacy_lastseen_warning),
|
||||||
|
lang(lng_continue),
|
||||||
|
lang(lng_cancel),
|
||||||
|
std::move(callback));
|
||||||
*weakBox = Ui::show(std::move(box), LayerOption::KeepOther);
|
*weakBox = Ui::show(std::move(box), LayerOption::KeepOther);
|
||||||
} else {
|
} else {
|
||||||
saveCallback();
|
saveCallback();
|
||||||
|
@ -427,4 +431,84 @@ rpl::producer<QString> CallsPeer2PeerPrivacyController::exceptionsDescription()
|
||||||
return Lang::Viewer(lng_edit_privacy_calls_p2p_exceptions);
|
return Lang::Viewer(lng_edit_privacy_calls_p2p_exceptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ApiWrap::Privacy::Key ForwardsPrivacyController::key() {
|
||||||
|
return Key::Forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
MTPInputPrivacyKey ForwardsPrivacyController::apiKey() {
|
||||||
|
return MTP_inputPrivacyKeyForwards();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ForwardsPrivacyController::title() {
|
||||||
|
return lang(lng_edit_privacy_forwards_title);
|
||||||
|
}
|
||||||
|
|
||||||
|
LangKey ForwardsPrivacyController::optionsTitleKey() {
|
||||||
|
return lng_edit_privacy_forwards_header;
|
||||||
|
}
|
||||||
|
|
||||||
|
rpl::producer<QString> ForwardsPrivacyController::warning() {
|
||||||
|
return Lang::Viewer(lng_edit_privacy_forwards_warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
LangKey ForwardsPrivacyController::exceptionButtonTextKey(
|
||||||
|
Exception exception) {
|
||||||
|
switch (exception) {
|
||||||
|
case Exception::Always: return lng_edit_privacy_forwards_always_empty;
|
||||||
|
case Exception::Never: return lng_edit_privacy_forwards_never_empty;
|
||||||
|
}
|
||||||
|
Unexpected("Invalid exception value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ForwardsPrivacyController::exceptionBoxTitle(Exception exception) {
|
||||||
|
switch (exception) {
|
||||||
|
case Exception::Always: return lang(lng_edit_privacy_forwards_always_title);
|
||||||
|
case Exception::Never: return lang(lng_edit_privacy_forwards_never_title);
|
||||||
|
}
|
||||||
|
Unexpected("Invalid exception value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ForwardsPrivacyController::exceptionsDescription()
|
||||||
|
-> rpl::producer<QString> {
|
||||||
|
return Lang::Viewer(lng_edit_privacy_forwards_exceptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiWrap::Privacy::Key ProfilePhotoPrivacyController::key() {
|
||||||
|
return Key::ProfilePhoto;
|
||||||
|
}
|
||||||
|
|
||||||
|
MTPInputPrivacyKey ProfilePhotoPrivacyController::apiKey() {
|
||||||
|
return MTP_inputPrivacyKeyProfilePhoto();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProfilePhotoPrivacyController::title() {
|
||||||
|
return lang(lng_edit_privacy_profile_photo_title);
|
||||||
|
}
|
||||||
|
|
||||||
|
LangKey ProfilePhotoPrivacyController::optionsTitleKey() {
|
||||||
|
return lng_edit_privacy_profile_photo_header;
|
||||||
|
}
|
||||||
|
|
||||||
|
LangKey ProfilePhotoPrivacyController::exceptionButtonTextKey(
|
||||||
|
Exception exception) {
|
||||||
|
switch (exception) {
|
||||||
|
case Exception::Always: return lng_edit_privacy_profile_photo_always_empty;
|
||||||
|
case Exception::Never: return lng_edit_privacy_profile_photo_never_empty;
|
||||||
|
}
|
||||||
|
Unexpected("Invalid exception value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProfilePhotoPrivacyController::exceptionBoxTitle(Exception exception) {
|
||||||
|
switch (exception) {
|
||||||
|
case Exception::Always: return lang(lng_edit_privacy_profile_photo_always_title);
|
||||||
|
case Exception::Never: return lang(lng_edit_privacy_profile_photo_never_title);
|
||||||
|
}
|
||||||
|
Unexpected("Invalid exception value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ProfilePhotoPrivacyController::exceptionsDescription()
|
||||||
|
-> rpl::producer<QString> {
|
||||||
|
return Lang::Viewer(lng_edit_privacy_profile_photo_exceptions);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
|
|
|
@ -36,7 +36,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LastSeenPrivacyController : public EditPrivacyBox::Controller, private base::Subscriber {
|
class LastSeenPrivacyController : public EditPrivacyBox::Controller {
|
||||||
public:
|
public:
|
||||||
using Option = EditPrivacyBox::Option;
|
using Option = EditPrivacyBox::Option;
|
||||||
using Exception = EditPrivacyBox::Exception;
|
using Exception = EditPrivacyBox::Exception;
|
||||||
|
@ -55,7 +55,7 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GroupsInvitePrivacyController : public EditPrivacyBox::Controller, private base::Subscriber {
|
class GroupsInvitePrivacyController : public EditPrivacyBox::Controller {
|
||||||
public:
|
public:
|
||||||
using Option = EditPrivacyBox::Option;
|
using Option = EditPrivacyBox::Option;
|
||||||
using Exception = EditPrivacyBox::Exception;
|
using Exception = EditPrivacyBox::Exception;
|
||||||
|
@ -72,7 +72,7 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CallsPrivacyController : public EditPrivacyBox::Controller, private base::Subscriber {
|
class CallsPrivacyController : public EditPrivacyBox::Controller {
|
||||||
public:
|
public:
|
||||||
using Option = EditPrivacyBox::Option;
|
using Option = EditPrivacyBox::Option;
|
||||||
using Exception = EditPrivacyBox::Exception;
|
using Exception = EditPrivacyBox::Exception;
|
||||||
|
@ -88,7 +88,7 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CallsPeer2PeerPrivacyController : public EditPrivacyBox::Controller, private base::Subscriber {
|
class CallsPeer2PeerPrivacyController : public EditPrivacyBox::Controller {
|
||||||
public:
|
public:
|
||||||
using Option = EditPrivacyBox::Option;
|
using Option = EditPrivacyBox::Option;
|
||||||
using Exception = EditPrivacyBox::Exception;
|
using Exception = EditPrivacyBox::Exception;
|
||||||
|
@ -106,4 +106,37 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ForwardsPrivacyController : public EditPrivacyBox::Controller {
|
||||||
|
public:
|
||||||
|
using Option = EditPrivacyBox::Option;
|
||||||
|
using Exception = EditPrivacyBox::Exception;
|
||||||
|
|
||||||
|
Key key() override;
|
||||||
|
MTPInputPrivacyKey apiKey() override;
|
||||||
|
|
||||||
|
QString title() override;
|
||||||
|
LangKey optionsTitleKey() override;
|
||||||
|
rpl::producer<QString> warning() override;
|
||||||
|
LangKey exceptionButtonTextKey(Exception exception) override;
|
||||||
|
QString exceptionBoxTitle(Exception exception) override;
|
||||||
|
rpl::producer<QString> exceptionsDescription() override;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class ProfilePhotoPrivacyController : public EditPrivacyBox::Controller {
|
||||||
|
public:
|
||||||
|
using Option = EditPrivacyBox::Option;
|
||||||
|
using Exception = EditPrivacyBox::Exception;
|
||||||
|
|
||||||
|
Key key() override;
|
||||||
|
MTPInputPrivacyKey apiKey() override;
|
||||||
|
|
||||||
|
QString title() override;
|
||||||
|
LangKey optionsTitleKey() override;
|
||||||
|
LangKey exceptionButtonTextKey(Exception exception) override;
|
||||||
|
QString exceptionBoxTitle(Exception exception) override;
|
||||||
|
rpl::producer<QString> exceptionsDescription() override;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
|
|
|
@ -139,6 +139,14 @@ void SetupPrivacy(not_null<Ui::VerticalLayout*> container) {
|
||||||
lng_settings_last_seen,
|
lng_settings_last_seen,
|
||||||
Privacy::Key::LastSeen,
|
Privacy::Key::LastSeen,
|
||||||
[] { return std::make_unique<LastSeenPrivacyController>(); });
|
[] { return std::make_unique<LastSeenPrivacyController>(); });
|
||||||
|
add(
|
||||||
|
lng_settings_forwards_privacy,
|
||||||
|
Privacy::Key::Forwards,
|
||||||
|
[] { return std::make_unique<ForwardsPrivacyController>(); });
|
||||||
|
add(
|
||||||
|
lng_settings_profile_photo_privacy,
|
||||||
|
Privacy::Key::ProfilePhoto,
|
||||||
|
[] { return std::make_unique<ProfilePhotoPrivacyController>(); });
|
||||||
add(
|
add(
|
||||||
lng_settings_calls,
|
lng_settings_calls,
|
||||||
Privacy::Key::Calls,
|
Privacy::Key::Calls,
|
||||||
|
|
Loading…
Reference in New Issue