Simplify updateAnimatedEmojiMessageClicked.
This commit is contained in:
parent
b15244f59d
commit
95d4ec8973
|
@ -2316,10 +2316,6 @@ diceStickersRegular sticker:sticker = DiceStickers;
|
||||||
diceStickersSlotMachine background:sticker lever:sticker left_reel:sticker center_reel:sticker right_reel:sticker = DiceStickers;
|
diceStickersSlotMachine background:sticker lever:sticker left_reel:sticker center_reel:sticker right_reel:sticker = DiceStickers;
|
||||||
|
|
||||||
|
|
||||||
//@description Describes a click on an animated emoji by the other party, resulted in a big animation @start_delay Animation start delay @sticker The played animated sticker
|
|
||||||
animatedEmojiClick start_delay:double sticker:sticker = AnimatedEmojiClick;
|
|
||||||
|
|
||||||
|
|
||||||
//@description Represents the result of an ImportContacts request @user_ids User identifiers of the imported contacts in the same order as they were specified in the request; 0 if the contact is not yet a registered user
|
//@description Represents the result of an ImportContacts request @user_ids User identifiers of the imported contacts in the same order as they were specified in the request; 0 if the contact is not yet a registered user
|
||||||
//@importer_count The number of users that imported the corresponding contact; 0 for already registered users or if unavailable
|
//@importer_count The number of users that imported the corresponding contact; 0 for already registered users or if unavailable
|
||||||
importedContacts user_ids:vector<int53> importer_count:vector<int32> = ImportedContacts;
|
importedContacts user_ids:vector<int53> importer_count:vector<int32> = ImportedContacts;
|
||||||
|
@ -3839,8 +3835,9 @@ updateUsersNearby users_nearby:vector<chatNearby> = Update;
|
||||||
//@description The list of supported dice emojis has changed @emojis The new list of supported dice emojis
|
//@description The list of supported dice emojis has changed @emojis The new list of supported dice emojis
|
||||||
updateDiceEmojis emojis:vector<string> = Update;
|
updateDiceEmojis emojis:vector<string> = Update;
|
||||||
|
|
||||||
//@description Some animated emoji message was clicked @chat_id Chat identifier @message_id Message identifier @clicks Description of new number of unread mention messages left in the chat
|
//@description Some animated emoji message was clicked and a big animated sticker should be played if the message is visible on the screen. chatActionEnjoyingAnimations with the text of the message needs to be sent if the sticker is played
|
||||||
updateAnimatedEmojiMessageClicked chat_id:int53 message_id:int53 clicks:vector<animatedEmojiClick> = Update;
|
//@chat_id Chat identifier @message_id Message identifier @sticker The animated sticker to be played
|
||||||
|
updateAnimatedEmojiMessageClicked chat_id:int53 message_id:int53 sticker:sticker = Update;
|
||||||
|
|
||||||
//@description The parameters of animation search through GetOption("animation_search_bot_username") bot has changed @provider Name of the animation search provider @emojis The new list of emojis suggested for searching
|
//@description The parameters of animation search through GetOption("animation_search_bot_username") bot has changed @provider Name of the animation search provider @emojis The new list of emojis suggested for searching
|
||||||
updateAnimationSearchParameters provider:string emojis:vector<string> = Update;
|
updateAnimationSearchParameters provider:string emojis:vector<string> = Update;
|
||||||
|
|
|
@ -4273,7 +4273,8 @@ void StickersManager::schedule_update_animated_emoji_clicked(const StickerSet *s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<std::pair<FileId, double>> stickers;
|
auto now = Time::now();
|
||||||
|
auto start_time = max(now, next_update_animated_emoji_clicked_);
|
||||||
for (size_t i = 0; i < clicks.size(); i++) {
|
for (size_t i = 0; i < clicks.size(); i++) {
|
||||||
auto index = clicks[i].first;
|
auto index = clicks[i].first;
|
||||||
auto sticker_id = sticker_ids[index];
|
auto sticker_id = sticker_ids[index];
|
||||||
|
@ -4281,28 +4282,17 @@ void StickersManager::schedule_update_animated_emoji_clicked(const StickerSet *s
|
||||||
LOG(INFO) << "Failed to find sticker for " << emoji << " with index " << index;
|
LOG(INFO) << "Failed to find sticker for " << emoji << " with index " << index;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
stickers.emplace_back(sticker_id, clicks[i].second);
|
create_actor<SleepActor>(
|
||||||
}
|
"SendUpdateAnimatedEmojiClicked", start_time + clicks[i].second - now,
|
||||||
CHECK(!stickers.empty());
|
PromiseCreator::lambda([actor_id = actor_id(this), full_message_id, sticker_id](Result<Unit> result) {
|
||||||
|
send_closure(actor_id, &StickersManager::send_update_animated_emoji_clicked, full_message_id, sticker_id);
|
||||||
auto now = Time::now();
|
|
||||||
if (now >= next_update_animated_emoji_clicked_) {
|
|
||||||
send_update_animated_emoji_clicked(full_message_id, std::move(stickers));
|
|
||||||
next_update_animated_emoji_clicked_ = now + clicks.back().second + MIN_ANIMATED_EMOJI_CLICK_DELAY;
|
|
||||||
} else {
|
|
||||||
create_actor<SleepActor>("SendUpdateAnimatedEmojiClicked", next_update_animated_emoji_clicked_ - now,
|
|
||||||
PromiseCreator::lambda([actor_id = actor_id(this), full_message_id,
|
|
||||||
stickers = std::move(stickers)](Result<Unit> result) mutable {
|
|
||||||
send_closure(actor_id, &StickersManager::send_update_animated_emoji_clicked,
|
|
||||||
full_message_id, std::move(stickers));
|
|
||||||
}))
|
}))
|
||||||
.release();
|
.release();
|
||||||
next_update_animated_emoji_clicked_ += clicks.back().second + MIN_ANIMATED_EMOJI_CLICK_DELAY;
|
|
||||||
}
|
}
|
||||||
|
next_update_animated_emoji_clicked_ = start_time + clicks.back().second + MIN_ANIMATED_EMOJI_CLICK_DELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersManager::send_update_animated_emoji_clicked(FullMessageId full_message_id,
|
void StickersManager::send_update_animated_emoji_clicked(FullMessageId full_message_id, FileId sticker_id) {
|
||||||
vector<std::pair<FileId, double>> stickers) {
|
|
||||||
if (td_->messages_manager_->is_message_edited_recently(full_message_id, 2)) {
|
if (td_->messages_manager_->is_message_edited_recently(full_message_id, 2)) {
|
||||||
// includes deleted full_message_id
|
// includes deleted full_message_id
|
||||||
return;
|
return;
|
||||||
|
@ -4312,12 +4302,9 @@ void StickersManager::send_update_animated_emoji_clicked(FullMessageId full_mess
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = transform(stickers, [this](const std::pair<FileId, double> &sticker) {
|
|
||||||
return td_api::make_object<td_api::animatedEmojiClick>(sticker.second, get_sticker_object(sticker.first));
|
|
||||||
});
|
|
||||||
send_closure(G()->td(), &Td::send_update,
|
send_closure(G()->td(), &Td::send_update,
|
||||||
td_api::make_object<td_api::updateAnimatedEmojiMessageClicked>(
|
td_api::make_object<td_api::updateAnimatedEmojiMessageClicked>(
|
||||||
dialog_id.get(), full_message_id.get_message_id().get(), std::move(result)));
|
dialog_id.get(), full_message_id.get_message_id().get(), get_sticker_object(sticker_id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersManager::view_featured_sticker_sets(const vector<StickerSetId> &sticker_set_ids) {
|
void StickersManager::view_featured_sticker_sets(const vector<StickerSetId> &sticker_set_ids) {
|
||||||
|
|
|
@ -604,7 +604,7 @@ class StickersManager final : public Actor {
|
||||||
void schedule_update_animated_emoji_clicked(const StickerSet *sticker_set, const string &emoji,
|
void schedule_update_animated_emoji_clicked(const StickerSet *sticker_set, const string &emoji,
|
||||||
FullMessageId full_message_id, vector<std::pair<int, double>> clicks);
|
FullMessageId full_message_id, vector<std::pair<int, double>> clicks);
|
||||||
|
|
||||||
void send_update_animated_emoji_clicked(FullMessageId full_message_id, vector<std::pair<FileId, double>> stickers);
|
void send_update_animated_emoji_clicked(FullMessageId full_message_id, FileId sticker_id);
|
||||||
|
|
||||||
td_api::object_ptr<td_api::updateDiceEmojis> get_update_dice_emojis_object() const;
|
td_api::object_ptr<td_api::updateDiceEmojis> get_update_dice_emojis_object() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user