2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Add 'Count unread messages' option.

This commit is contained in:
John Preston
2018-12-04 14:32:06 +04:00
parent 71efd10c83
commit 6562a1f6af
21 changed files with 353 additions and 119 deletions

View File

@@ -545,7 +545,10 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
Global::SoundNotify());
const auto muted = addCheckbox(
lng_settings_include_muted,
Global::IncludeMuted());
Auth().settings().includeMutedCounter());
const auto count = addCheckbox(
lng_settings_count_unread,
Auth().settings().countUnreadMessages());
const auto nativeNotificationsKey = [&] {
if (!Platform::Notifications::Supported()) {
@@ -644,12 +647,21 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
base::ObservableViewer(
muted->checkedChanged
) | rpl::filter([](bool checked) {
return (checked != Global::IncludeMuted());
return (checked != Auth().settings().includeMutedCounter());
}) | rpl::start_with_next([=](bool checked) {
Global::SetIncludeMuted(checked);
Auth().settings().setIncludeMutedCounter(checked);
changed(Change::IncludeMuted);
}, muted->lifetime());
base::ObservableViewer(
count->checkedChanged
) | rpl::filter([](bool checked) {
return (checked != Auth().settings().countUnreadMessages());
}) | rpl::start_with_next([=](bool checked) {
Auth().settings().setCountUnreadMessages(checked);
changed(Change::CountMessages);
}, muted->lifetime());
base::ObservableViewer(
Auth().notifications().settingsChanged()
) | rpl::start_with_next([=](Change change) {