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

Show correct emoticon in interaction-seen status.

This commit is contained in:
John Preston
2021-09-19 10:31:41 +03:00
parent b02967a44e
commit a566405598
5 changed files with 22 additions and 15 deletions

View File

@@ -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) {

View File

@@ -28,7 +28,7 @@ class Element;
namespace ChatHelpers {
struct EmojiInteractionPlayRequest {
QString emoji;
QString emoticon;
not_null<HistoryItem*> item;
std::shared_ptr<Data::DocumentMedia> media;
crl::time shouldHaveStartedAt = 0;
@@ -45,7 +45,7 @@ struct EmojiInteractionsBunch {
struct EmojiInteractionSeen {
not_null<PeerData*> peer;
not_null<EmojiPtr> emoji;
QString emoticon;
};
class EmojiInteractions final {
@@ -78,6 +78,7 @@ public:
private:
struct Animation {
QString emoticon;
not_null<EmojiPtr> emoji;
not_null<DocumentData*> document;
std::shared_ptr<Data::DocumentMedia> media;