mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added special mode to emoji list widget to exclude non-unicode emoji.
This commit is contained in:
parent
804991a69c
commit
38fc6bfbb9
4 changed files with 15 additions and 6 deletions
|
@ -468,7 +468,8 @@ EmojiListWidget::EmojiListWidget(
|
||||||
std::move(descriptor.paused))
|
std::move(descriptor.paused))
|
||||||
, _show(std::move(descriptor.show))
|
, _show(std::move(descriptor.show))
|
||||||
, _features(descriptor.features)
|
, _features(descriptor.features)
|
||||||
, _mode(descriptor.mode)
|
, _onlyUnicodeEmoji(descriptor.mode == Mode::PeerTitle)
|
||||||
|
, _mode(_onlyUnicodeEmoji ? Mode::Full : descriptor.mode)
|
||||||
, _api(&session().mtp())
|
, _api(&session().mtp())
|
||||||
, _staticCount(_mode == Mode::Full ? kEmojiSectionCount : 1)
|
, _staticCount(_mode == Mode::Full ? kEmojiSectionCount : 1)
|
||||||
, _premiumIcon(_mode == Mode::EmojiStatus
|
, _premiumIcon(_mode == Mode::EmojiStatus
|
||||||
|
@ -490,7 +491,8 @@ EmojiListWidget::EmojiListWidget(
|
||||||
|
|
||||||
if (_mode != Mode::RecentReactions
|
if (_mode != Mode::RecentReactions
|
||||||
&& _mode != Mode::BackgroundEmoji
|
&& _mode != Mode::BackgroundEmoji
|
||||||
&& _mode != Mode::ChannelStatus) {
|
&& _mode != Mode::ChannelStatus
|
||||||
|
&& !_onlyUnicodeEmoji) {
|
||||||
setupSearch();
|
setupSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1052,7 +1054,7 @@ void EmojiListWidget::fillRecent() {
|
||||||
const auto test = session().isTestMode();
|
const auto test = session().isTestMode();
|
||||||
for (const auto &one : list) {
|
for (const auto &one : list) {
|
||||||
const auto document = std::get_if<RecentEmojiDocument>(&one.id.data);
|
const auto document = std::get_if<RecentEmojiDocument>(&one.id.data);
|
||||||
if (document && document->test != test) {
|
if (document && ((document->test != test) || _onlyUnicodeEmoji)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_recent.push_back({
|
_recent.push_back({
|
||||||
|
@ -2129,7 +2131,9 @@ void EmojiListWidget::refreshCustom() {
|
||||||
auto old = base::take(_custom);
|
auto old = base::take(_custom);
|
||||||
const auto session = &this->session();
|
const auto session = &this->session();
|
||||||
const auto premiumPossible = session->premiumPossible();
|
const auto premiumPossible = session->premiumPossible();
|
||||||
const auto premiumMayBeBought = premiumPossible
|
const auto onlyUnicodeEmoji = _onlyUnicodeEmoji || !premiumPossible;
|
||||||
|
const auto premiumMayBeBought = (!onlyUnicodeEmoji)
|
||||||
|
&& premiumPossible
|
||||||
&& !session->premium()
|
&& !session->premium()
|
||||||
&& !_allowWithoutPremium;
|
&& !_allowWithoutPremium;
|
||||||
const auto owner = &session->data();
|
const auto owner = &session->data();
|
||||||
|
@ -2189,7 +2193,7 @@ void EmojiListWidget::refreshCustom() {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}();
|
}();
|
||||||
if (premium && !premiumPossible) {
|
if (premium && onlyUnicodeEmoji) {
|
||||||
return;
|
return;
|
||||||
} else if (valid) {
|
} else if (valid) {
|
||||||
i->thumbnailDocument = it->second->lookupThumbnailDocument();
|
i->thumbnailDocument = it->second->lookupThumbnailDocument();
|
||||||
|
@ -2223,7 +2227,7 @@ void EmojiListWidget::refreshCustom() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (premium && !premiumPossible) {
|
if (premium && onlyUnicodeEmoji) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_custom.push_back({
|
_custom.push_back({
|
||||||
|
|
|
@ -76,6 +76,7 @@ enum class EmojiListMode {
|
||||||
RecentReactions,
|
RecentReactions,
|
||||||
UserpicBuilder,
|
UserpicBuilder,
|
||||||
BackgroundEmoji,
|
BackgroundEmoji,
|
||||||
|
PeerTitle,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EmojiListDescriptor {
|
struct EmojiListDescriptor {
|
||||||
|
@ -379,6 +380,7 @@ private:
|
||||||
|
|
||||||
const std::shared_ptr<Show> _show;
|
const std::shared_ptr<Show> _show;
|
||||||
const ComposeFeatures _features;
|
const ComposeFeatures _features;
|
||||||
|
const bool _onlyUnicodeEmoji;
|
||||||
Mode _mode = Mode::Full;
|
Mode _mode = Mode::Full;
|
||||||
std::unique_ptr<Ui::TabbedSearch> _search;
|
std::unique_ptr<Ui::TabbedSearch> _search;
|
||||||
MTP::Sender _api;
|
MTP::Sender _api;
|
||||||
|
|
|
@ -540,6 +540,8 @@ TabbedSelector::Tab TabbedSelector::createTab(SelectorTab type, int index) {
|
||||||
? EmojiMode::FullReactions
|
? EmojiMode::FullReactions
|
||||||
: _mode == Mode::RecentReactions
|
: _mode == Mode::RecentReactions
|
||||||
? EmojiMode::RecentReactions
|
? EmojiMode::RecentReactions
|
||||||
|
: _mode == Mode::PeerTitle
|
||||||
|
? EmojiMode::PeerTitle
|
||||||
: EmojiMode::Full),
|
: EmojiMode::Full),
|
||||||
.customTextColor = _customTextColor,
|
.customTextColor = _customTextColor,
|
||||||
.paused = paused,
|
.paused = paused,
|
||||||
|
|
|
@ -86,6 +86,7 @@ enum class TabbedSelectorMode {
|
||||||
BackgroundEmoji,
|
BackgroundEmoji,
|
||||||
FullReactions,
|
FullReactions,
|
||||||
RecentReactions,
|
RecentReactions,
|
||||||
|
PeerTitle,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TabbedSelectorDescriptor {
|
struct TabbedSelectorDescriptor {
|
||||||
|
|
Loading…
Add table
Reference in a new issue