mirror of https://github.com/procxx/kepka.git
Improve privacy and security settings subsections.
This commit is contained in:
parent
f582fbf010
commit
5c7155c3a5
|
@ -340,7 +340,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_settings_calls" = "Calls";
|
||||
"lng_settings_groups_invite" = "Groups";
|
||||
"lng_settings_group_privacy_about" = "Change who can add you to groups and channel.";
|
||||
"lng_settings_security_title" = "Security";
|
||||
"lng_settings_sessions_about" = "Control your sessions on other devices.";
|
||||
"lng_settings_passcode_disable" = "Disable passcode";
|
||||
"lng_settings_password_disable" = "Disable cloud password";
|
||||
|
@ -357,6 +356,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_settings_stickers_emoji" = "Stickers and emoji";
|
||||
"lng_settings_themes" = "Themes";
|
||||
"lng_settings_chat_other" = "Other";
|
||||
"lng_settings_information" = "Edit profile";
|
||||
"lng_settings_passcode_title" = "Local passcode";
|
||||
"lng_settings_password_title" = "Two-step verification";
|
||||
"lng_settings_sessions_title" = "Active sessions";
|
||||
"lng_settings_destroy_title" = "Delete my account";
|
||||
|
||||
"lng_backgrounds_header" = "Choose your new chat background";
|
||||
"lng_theme_sure_keep" = "Keep this theme?";
|
||||
|
|
|
@ -20,10 +20,13 @@ settingsGeneralButton: InfoProfileButton(settingsSectionButton) {
|
|||
settingsButton: InfoProfileButton(settingsSectionButton) {
|
||||
padding: margins(22px, 13px, 22px, 11px);
|
||||
}
|
||||
settingsPrivacyButton: InfoProfileButton(settingsButton) {
|
||||
padding: margins(22px, 10px, 22px, 8px);
|
||||
}
|
||||
settingsSectionSkip: 9px;
|
||||
settingsSectionIconLeft: 22px;
|
||||
settingsSeparatorPadding: margins(22px, infoProfileSkip, 0px, infoProfileSkip);
|
||||
settingsButtonRightPosition: point(28px, 13px);
|
||||
settingsButtonRightSkip: 28px;
|
||||
settingsButtonRight: FlatLabel(defaultFlatLabel) {
|
||||
textFg: windowActiveTextFg;
|
||||
style: boxTextStyle;
|
||||
|
@ -85,12 +88,13 @@ settingsSubsectionTitle: FlatLabel(defaultFlatLabel) {
|
|||
}
|
||||
textFg: windowActiveTextFg;
|
||||
}
|
||||
settingsSubsectionTitlePadding: margins(22px, 7px, 10px, 6px);
|
||||
settingsSubsectionTitlePadding: margins(22px, 7px, 10px, 9px);
|
||||
settingsBackgroundPadding: margins(22px, 11px, 10px, 12px);
|
||||
settingsTileSkip: 15px;
|
||||
settingsFromGalleryTop: 2px;
|
||||
settingsFromFileTop: 14px;
|
||||
settingsPrivacySecurityPadding: 12px;
|
||||
settingsPrivacySkip: 14px;
|
||||
|
||||
settingsCloudPasswordLabel: FlatLabel(defaultFlatLabel) {
|
||||
textFg: windowSubTextFg;
|
||||
|
|
|
@ -119,7 +119,8 @@ not_null<Button*> AddButton(
|
|||
|
||||
void CreateRightLabel(
|
||||
not_null<Button*> button,
|
||||
rpl::producer<QString> label) {
|
||||
rpl::producer<QString> label,
|
||||
const style::InfoProfileButton &st) {
|
||||
const auto name = Ui::CreateChild<Ui::FlatLabel>(
|
||||
button.get(),
|
||||
std::move(label),
|
||||
|
@ -128,9 +129,7 @@ void CreateRightLabel(
|
|||
name->widthValue(),
|
||||
button->widthValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
name->moveToRight(
|
||||
st::settingsButtonRightPosition.x(),
|
||||
st::settingsButtonRightPosition.y());
|
||||
name->moveToRight(st::settingsButtonRightSkip, st.padding.top());
|
||||
}, name->lifetime());
|
||||
name->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
}
|
||||
|
@ -142,7 +141,7 @@ not_null<Button*> AddButtonWithLabel(
|
|||
const style::InfoProfileButton &st,
|
||||
const style::icon *leftIcon) {
|
||||
const auto button = AddButton(container, text, st, leftIcon);
|
||||
CreateRightLabel(button, std::move(label));
|
||||
CreateRightLabel(button, std::move(label), st);
|
||||
return button;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,8 @@ not_null<Button*> AddButtonWithLabel(
|
|||
const style::icon *leftIcon = nullptr);
|
||||
void CreateRightLabel(
|
||||
not_null<Button*> button,
|
||||
rpl::producer<QString> label);
|
||||
rpl::producer<QString> label,
|
||||
const style::InfoProfileButton &st);
|
||||
void AddSubsectionTitle(
|
||||
not_null<Ui::VerticalLayout*> conatiner,
|
||||
LangKey text);
|
||||
|
|
|
@ -57,7 +57,7 @@ void SetupSections(
|
|||
)->addClickHandler([=] { showOther(type); });
|
||||
};
|
||||
addSection(
|
||||
lng_settings_section_info,
|
||||
lng_settings_information,
|
||||
Type::Information,
|
||||
&st::settingsIconInformation);
|
||||
addSection(
|
||||
|
|
|
@ -57,13 +57,13 @@ QString PrivacyBase(ApiWrap::Privacy::Option option) {
|
|||
}
|
||||
|
||||
void SetupPrivacy(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container);
|
||||
|
||||
AddSkip(container, st::settingsPrivacySkip);
|
||||
AddSubsectionTitle(container, lng_settings_privacy_title);
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_blocked_users,
|
||||
st::settingsButton
|
||||
st::settingsPrivacyButton
|
||||
)->addClickHandler([] {
|
||||
const auto initBox = [](not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_close), [=] {
|
||||
|
@ -103,7 +103,7 @@ void SetupPrivacy(not_null<Ui::VerticalLayout*> container) {
|
|||
container,
|
||||
label,
|
||||
PrivacyString(key),
|
||||
st::settingsButton
|
||||
st::settingsPrivacyButton
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<EditPrivacyBox>(
|
||||
controller(),
|
||||
|
@ -138,8 +138,10 @@ not_null<Ui::SlideWrap<Ui::PlainShadow>*> AddSeparator(
|
|||
st::settingsSeparatorPadding));
|
||||
}
|
||||
|
||||
rpl::producer<bool> SetupLocalPasscode(
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
void SetupLocalPasscode(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, lng_settings_passcode_title);
|
||||
|
||||
auto has = PasscodeChanges(
|
||||
) | rpl::map([] {
|
||||
return Global::LocalPasscode();
|
||||
|
@ -155,7 +157,7 @@ rpl::producer<bool> SetupLocalPasscode(
|
|||
object_ptr<Button>(
|
||||
container,
|
||||
std::move(text),
|
||||
st::settingsButton)
|
||||
st::settingsPrivacyButton)
|
||||
)->addClickHandler([] {
|
||||
Ui::show(Box<PasscodeBox>(false));
|
||||
});
|
||||
|
@ -169,7 +171,7 @@ rpl::producer<bool> SetupLocalPasscode(
|
|||
object_ptr<Button>(
|
||||
inner,
|
||||
Lang::Viewer(lng_settings_passcode_disable),
|
||||
st::settingsButton)
|
||||
st::settingsPrivacyButton)
|
||||
)->addClickHandler([] {
|
||||
Ui::show(Box<PasscodeBox>(true));
|
||||
});
|
||||
|
@ -189,15 +191,15 @@ rpl::producer<bool> SetupLocalPasscode(
|
|||
object_ptr<Button>(
|
||||
inner,
|
||||
Lang::Viewer(label),
|
||||
st::settingsButton));
|
||||
CreateRightLabel(autolock, std::move(value));
|
||||
st::settingsPrivacyButton));
|
||||
CreateRightLabel(autolock, std::move(value), st::settingsPrivacyButton);
|
||||
autolock->addClickHandler([] {
|
||||
Ui::show(Box<AutoLockBox>());
|
||||
});
|
||||
|
||||
wrap->toggleOn(base::duplicate(has));
|
||||
|
||||
return has;
|
||||
AddSkip(container);
|
||||
}
|
||||
|
||||
bool CheckEditCloudPassword() {
|
||||
|
@ -264,8 +266,11 @@ void RemoveCloudPassword() {
|
|||
}, box->lifetime());
|
||||
}
|
||||
|
||||
rpl::producer<bool> SetupCloudPassword(
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
void SetupCloudPassword(not_null<Ui::VerticalLayout*> container) {
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, lng_settings_password_title);
|
||||
|
||||
using State = Core::CloudPasswordState;
|
||||
|
||||
auto has = rpl::single(
|
||||
|
@ -304,12 +309,12 @@ rpl::producer<bool> SetupCloudPassword(
|
|||
base::duplicate(confirmation),
|
||||
st::settingsCloudPasswordLabel),
|
||||
QMargins(
|
||||
st::settingsButton.padding.left(),
|
||||
st::settingsButton.padding.top(),
|
||||
st::settingsButton.padding.right(),
|
||||
(st::settingsButton.height
|
||||
st::settingsPrivacyButton.padding.left(),
|
||||
st::settingsPrivacyButton.padding.top(),
|
||||
st::settingsPrivacyButton.padding.right(),
|
||||
(st::settingsPrivacyButton.height
|
||||
- st::settingsCloudPasswordLabel.style.font->height
|
||||
+ st::settingsButton.padding.bottom()))));
|
||||
+ st::settingsPrivacyButton.padding.bottom()))));
|
||||
label->toggleOn(base::duplicate(unconfirmed))->setDuration(0);
|
||||
|
||||
std::move(
|
||||
|
@ -331,7 +336,7 @@ rpl::producer<bool> SetupCloudPassword(
|
|||
object_ptr<Button>(
|
||||
container,
|
||||
std::move(text),
|
||||
st::settingsButton)));
|
||||
st::settingsPrivacyButton)));
|
||||
change->toggleOn(std::move(
|
||||
unconfirmed
|
||||
) | rpl::map([](bool unconfirmed) {
|
||||
|
@ -349,7 +354,7 @@ rpl::producer<bool> SetupCloudPassword(
|
|||
object_ptr<Button>(
|
||||
container,
|
||||
Lang::Viewer(lng_settings_password_disable),
|
||||
st::settingsButton)));
|
||||
st::settingsPrivacyButton)));
|
||||
disable->toggleOn(base::duplicate(has));
|
||||
disable->entity()->addClickHandler([] {
|
||||
if (CheckEditCloudPassword()) {
|
||||
|
@ -369,48 +374,37 @@ rpl::producer<bool> SetupCloudPassword(
|
|||
reloadOnActivation);
|
||||
|
||||
Auth().api().reloadPasswordState();
|
||||
return has;
|
||||
|
||||
AddSkip(container);
|
||||
}
|
||||
|
||||
void SetupSelfDestruction(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, lng_settings_destroy_title);
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_self_destruct,
|
||||
st::settingsButton
|
||||
st::settingsPrivacyButton
|
||||
)->addClickHandler([] {
|
||||
Ui::show(Box<SelfDestructionBox>());
|
||||
});
|
||||
|
||||
AddSkip(container);
|
||||
}
|
||||
|
||||
void SetupSessionsList(not_null<Ui::VerticalLayout*> container) {
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
AddSubsectionTitle(container, lng_settings_sessions_title);
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
lng_settings_show_sessions,
|
||||
st::settingsButton
|
||||
st::settingsPrivacyButton
|
||||
)->addClickHandler([] {
|
||||
Ui::show(Box<SessionsBox>());
|
||||
});
|
||||
}
|
||||
|
||||
void SetupSecurity(not_null<Ui::VerticalLayout*> container) {
|
||||
AddSkip(container);
|
||||
|
||||
AddSubsectionTitle(container, lng_settings_security_title);
|
||||
|
||||
auto passcodeWide = SetupLocalPasscode(container);
|
||||
auto separator1 = AddSeparator(container);
|
||||
auto passwordWide = SetupCloudPassword(container);
|
||||
auto separator2 = AddSeparator(container);
|
||||
separator1->toggleOn(rpl::combine(
|
||||
std::move(passcodeWide),
|
||||
base::duplicate(passwordWide)
|
||||
) | rpl::map([](bool one, bool second) {
|
||||
return one || second;
|
||||
}));
|
||||
separator2->toggleOn(std::move(passwordWide));
|
||||
SetupSelfDestruction(container);
|
||||
SetupSessionsList(container);
|
||||
|
||||
AddSkip(container, st::settingsPrivacySecurityPadding);
|
||||
AddDividerText(
|
||||
container,
|
||||
|
@ -418,8 +412,8 @@ void SetupSecurity(not_null<Ui::VerticalLayout*> container) {
|
|||
}
|
||||
|
||||
void SetupCalls(not_null<Ui::VerticalLayout*> container) {
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
AddSubsectionTitle(container, lng_settings_calls_title);
|
||||
|
||||
using Privacy = ApiWrap::Privacy;
|
||||
|
@ -441,7 +435,7 @@ void SetupCalls(not_null<Ui::VerticalLayout*> container) {
|
|||
container,
|
||||
lng_settings_peer_to_peer,
|
||||
std::move(text),
|
||||
st::settingsButton
|
||||
st::settingsPrivacyButton
|
||||
)->addClickHandler([=] {
|
||||
Ui::show(Box<EditCallsPeerToPeer>());
|
||||
});
|
||||
|
@ -458,7 +452,7 @@ void SetupExport(not_null<Ui::VerticalLayout*> container) {
|
|||
AddButton(
|
||||
container,
|
||||
lng_settings_export_data,
|
||||
st::settingsButton
|
||||
st::settingsPrivacyButton
|
||||
)->addClickHandler([] {
|
||||
Ui::hideSettingsAndLayer();
|
||||
App::CallDelayed(
|
||||
|
@ -482,7 +476,10 @@ void PrivacySecurity::setupContent() {
|
|||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||
|
||||
SetupPrivacy(content);
|
||||
SetupSecurity(content);
|
||||
SetupLocalPasscode(content);
|
||||
SetupCloudPassword(content);
|
||||
SetupSessionsList(content);
|
||||
SetupSelfDestruction(content);
|
||||
SetupCalls(content);
|
||||
SetupExport(content);
|
||||
|
||||
|
|
Loading…
Reference in New Issue