Skip to content

Commit

Permalink
fix: tray and serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyZavar committed Nov 10, 2023
1 parent ae3dfac commit 95f18f2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 33 deletions.
1 change: 1 addition & 0 deletions Telegram/SourceFiles/ayu/ayu_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
localPremium,
copyUsernameAsLink,
appIcon,
simpleQuotesAndReplies,
deletedMark,
editedMark,
recentStickersCount,
Expand Down
16 changes: 0 additions & 16 deletions Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
36 changes: 19 additions & 17 deletions Telegram/SourceFiles/tray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 95f18f2

Please sign in to comment.