diff --git a/Telegram/SourceFiles/chat_helpers/emoji_interactions.cpp b/Telegram/SourceFiles/chat_helpers/emoji_interactions.cpp index 4f5a059b9..907dfff7d 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_interactions.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_interactions.cpp @@ -117,7 +117,8 @@ void EmojiInteractions::startOutgoing( if (!IsServerMsgId(item->id) || !item->history()->peer->isUser()) { return; } - const auto emoji = chooseInteractionEmoji(item); + const auto emoticon = item->originalText().text; + const auto emoji = chooseInteractionEmoji(emoticon); if (!emoji) { return; } @@ -145,6 +146,7 @@ void EmojiInteractions::startOutgoing( media->checkStickerLarge(); const auto now = crl::now(); animations.push_back({ + .emoticon = emoticon, .emoji = emoji, .document = document, .media = media, @@ -195,6 +197,7 @@ void EmojiInteractions::startIncoming( const auto media = document->createMediaView(); media->checkStickerLarge(); animations.push_back({ + .emoticon = emoticon, .emoji = emoji, .document = document, .media = media, @@ -219,7 +222,7 @@ void EmojiInteractions::seenOutgoing( if (const auto j = i->second.find(emoji); j != end(i->second)) { const auto last = j->second.lastDoneReceivedAt; if (!last || last + kAcceptSeenSinceRequest > crl::now()) { - _seen.fire({ peer, emoji }); + _seen.fire({ peer, emoticon }); } } } @@ -263,7 +266,7 @@ auto EmojiInteractions::checkAnimations( } else if (!lastStartedAt || lastStartedAt + kMinDelay <= now) { animation.startedAt = now; _playRequests.fire({ - animation.emoji->text(), + animation.emoticon, item, animation.media, animation.scheduledAt, @@ -316,7 +319,7 @@ void EmojiInteractions::sendAccumulatedOutgoing( peer->input, MTPint(), // top_msg_id MTP_sendMessageEmojiInteraction( - MTP_string(emoji->text()), + MTP_string(from->emoticon), MTP_int(item->id), MTP_dataJSON(MTP_bytes(ToJson(bunch)))) )).done([=](const MTPBool &result, mtpRequestId requestId) { diff --git a/Telegram/SourceFiles/chat_helpers/emoji_interactions.h b/Telegram/SourceFiles/chat_helpers/emoji_interactions.h index 05edfb54a..2f1135dca 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_interactions.h +++ b/Telegram/SourceFiles/chat_helpers/emoji_interactions.h @@ -28,7 +28,7 @@ class Element; namespace ChatHelpers { struct EmojiInteractionPlayRequest { - QString emoji; + QString emoticon; not_null item; std::shared_ptr media; crl::time shouldHaveStartedAt = 0; @@ -45,7 +45,7 @@ struct EmojiInteractionsBunch { struct EmojiInteractionSeen { not_null peer; - not_null emoji; + QString emoticon; }; class EmojiInteractions final { @@ -78,6 +78,7 @@ public: private: struct Animation { + QString emoticon; not_null emoji; not_null document; std::shared_ptr media; diff --git a/Telegram/SourceFiles/history/view/history_view_emoji_interactions.cpp b/Telegram/SourceFiles/history/view/history_view_emoji_interactions.cpp index 55ad1657f..609a2aee7 100644 --- a/Telegram/SourceFiles/history/view/history_view_emoji_interactions.cpp +++ b/Telegram/SourceFiles/history/view/history_view_emoji_interactions.cpp @@ -61,14 +61,14 @@ void EmojiInteractions::play( not_null view) { if (_plays.empty()) { play( - std::move(request.emoji), + std::move(request.emoticon), view, std::move(request.media), request.incoming); } else { const auto now = crl::now(); _delayed.push_back({ - request.emoji, + request.emoticon, view, std::move(request.media), now, @@ -79,7 +79,7 @@ void EmojiInteractions::play( } void EmojiInteractions::play( - QString emoji, + QString emoticon, not_null view, std::shared_ptr media, bool incoming) { @@ -111,7 +111,7 @@ void EmojiInteractions::play( .shift = shift, }); if (incoming) { - _playStarted.fire(std::move(emoji)); + _playStarted.fire(std::move(emoticon)); } if (const auto media = view->media()) { media->stickerClearLoopPlayed(); @@ -254,8 +254,11 @@ void EmojiInteractions::checkDelayed() { } auto good = std::move(*i); _delayed.erase(begin(_delayed), i + 1); - const auto incoming = good.incoming; - play(std::move(good.emoji), good.view, std::move(good.media), incoming); + play( + std::move(good.emoticon), + good.view, + std::move(good.media), + good.incoming); } rpl::producer EmojiInteractions::updateRequests() const { diff --git a/Telegram/SourceFiles/history/view/history_view_emoji_interactions.h b/Telegram/SourceFiles/history/view/history_view_emoji_interactions.h index aceca3432..31b68cc97 100644 --- a/Telegram/SourceFiles/history/view/history_view_emoji_interactions.h +++ b/Telegram/SourceFiles/history/view/history_view_emoji_interactions.h @@ -53,7 +53,7 @@ private: bool finished = false; }; struct Delayed { - QString emoji; + QString emoticon; not_null view; std::shared_ptr media; crl::time shouldHaveStartedAt = 0; @@ -63,7 +63,7 @@ private: [[nodiscard]] QRect computeRect(not_null view) const; void play( - QString emoji, + QString emoticon, not_null view, std::shared_ptr media, bool incoming); diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 665af7149..b8ea90b4b 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -667,7 +667,7 @@ void TopBarWidget::setActiveChat( ) | rpl::filter([=](const InteractionSeen &seen) { return (seen.peer == history->peer); }) | rpl::start_with_next([=](const InteractionSeen &seen) { - handleEmojiInteractionSeen(seen.emoji->text()); + handleEmojiInteractionSeen(seen.emoticon); }, lifetime()); } }