From 441482c0c414b9a31f4b4d27db418834f1514c0a Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 9 Aug 2023 13:10:06 +0300 Subject: [PATCH] Remove now unneeded proxies to ReactionManager. --- td/telegram/MessagesManager.cpp | 2 +- td/telegram/ReactionManager.cpp | 18 +++++------------- td/telegram/ReactionManager.h | 4 ---- td/telegram/ReactionType.cpp | 12 ------------ td/telegram/ReactionType.h | 6 ------ 5 files changed, 6 insertions(+), 36 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index f0565d850..3b30fe7b7 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -23858,7 +23858,7 @@ void MessagesManager::add_message_reaction(FullMessageId full_message_id, Reacti } if (add_to_recent) { - add_recent_reaction(td_, reaction_type); + td_->reaction_manager_->add_recent_reaction(reaction_type); } set_message_reactions(d, m, is_big, add_to_recent, std::move(promise)); diff --git a/td/telegram/ReactionManager.cpp b/td/telegram/ReactionManager.cpp index b92cf576c..830d496dd 100644 --- a/td/telegram/ReactionManager.cpp +++ b/td/telegram/ReactionManager.cpp @@ -179,15 +179,17 @@ void ReactionManager::get_emoji_reaction(const string &emoji, td_api::object_ptr ReactionManager::get_sorted_available_reactions( ChatReactions available_reactions, ChatReactions active_reactions, int32 row_size) { + load_recent_reactions(); + load_top_reactions(); + if (row_size < 5 || row_size > 25) { row_size = 8; } bool is_premium = td_->option_manager_->get_option_boolean("is_premium"); bool show_premium = is_premium; - - auto recent_reactions = get_recent_reactions(); - auto top_reactions = get_top_reactions(); + const auto &recent_reactions = recent_reactions_.reaction_types_; + auto top_reactions = top_reactions_.reaction_types_; LOG(INFO) << "Have available reactions " << available_reactions << " to be sorted by top reactions " << top_reactions << " and recent reactions " << recent_reactions; if (active_reactions.allow_custom_ && active_reactions.allow_all_) { @@ -275,16 +277,6 @@ td_api::object_ptr ReactionManager::get_sorted_avail available_reactions.allow_custom_); } -vector ReactionManager::get_recent_reactions() { - load_recent_reactions(); - return recent_reactions_.reaction_types_; -} - -vector ReactionManager::get_top_reactions() { - load_top_reactions(); - return top_reactions_.reaction_types_; -} - void ReactionManager::add_recent_reaction(const ReactionType &reaction_type) { load_recent_reactions(); diff --git a/td/telegram/ReactionManager.h b/td/telegram/ReactionManager.h index a2f8307a6..59e3d440a 100644 --- a/td/telegram/ReactionManager.h +++ b/td/telegram/ReactionManager.h @@ -40,10 +40,6 @@ class ReactionManager final : public Actor { ChatReactions active_reactions, int32 row_size); - vector get_recent_reactions(); - - vector get_top_reactions(); - void add_recent_reaction(const ReactionType &reaction_type); void clear_recent_reactions(Promise &&promise); diff --git a/td/telegram/ReactionType.cpp b/td/telegram/ReactionType.cpp index 08ba13854..f8401e2da 100644 --- a/td/telegram/ReactionType.cpp +++ b/td/telegram/ReactionType.cpp @@ -208,18 +208,6 @@ void send_set_default_reaction_query(Td *td) { ReactionType(td->option_manager_->get_option_string("default_reaction"))); } -vector get_recent_reactions(Td *td) { - return td->reaction_manager_->get_recent_reactions(); -} - -vector get_top_reactions(Td *td) { - return td->reaction_manager_->get_top_reactions(); -} - -void add_recent_reaction(Td *td, const ReactionType &reaction_type) { - td->reaction_manager_->add_recent_reaction(reaction_type); -} - int64 get_reaction_types_hash(const vector &reaction_types) { vector numbers; for (auto &reaction_type : reaction_types) { diff --git a/td/telegram/ReactionType.h b/td/telegram/ReactionType.h index ab5a5087c..b551214fc 100644 --- a/td/telegram/ReactionType.h +++ b/td/telegram/ReactionType.h @@ -86,12 +86,6 @@ void set_default_reaction(Td *td, ReactionType reaction_type, Promise &&pr void send_set_default_reaction_query(Td *td); -vector get_recent_reactions(Td *td); - -vector get_top_reactions(Td *td); - -void add_recent_reaction(Td *td, const ReactionType &reaction_type); - int64 get_reaction_types_hash(const vector &reaction_types); } // namespace td