Update settings_ayu.cpp

This commit is contained in:
Neurotoxin001 2025-07-10 14:38:06 +03:00 committed by GitHub
parent f4c01a6a20
commit 8bea85e597
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -846,44 +846,85 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
}, },
container->lifetime()); container->lifetime());
AddButtonWithIcon( AddSkip(container);
container, AddDivider(container);
tr::ayu_ShowForwardsCount(), AddSkip(container);
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.showForwards)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showForwards);
}) | start_with_next(
[=](bool enabled)
{
AyuSettings::set_showForwards(enabled);
AyuSettings::save();
},
container->lifetime());
AddButtonWithIcon( AddButtonWithIcon(
container, container,
tr::ayu_ShowForwardsRatio(), tr::ayu_HideChannelReactions(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings.showForwardsRatio) rpl::single(!settings->hideChannelReactions)
)->toggledValue( )->toggledValue(
) | rpl::filter( ) | rpl::filter(
[=](bool enabled) [=](bool enabled)
{ {
return (enabled != settings.showForwardsRatio); return (!enabled != settings->hideChannelReactions);
}) | start_with_next( }) | start_with_next(
[=](bool enabled) [=](bool enabled)
{ {
AyuSettings::set_showForwardsRatio(enabled); AyuSettings::set_hideChannelReactions(!enabled);
AyuSettings::save(); AyuSettings::save();
}, },
container->lifetime()); container->lifetime());
AddButtonWithIcon(
container,
tr::ayu_HideGroupReactions(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(!settings->hideGroupReactions)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (!enabled != settings->hideGroupReactions);
}) | start_with_next(
[=](bool enabled)
{
AyuSettings::set_hideGroupReactions(!enabled);
AyuSettings::save();
},
container->lifetime());
AddButtonWithIcon(
container,
tr::ayu_ShowForwardsCount(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.showForwards)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showForwards);
}) | start_with_next(
[=](bool enabled)
{
AyuSettings::set_showForwards(enabled);
AyuSettings::save();
},
container->lifetime());
AddButtonWithIcon(
container,
tr::ayu_ShowForwardsRatio(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings.showForwardsRatio)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings.showForwardsRatio);
}) | start_with_next(
[=](bool enabled)
{
AyuSettings::set_showForwardsRatio(enabled);
AyuSettings::save();
},
container->lifetime());
} }
void SetupAppIcon(not_null<Ui::VerticalLayout*> container) { void SetupAppIcon(not_null<Ui::VerticalLayout*> container) {