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