diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 7605dd5835..f2dd1fc894 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -4835,12 +4835,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "ayu_KeepAliveService" = "AyuGram Push Service"; "ayu_DisableAds" = "Disable ads"; "ayu_DisableStories" = "Disable stories"; +"ayu_DisableCustomBackgrounds" = "Disable custom backgrounds"; "ayu_DisableNotificationsDelay" = "Disable notify delay"; "ayu_LocalPremium" = "Local Telegram Premium"; "ayu_CopyUsernameAsLink" = "Copy username as link"; "ayu_CustomizationHeader" = "Customization"; "ayu_DeletedMarkText" = "Deleted mark"; +"ayu_DeletedMarkNothing" = "Nothing"; +"ayu_DeletedMarkTrashBin" = "Trash Bin"; +"ayu_DeletedMarkCross" = "Cross"; +"ayu_DeletedMarkEyeCrossed" = "Eye crossed"; "ayu_EditedMarkText" = "Edited mark"; +"ayu_SemiTransparentDeletedMessages" = "Semi-transparent deleted messages"; "ayu_HideNotificationCounters" = "Hide notification counters"; "ayu_HideAllChats" = "Hide \"All chats\" folder"; "ayu_ShowGhostToggleInDrawer" = "Show ghost mode toggle"; diff --git a/Telegram/SourceFiles/ayu/ayu_settings.cpp b/Telegram/SourceFiles/ayu/ayu_settings.cpp index ff9ccb27e4..21ecc27ccb 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.cpp +++ b/Telegram/SourceFiles/ayu/ayu_settings.cpp @@ -200,6 +200,7 @@ AyuGramSettings::AyuGramSettings() { // ~ QoL toggles disableAds = true; disableStories = false; + disableCustomBackgrounds = true; collapseSimilarChannels = true; hideSimilarChannels = false; @@ -326,6 +327,10 @@ void AyuGramSettings::set_disableStories(bool val) { disableStories = val; } +void AyuGramSettings::set_disableCustomBackgrounds(bool val) { + disableCustomBackgrounds = val; +} + void AyuGramSettings::set_collapseSimilarChannels(bool val) { collapseSimilarChannels = val; } diff --git a/Telegram/SourceFiles/ayu/ayu_settings.h b/Telegram/SourceFiles/ayu/ayu_settings.h index 1a4c4d9703..f72f5b941f 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.h +++ b/Telegram/SourceFiles/ayu/ayu_settings.h @@ -33,6 +33,7 @@ public: bool disableAds; bool disableStories; + bool disableCustomBackgrounds; bool collapseSimilarChannels; bool hideSimilarChannels; @@ -94,6 +95,7 @@ public: void set_disableAds(bool val); void set_disableStories(bool val); + void set_disableCustomBackgrounds(bool val); void set_collapseSimilarChannels(bool val); void set_hideSimilarChannels(bool val); @@ -153,6 +155,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( saveMessagesHistory, disableAds, disableStories, + disableCustomBackgrounds, collapseSimilarChannels, hideSimilarChannels, uploadSpeedBoost, diff --git a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp index 4a09c20aa1..f56c8223d1 100644 --- a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp +++ b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp @@ -595,6 +595,25 @@ void SetupQoLToggles(not_null container) { }, container->lifetime()); + AddButtonWithIcon( + container, + tr::ayu_DisableCustomBackgrounds(), + st::settingsButtonNoIcon + )->toggleOn( + rpl::single(settings->disableCustomBackgrounds) + )->toggledValue( + ) | rpl::filter( + [=](bool enabled) + { + return (enabled != settings->disableCustomBackgrounds); + }) | start_with_next( + [=](bool enabled) + { + settings->set_disableCustomBackgrounds(enabled); + AyuSettings::save(); + }, + container->lifetime()); + AddButtonWithIcon( container, tr::ayu_SimpleQuotesAndReplies(), diff --git a/Telegram/SourceFiles/window/section_widget.cpp b/Telegram/SourceFiles/window/section_widget.cpp index dcba6476c9..ddc2a1e86c 100644 --- a/Telegram/SourceFiles/window/section_widget.cpp +++ b/Telegram/SourceFiles/window/section_widget.cpp @@ -32,6 +32,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include +// AyuGram includes +#include "ayu/ayu_settings.h" + + namespace Window { namespace { @@ -471,6 +475,12 @@ auto ChatThemeValueFromPeer( peer ) | rpl::map([=](ResolvedTheme resolved) -> rpl::producer> { + const auto settings = &AyuSettings::getInstance(); + // this check ensures that background is not a pattern wallpaper in a private chat + if (settings->disableCustomBackgrounds && resolved.paper && resolved.paper->media) { + resolved.paper = std::nullopt; + } + if (!resolved.theme && !resolved.paper) { return rpl::single(controller->defaultChatTheme()); }