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

Show sessions list in a Settings Section.

This commit is contained in:
John Preston
2021-11-29 17:29:45 +04:00
parent 2ad20d6c4a
commit d4c6475ae8
7 changed files with 26 additions and 9 deletions

View File

@@ -780,7 +780,8 @@ void SetupBotsAndWebsites(
void SetupSessionsList(
not_null<Window::SessionController*> controller,
not_null<Ui::VerticalLayout*> container,
rpl::producer<> updateTrigger) {
rpl::producer<> updateTrigger,
Fn<void(Type)> showOther) {
AddSkip(container);
AddSubsectionTitle(container, tr::lng_settings_sessions_title());
@@ -801,7 +802,7 @@ void SetupSessionsList(
std::move(count),
st::settingsButton
)->addClickHandler([=] {
controller->show(Box<SessionsBox>(controller));
showOther(Type::Sessions);
});
AddSkip(container, st::settingsPrivacySecurityPadding);
AddDividerText(container, tr::lng_settings_sessions_about());
@@ -929,6 +930,10 @@ PrivacySecurity::PrivacySecurity(
setupContent(controller);
}
rpl::producer<Type> PrivacySecurity::sectionShowOther() {
return _showOther.events();
}
void PrivacySecurity::setupContent(
not_null<Window::SessionController*> controller) {
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
@@ -941,7 +946,9 @@ void PrivacySecurity::setupContent(
SetupPrivacy(controller, content, trigger());
SetupArchiveAndMute(controller, content);
SetupSessionsList(controller, content, trigger());
SetupSessionsList(controller, content, trigger(), [=](Type type) {
_showOther.fire_copy(type);
});
SetupLocalPasscode(controller, content);
SetupCloudPassword(controller, content);
#if !defined OS_MAC_STORE && !defined OS_WIN_STORE