2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Add archive and mute settings editing.

This commit is contained in:
John Preston
2020-07-03 20:53:24 +04:00
parent 060fe6a928
commit 3aea9cb3ca
10 changed files with 243 additions and 6 deletions

View File

@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "api/api_self_destruct.h"
#include "api/api_sensitive_content.h"
#include "api/api_global_privacy.h"
#include "settings/settings_common.h"
#include "settings/settings_privacy_controllers.h"
#include "boxes/peer_list_box.h"
@@ -186,6 +187,49 @@ void SetupPrivacy(
AddDividerText(container, tr::lng_settings_group_privacy_about());
}
void SetupArchiveAndMute(
not_null<Window::SessionController*> controller,
not_null<Ui::VerticalLayout*> container) {
using namespace rpl::mappers;
const auto wrap = container->add(
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
container,
object_ptr<Ui::VerticalLayout>(container)));
const auto inner = wrap->entity();
AddSkip(inner);
AddSubsectionTitle(inner, tr::lng_settings_new_unknown());
const auto session = &controller->session();
const auto privacy = &session->api().globalPrivacy();
privacy->reload();
AddButton(
inner,
tr::lng_settings_auto_archive(),
st::settingsButton
)->toggleOn(
privacy->archiveAndMute()
)->toggledChanges(
) | rpl::filter([=](bool toggled) {
return toggled != privacy->archiveAndMuteCurrent();
}) | rpl::start_with_next([=](bool toggled) {
privacy->update(toggled);
}, container->lifetime());
AddSkip(inner);
AddDividerText(inner, tr::lng_settings_auto_archive_about());
using namespace rpl::mappers;
wrap->toggleOn(rpl::single(
false
) | rpl::then(
session->api().globalPrivacy().showArchiveAndMute(
) | rpl::filter(_1) | rpl::take(1)
));
}
not_null<Ui::SlideWrap<Ui::PlainShadow>*> AddSeparator(
not_null<Ui::VerticalLayout*> container) {
return container->add(
@@ -647,6 +691,7 @@ void PrivacySecurity::setupContent(
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
SetupPrivacy(controller, content);
SetupArchiveAndMute(controller, content);
SetupSessionsList(controller, content);
SetupLocalPasscode(controller, content);
SetupCloudPassword(controller, content);