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