From 95f18f212000c5f648ab60fed0ef885564556f6d Mon Sep 17 00:00:00 2001 From: ZavaruKitsu Date: Fri, 10 Nov 2023 18:31:59 +0300 Subject: [PATCH] fix: tray and serialization --- Telegram/SourceFiles/ayu/ayu_settings.h | 1 + .../ayu/ui/settings/settings_ayu.cpp | 16 --------- Telegram/SourceFiles/tray.cpp | 36 ++++++++++--------- 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/Telegram/SourceFiles/ayu/ayu_settings.h b/Telegram/SourceFiles/ayu/ayu_settings.h index 992bf38be9c8ae..af830a06be418f 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.h +++ b/Telegram/SourceFiles/ayu/ayu_settings.h @@ -221,6 +221,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( localPremium, copyUsernameAsLink, appIcon, + simpleQuotesAndReplies, deletedMark, editedMark, recentStickersCount, diff --git a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp index 1c02bc483f488d..e868a3d0dc56ff 100644 --- a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp +++ b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp @@ -805,22 +805,6 @@ void Ayu::SetupCustomization(not_null container, AyuSettings::save(); }, container->lifetime()); - AddButton( - container, - tr::ayu_ShowGhostToggleInDrawer(), - st::settingsButtonNoIcon - )->toggleOn( - rpl::single(settings->showGhostToggleInDrawer) - )->toggledValue( - ) | rpl::filter([=](bool enabled) - { - return (enabled != settings->showGhostToggleInDrawer); - }) | start_with_next([=](bool enabled) - { - settings->set_showGhostToggleInDrawer(enabled); - AyuSettings::save(); - }, container->lifetime()); - AddButton( container, tr::ayu_SettingsShowMessageSeconds(), diff --git a/Telegram/SourceFiles/tray.cpp b/Telegram/SourceFiles/tray.cpp index e0c7b7fe7a993a..fd02168b3efca9 100644 --- a/Telegram/SourceFiles/tray.cpp +++ b/Telegram/SourceFiles/tray.cpp @@ -102,23 +102,25 @@ void Tray::rebuildMenu() { auto settings = &AyuSettings::getInstance(); - auto turnGhostModeText = _textUpdates.events( - ) | rpl::map([=] - { - bool ghostModeEnabled = AyuSettings::get_ghostModeEnabled(); - - return ghostModeEnabled - ? tr::ayu_DisableGhostModeTray(tr::now) - : tr::ayu_EnableGhostModeTray(tr::now); - }); - _tray.addAction(std::move(turnGhostModeText), [=] - { - bool ghostMode = AyuSettings::get_ghostModeEnabled(); - - settings->set_ghostModeEnabled(!ghostMode); - - AyuSettings::save(); - }); + if (settings->showGhostToggleInTray) { + auto turnGhostModeText = _textUpdates.events( + ) | rpl::map([=] + { + bool ghostModeEnabled = AyuSettings::get_ghostModeEnabled(); + + return ghostModeEnabled + ? tr::ayu_DisableGhostModeTray(tr::now) + : tr::ayu_EnableGhostModeTray(tr::now); + }); + _tray.addAction(std::move(turnGhostModeText), [=] + { + bool ghostMode = AyuSettings::get_ghostModeEnabled(); + + settings->set_ghostModeEnabled(!ghostMode); + + AyuSettings::save(); + }); + } if (settings->showStreamerToggleInTray) { auto turnStreamerModeText = _textUpdates.events(