Wait for emoji reactions to be loaded once in getEmojiReaction.
This commit is contained in:
parent
82ab2da9c0
commit
f702cad110
@ -55,6 +55,7 @@
|
|||||||
#include "td/utils/misc.h"
|
#include "td/utils/misc.h"
|
||||||
#include "td/utils/PathView.h"
|
#include "td/utils/PathView.h"
|
||||||
#include "td/utils/Random.h"
|
#include "td/utils/Random.h"
|
||||||
|
#include "td/utils/ScopeGuard.h"
|
||||||
#include "td/utils/Slice.h"
|
#include "td/utils/Slice.h"
|
||||||
#include "td/utils/SliceBuilder.h"
|
#include "td/utils/SliceBuilder.h"
|
||||||
#include "td/utils/StackAllocator.h"
|
#include "td/utils/StackAllocator.h"
|
||||||
@ -1580,6 +1581,10 @@ td_api::object_ptr<td_api::emojiReaction> StickersManager::get_emoji_reaction_ob
|
|||||||
void StickersManager::get_emoji_reaction(const string &emoji,
|
void StickersManager::get_emoji_reaction(const string &emoji,
|
||||||
Promise<td_api::object_ptr<td_api::emojiReaction>> &&promise) {
|
Promise<td_api::object_ptr<td_api::emojiReaction>> &&promise) {
|
||||||
load_reactions();
|
load_reactions();
|
||||||
|
if (reactions_.reactions_.empty() && reactions_.are_being_reloaded_) {
|
||||||
|
pending_get_emoji_reaction_queries_.emplace_back(emoji, std::move(promise));
|
||||||
|
return;
|
||||||
|
}
|
||||||
promise.set_value(get_emoji_reaction_object(emoji));
|
promise.set_value(get_emoji_reaction_object(emoji));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4004,6 +4009,14 @@ void StickersManager::on_get_available_reactions(
|
|||||||
CHECK(reactions_.are_being_reloaded_);
|
CHECK(reactions_.are_being_reloaded_);
|
||||||
reactions_.are_being_reloaded_ = false;
|
reactions_.are_being_reloaded_ = false;
|
||||||
|
|
||||||
|
auto get_emoji_reaction_queries = std::move(pending_get_emoji_reaction_queries_);
|
||||||
|
pending_get_emoji_reaction_queries_.clear();
|
||||||
|
SCOPE_EXIT {
|
||||||
|
for (auto &query : get_emoji_reaction_queries) {
|
||||||
|
query.second.set_value(get_emoji_reaction_object(query.first));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (available_reactions_ptr == nullptr) {
|
if (available_reactions_ptr == nullptr) {
|
||||||
// failed to get available reactions
|
// failed to get available reactions
|
||||||
return;
|
return;
|
||||||
|
@ -1052,6 +1052,8 @@ class StickersManager final : public Actor {
|
|||||||
vector<Promise<Unit>> pending_get_default_statuses_queries_;
|
vector<Promise<Unit>> pending_get_default_statuses_queries_;
|
||||||
vector<Promise<Unit>> pending_get_default_topic_icons_queries_;
|
vector<Promise<Unit>> pending_get_default_topic_icons_queries_;
|
||||||
|
|
||||||
|
vector<std::pair<string, Promise<td_api::object_ptr<td_api::emojiReaction>>>> pending_get_emoji_reaction_queries_;
|
||||||
|
|
||||||
double next_click_animated_emoji_message_time_ = 0;
|
double next_click_animated_emoji_message_time_ = 0;
|
||||||
double next_update_animated_emoji_clicked_time_ = 0;
|
double next_update_animated_emoji_clicked_time_ = 0;
|
||||||
vector<PendingGetAnimatedEmojiClickSticker> pending_get_animated_emoji_click_stickers_;
|
vector<PendingGetAnimatedEmojiClickSticker> pending_get_animated_emoji_click_stickers_;
|
||||||
|
Loading…
Reference in New Issue
Block a user