mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Show correct emoticon in interaction-seen status.
This commit is contained in:
parent
b02967a44e
commit
a566405598
5 changed files with 22 additions and 15 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -61,14 +61,14 @@ void EmojiInteractions::play(
|
|||
not_null<Element*> 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<Element*> view,
|
||||
std::shared_ptr<Data::DocumentMedia> 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<QRect> EmojiInteractions::updateRequests() const {
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
bool finished = false;
|
||||
};
|
||||
struct Delayed {
|
||||
QString emoji;
|
||||
QString emoticon;
|
||||
not_null<Element*> view;
|
||||
std::shared_ptr<Data::DocumentMedia> media;
|
||||
crl::time shouldHaveStartedAt = 0;
|
||||
|
@ -63,7 +63,7 @@ private:
|
|||
[[nodiscard]] QRect computeRect(not_null<Element*> view) const;
|
||||
|
||||
void play(
|
||||
QString emoji,
|
||||
QString emoticon,
|
||||
not_null<Element*> view,
|
||||
std::shared_ptr<Data::DocumentMedia> media,
|
||||
bool incoming);
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue