fix: tray and serialization

This commit is contained in:
ZavaruKitsu 2023-11-10 18:31:59 +03:00
parent ae3dfacdf9
commit 95f18f2120
3 changed files with 17 additions and 30 deletions

View file

@ -221,6 +221,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
localPremium,
copyUsernameAsLink,
appIcon,
simpleQuotesAndReplies,
deletedMark,
editedMark,
recentStickersCount,

View file

@ -805,22 +805,6 @@ void Ayu::SetupCustomization(not_null<Ui::VerticalLayout *> 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(),

View file

@ -102,23 +102,25 @@ void Tray::rebuildMenu() {
auto settings = &AyuSettings::getInstance();
auto turnGhostModeText = _textUpdates.events(
) | rpl::map([=]
{
bool ghostModeEnabled = AyuSettings::get_ghostModeEnabled();
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();
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);
settings->set_ghostModeEnabled(!ghostMode);
AyuSettings::save();
});
AyuSettings::save();
});
}
if (settings->showStreamerToggleInTray) {
auto turnStreamerModeText = _textUpdates.events(