diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 9b9af123c7..f15b237683 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -6623,3 +6623,4 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "ayu_AboutText1" = "ToS breaking Telegram client based on {api_link}."; "ayu_UpdateAyuGram" = "Update AyuGram"; "ayu_UtilityRestartRequired" = "App will close in 5 seconds."; +"ayu_ShowOnlyAddedEmojisAndStickers" = "Show Only Added Emojis and Stickers"; diff --git a/Telegram/SourceFiles/ayu/ayu_settings.cpp b/Telegram/SourceFiles/ayu/ayu_settings.cpp index ec208a0df3..cb2e4e0737 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.cpp +++ b/Telegram/SourceFiles/ayu/ayu_settings.cpp @@ -380,6 +380,10 @@ void AyuGramSettings::set_disableCustomBackgrounds(bool val) { disableCustomBackgrounds = val; } +void AyuGramSettings::set_showOnlyAddedEmojisAndStickers(bool val) { + showOnlyAddedEmojisAndStickers = 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 9a614a1e2f..d4e573b5f9 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.h +++ b/Telegram/SourceFiles/ayu/ayu_settings.h @@ -37,6 +37,7 @@ public: bool disableAds; bool disableStories; bool disableCustomBackgrounds; + bool showOnlyAddedEmojisAndStickers; bool collapseSimilarChannels; bool hideSimilarChannels; @@ -117,6 +118,7 @@ public: void set_disableAds(bool val); void set_disableStories(bool val); void set_disableCustomBackgrounds(bool val); + void set_showOnlyAddedEmojisAndStickers(bool val); void set_collapseSimilarChannels(bool val); void set_hideSimilarChannels(bool val); diff --git a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp index 426be8141b..380272a247 100644 --- a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp +++ b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp @@ -767,6 +767,25 @@ void SetupQoLToggles(not_null container) { }, container->lifetime()); + AddButtonWithIcon( + container, + tr::ayu_ShowOnlyAddedEmojisAndStickers(), + st::settingsButtonNoIcon + )->toggleOn( + rpl::single(settings->showOnlyAddedEmojisAndStickers) + )->toggledValue( + ) | rpl::filter( + [=](bool enabled) + { + return (enabled != settings->showOnlyAddedEmojisAndStickers); + }) | start_with_next( + [=](bool enabled) + { + settings->set_showOnlyAddedEmojisAndStickers(enabled); + AyuSettings::save(); + }, + container->lifetime()); + std::vector checkboxes = { NestedEntry{ tr::ayu_CollapseSimilarChannels(tr::now), settings->collapseSimilarChannels, [=](bool enabled) diff --git a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp index ba80c96040..f9e8e54c86 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp @@ -55,6 +55,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include +// AyuGram includes +#include "ayu/ayu_settings.h" + namespace ChatHelpers { namespace { @@ -2255,9 +2258,13 @@ void EmojiListWidget::refreshCustom() { && !_allowWithoutPremium; const auto owner = &session->data(); const auto &sets = owner->stickers().sets(); + auto settings = &AyuSettings::getInstance(); const auto push = [&](uint64 setId, bool installed) { const auto megagroup = _megagroupSet && (setId == Data::Stickers::MegagroupSetId); + if (settings->showOnlyAddedEmojisAndStickers && !installed && !megagroup) { + return; + } const auto lookupId = megagroup ? _megagroupSet->mgInfo->emojiSet.id : setId; diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp index 209dab9f52..cd9693f84c 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp @@ -54,6 +54,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include +// AyuGram includes +#include "ayu/ayu_settings.h" + namespace ChatHelpers { namespace { @@ -404,9 +407,13 @@ bool FieldAutocomplete::clearFilteredBotCommands() { FieldAutocomplete::StickerRows FieldAutocomplete::getStickerSuggestions() { const auto data = &_session->data().stickers(); const auto list = data->getListByEmoji({ _emoji }, _stickersSeed); + const auto settings = &AyuSettings::getInstance(); auto result = ranges::views::all( list - ) | ranges::views::transform([](not_null sticker) { + ) | ranges::views::filter([&](not_null sticker) { + return !settings->showOnlyAddedEmojisAndStickers + || sticker->isStickerSetInstalled(); + }) | ranges::views::transform([](not_null sticker) { return StickerSuggestion{ sticker, sticker->createMediaView() diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index ad95925415..1066d0b7d9 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -763,6 +763,10 @@ void StickersListWidget::fillFilteredStickersRow() { } void StickersListWidget::addSearchRow(not_null set) { + const auto settings = &AyuSettings::getInstance(); + if (settings->showOnlyAddedEmojisAndStickers && !SetInMyList(set->flags)) { + return; + } const auto skipPremium = !session().premiumPossible(); auto elements = PrepareStickers( set->stickers.empty() ? set->covers : set->stickers,