mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
feat: add option to show only added emojis & stickers
This commit is contained in:
parent
8f29e32577
commit
314a90995a
7 changed files with 45 additions and 1 deletions
|
@ -6623,3 +6623,4 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"ayu_AboutText1" = "ToS breaking Telegram client based on {api_link}.";
|
"ayu_AboutText1" = "ToS breaking Telegram client based on {api_link}.";
|
||||||
"ayu_UpdateAyuGram" = "Update AyuGram";
|
"ayu_UpdateAyuGram" = "Update AyuGram";
|
||||||
"ayu_UtilityRestartRequired" = "App will close in 5 seconds.";
|
"ayu_UtilityRestartRequired" = "App will close in 5 seconds.";
|
||||||
|
"ayu_ShowOnlyAddedEmojisAndStickers" = "Show Only Added Emojis and Stickers";
|
||||||
|
|
|
@ -380,6 +380,10 @@ void AyuGramSettings::set_disableCustomBackgrounds(bool val) {
|
||||||
disableCustomBackgrounds = val;
|
disableCustomBackgrounds = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AyuGramSettings::set_showOnlyAddedEmojisAndStickers(bool val) {
|
||||||
|
showOnlyAddedEmojisAndStickers = val;
|
||||||
|
}
|
||||||
|
|
||||||
void AyuGramSettings::set_collapseSimilarChannels(bool val) {
|
void AyuGramSettings::set_collapseSimilarChannels(bool val) {
|
||||||
collapseSimilarChannels = val;
|
collapseSimilarChannels = val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
bool disableAds;
|
bool disableAds;
|
||||||
bool disableStories;
|
bool disableStories;
|
||||||
bool disableCustomBackgrounds;
|
bool disableCustomBackgrounds;
|
||||||
|
bool showOnlyAddedEmojisAndStickers;
|
||||||
bool collapseSimilarChannels;
|
bool collapseSimilarChannels;
|
||||||
bool hideSimilarChannels;
|
bool hideSimilarChannels;
|
||||||
|
|
||||||
|
@ -117,6 +118,7 @@ public:
|
||||||
void set_disableAds(bool val);
|
void set_disableAds(bool val);
|
||||||
void set_disableStories(bool val);
|
void set_disableStories(bool val);
|
||||||
void set_disableCustomBackgrounds(bool val);
|
void set_disableCustomBackgrounds(bool val);
|
||||||
|
void set_showOnlyAddedEmojisAndStickers(bool val);
|
||||||
void set_collapseSimilarChannels(bool val);
|
void set_collapseSimilarChannels(bool val);
|
||||||
void set_hideSimilarChannels(bool val);
|
void set_hideSimilarChannels(bool val);
|
||||||
|
|
||||||
|
|
|
@ -767,6 +767,25 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
|
||||||
},
|
},
|
||||||
container->lifetime());
|
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 = {
|
std::vector checkboxes = {
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
tr::ayu_CollapseSimilarChannels(tr::now), settings->collapseSimilarChannels, [=](bool enabled)
|
tr::ayu_CollapseSimilarChannels(tr::now), settings->collapseSimilarChannels, [=](bool enabled)
|
||||||
|
|
|
@ -55,6 +55,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
|
|
||||||
namespace ChatHelpers {
|
namespace ChatHelpers {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -2255,9 +2258,13 @@ void EmojiListWidget::refreshCustom() {
|
||||||
&& !_allowWithoutPremium;
|
&& !_allowWithoutPremium;
|
||||||
const auto owner = &session->data();
|
const auto owner = &session->data();
|
||||||
const auto &sets = owner->stickers().sets();
|
const auto &sets = owner->stickers().sets();
|
||||||
|
auto settings = &AyuSettings::getInstance();
|
||||||
const auto push = [&](uint64 setId, bool installed) {
|
const auto push = [&](uint64 setId, bool installed) {
|
||||||
const auto megagroup = _megagroupSet
|
const auto megagroup = _megagroupSet
|
||||||
&& (setId == Data::Stickers::MegagroupSetId);
|
&& (setId == Data::Stickers::MegagroupSetId);
|
||||||
|
if (settings->showOnlyAddedEmojisAndStickers && !installed && !megagroup) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto lookupId = megagroup
|
const auto lookupId = megagroup
|
||||||
? _megagroupSet->mgInfo->emojiSet.id
|
? _megagroupSet->mgInfo->emojiSet.id
|
||||||
: setId;
|
: setId;
|
||||||
|
|
|
@ -54,6 +54,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
|
|
||||||
namespace ChatHelpers {
|
namespace ChatHelpers {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -404,9 +407,13 @@ bool FieldAutocomplete::clearFilteredBotCommands() {
|
||||||
FieldAutocomplete::StickerRows FieldAutocomplete::getStickerSuggestions() {
|
FieldAutocomplete::StickerRows FieldAutocomplete::getStickerSuggestions() {
|
||||||
const auto data = &_session->data().stickers();
|
const auto data = &_session->data().stickers();
|
||||||
const auto list = data->getListByEmoji({ _emoji }, _stickersSeed);
|
const auto list = data->getListByEmoji({ _emoji }, _stickersSeed);
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
auto result = ranges::views::all(
|
auto result = ranges::views::all(
|
||||||
list
|
list
|
||||||
) | ranges::views::transform([](not_null<DocumentData*> sticker) {
|
) | ranges::views::filter([&](not_null<DocumentData*> sticker) {
|
||||||
|
return !settings->showOnlyAddedEmojisAndStickers
|
||||||
|
|| sticker->isStickerSetInstalled();
|
||||||
|
}) | ranges::views::transform([](not_null<DocumentData*> sticker) {
|
||||||
return StickerSuggestion{
|
return StickerSuggestion{
|
||||||
sticker,
|
sticker,
|
||||||
sticker->createMediaView()
|
sticker->createMediaView()
|
||||||
|
|
|
@ -763,6 +763,10 @@ void StickersListWidget::fillFilteredStickersRow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersListWidget::addSearchRow(not_null<StickersSet*> set) {
|
void StickersListWidget::addSearchRow(not_null<StickersSet*> set) {
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
if (settings->showOnlyAddedEmojisAndStickers && !SetInMyList(set->flags)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto skipPremium = !session().premiumPossible();
|
const auto skipPremium = !session().premiumPossible();
|
||||||
auto elements = PrepareStickers(
|
auto elements = PrepareStickers(
|
||||||
set->stickers.empty() ? set->covers : set->stickers,
|
set->stickers.empty() ? set->covers : set->stickers,
|
||||||
|
|
Loading…
Add table
Reference in a new issue