2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Support custom emoji in IsolatedEmoji.

This commit is contained in:
John Preston
2022-07-25 17:54:37 +03:00
parent 9b941bae97
commit edfb7bb65a
10 changed files with 183 additions and 62 deletions

View File

@@ -150,22 +150,25 @@ auto EmojiPack::stickerForEmoji(EmojiPtr emoji) -> Sticker {
return { i->second.get(), nullptr };
}
if (!emoji->colored()) {
return Sticker();
return {};
}
const auto j = _map.find(emoji->original());
if (j != end(_map)) {
const auto index = emoji->variantIndex(emoji);
return { j->second.get(), ColorReplacements(index) };
}
return Sticker();
return {};
}
auto EmojiPack::stickerForEmoji(const IsolatedEmoji &emoji) -> Sticker {
Expects(!emoji.empty());
return (emoji.items[1] != nullptr)
? Sticker()
: stickerForEmoji(emoji.items[0]);
if (!v::is_null(emoji.items[1])) {
return {};
} else if (const auto regular = std::get_if<EmojiPtr>(&emoji.items[0])) {
return stickerForEmoji(*regular);
}
return {};
}
std::shared_ptr<LargeEmojiImage> EmojiPack::image(EmojiPtr emoji) {