2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Implement PoC custom reaction selection.

This commit is contained in:
John Preston
2022-08-16 18:52:49 +03:00
parent cece9cf09b
commit 09124f6424
24 changed files with 449 additions and 152 deletions

View File

@@ -42,26 +42,6 @@ constexpr auto kSizeForDownscale = 64;
} // namespace
ReactionId ReactionFromMTP(const MTPReaction &reaction) {
return reaction.match([](MTPDreactionEmpty) {
return ReactionId{ QString() };
}, [](const MTPDreactionEmoji &data) {
return ReactionId{ qs(data.vemoticon()) };
}, [](const MTPDreactionCustomEmoji &data) {
return ReactionId{ DocumentId(data.vdocument_id().v) };
});
}
MTPReaction ReactionToMTP(ReactionId id) {
if (const auto custom = id.custom()) {
return MTP_reactionCustomEmoji(MTP_long(custom));
}
const auto emoji = id.emoji();
return emoji.isEmpty()
? MTP_reactionEmpty()
: MTP_reactionEmoji(MTP_string(emoji));
}
Reactions::Reactions(not_null<Session*> owner)
: _owner(owner)
, _repaintTimer([=] { repaintCollected(); }) {