2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 08:55:59 +00:00

Allow disabling pinned messages notifications.

Fixes #1864.
This commit is contained in:
John Preston
2019-05-28 16:53:36 +02:00
parent e0d4884351
commit af85aec33b
6 changed files with 49 additions and 3 deletions

View File

@@ -565,6 +565,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
AddDivider(container);
AddSkip(container, st::settingsCheckboxesSkip);
AddSubsectionTitle(container, lng_settings_events_title);
const auto joined = addCheckbox(
lng_settings_events_joined,
!Auth().api().contactSignupSilentCurrent().value_or(false));
@@ -580,6 +581,21 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
Auth().api().saveContactSignupSilent(!enabled);
}, joined->lifetime());
const auto pinned = addCheckbox(
lng_settings_events_pinned,
Auth().settings().notifyAboutPinned());
Auth().settings().notifyAboutPinnedChanges(
) | rpl::start_with_next([=](bool notify) {
pinned->setChecked(notify);
}, pinned->lifetime());
pinned->checkedChanges(
) | rpl::filter([](bool notify) {
return (notify != Auth().settings().notifyAboutPinned());
}) | rpl::start_with_next([=](bool notify) {
Auth().settings().setNotifyAboutPinned(notify);
Auth().saveSettingsDelayed();
}, joined->lifetime());
const auto nativeKey = [&] {
if (!Platform::Notifications::Supported()) {
return LangKey();