Move data reloading to UpdatesManager.
This commit is contained in:
parent
6f8b513597
commit
6790c309ac
@ -880,12 +880,6 @@ string AnimationsManager::get_animation_search_text(FileId file_id) const {
|
||||
return animation->file_name;
|
||||
}
|
||||
|
||||
void AnimationsManager::after_get_difference() {
|
||||
if (td_->is_online() && !td_->auth_manager_->is_bot()) {
|
||||
get_saved_animations(Auto());
|
||||
}
|
||||
}
|
||||
|
||||
void AnimationsManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
|
@ -89,8 +89,6 @@ class AnimationsManager final : public Actor {
|
||||
|
||||
string get_animation_search_text(FileId file_id) const;
|
||||
|
||||
void after_get_difference();
|
||||
|
||||
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
|
||||
|
||||
private:
|
||||
|
@ -16715,18 +16715,6 @@ UserId ContactsManager::get_support_user(Promise<Unit> &&promise) {
|
||||
return UserId();
|
||||
}
|
||||
|
||||
void ContactsManager::after_get_difference() {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
get_user(get_my_id(), 3, Promise<Unit>());
|
||||
|
||||
if (td_->is_online()) {
|
||||
reload_created_public_dialogs(PublicDialogType::HasUsername, Promise<td_api::object_ptr<td_api::chats>>());
|
||||
reload_created_public_dialogs(PublicDialogType::IsLocationBased, Promise<td_api::object_ptr<td_api::chats>>());
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
|
||||
for (auto user_id : unknown_users_) {
|
||||
if (!have_min_user(user_id)) {
|
||||
|
@ -439,6 +439,8 @@ class ContactsManager final : public Actor {
|
||||
|
||||
void check_created_public_dialogs_limit(PublicDialogType type, Promise<Unit> &&promise);
|
||||
|
||||
void reload_created_public_dialogs(PublicDialogType type, Promise<td_api::object_ptr<td_api::chats>> &&promise);
|
||||
|
||||
vector<DialogId> get_dialogs_for_discussion(Promise<Unit> &&promise);
|
||||
|
||||
vector<DialogId> get_inactive_channels(Promise<Unit> &&promise);
|
||||
@ -601,8 +603,6 @@ class ContactsManager final : public Actor {
|
||||
|
||||
void repair_chat_participants(ChatId chat_id);
|
||||
|
||||
void after_get_difference();
|
||||
|
||||
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
|
||||
|
||||
static tl_object_ptr<td_api::dateRange> convert_date_range(
|
||||
@ -1455,8 +1455,6 @@ class ContactsManager final : public Actor {
|
||||
static void return_created_public_dialogs(Promise<td_api::object_ptr<td_api::chats>> &&promise,
|
||||
const vector<ChannelId> &channel_ids);
|
||||
|
||||
void reload_created_public_dialogs(PublicDialogType type, Promise<td_api::object_ptr<td_api::chats>> &&promise);
|
||||
|
||||
void finish_get_created_public_dialogs(PublicDialogType type, Result<Unit> &&result);
|
||||
|
||||
void update_created_public_channels(Channel *c, ChannelId channel_id);
|
||||
|
@ -1472,10 +1472,6 @@ void NotificationSettingsManager::after_get_difference() {
|
||||
if (!channels_notification_settings_.is_synchronized) {
|
||||
send_get_scope_notification_settings_query(NotificationSettingsScope::Channel, Promise<>());
|
||||
}
|
||||
|
||||
if (td_->is_online() && !are_saved_ringtones_reloaded_) {
|
||||
reload_saved_ringtones(Auto());
|
||||
}
|
||||
}
|
||||
|
||||
void NotificationSettingsManager::on_binlog_events(vector<BinlogEvent> &&events) {
|
||||
|
@ -1462,6 +1462,10 @@ void StickersManager::reload_special_sticker_set_by_type(SpecialStickerSetType t
|
||||
if (G()->close_flag()) {
|
||||
return;
|
||||
}
|
||||
if (disable_animated_emojis_ &&
|
||||
(type == SpecialStickerSetType::animated_emoji() || type == SpecialStickerSetType::animated_emoji_click())) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto &sticker_set = add_special_sticker_set(type);
|
||||
if (sticker_set.is_being_reloaded_) {
|
||||
@ -7627,26 +7631,6 @@ td_api::object_ptr<td_api::httpUrl> StickersManager::get_emoji_suggestions_url_r
|
||||
return result;
|
||||
}
|
||||
|
||||
void StickersManager::after_get_difference() {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
reload_reactions();
|
||||
if (td_->is_online()) {
|
||||
get_installed_sticker_sets(false, Auto());
|
||||
get_installed_sticker_sets(true, Auto());
|
||||
get_featured_sticker_sets(0, 1000, Auto());
|
||||
get_recent_stickers(false, Auto());
|
||||
get_recent_stickers(true, Auto());
|
||||
get_favorite_stickers(Auto());
|
||||
|
||||
if (!disable_animated_emojis_) {
|
||||
reload_special_sticker_set_by_type(SpecialStickerSetType::animated_emoji());
|
||||
reload_special_sticker_set_by_type(SpecialStickerSetType::animated_emoji_click());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StickersManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
|
@ -133,6 +133,10 @@ class StickersManager final : public Actor {
|
||||
|
||||
void view_featured_sticker_sets(const vector<StickerSetId> &sticker_set_ids);
|
||||
|
||||
void reload_reactions();
|
||||
|
||||
void reload_special_sticker_set_by_type(SpecialStickerSetType type, bool is_recursive = false);
|
||||
|
||||
void on_get_available_reactions(tl_object_ptr<telegram_api::messages_AvailableReactions> &&available_reactions_ptr);
|
||||
|
||||
void on_get_installed_sticker_sets(bool is_masks, tl_object_ptr<telegram_api::messages_AllStickers> &&stickers_ptr);
|
||||
@ -319,8 +323,6 @@ class StickersManager final : public Actor {
|
||||
|
||||
void send_get_attached_stickers_query(FileId file_id, Promise<Unit> &&promise);
|
||||
|
||||
void after_get_difference();
|
||||
|
||||
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
|
||||
|
||||
template <class StorerT>
|
||||
@ -702,8 +704,6 @@ class StickersManager final : public Actor {
|
||||
|
||||
void load_reactions();
|
||||
|
||||
void reload_reactions();
|
||||
|
||||
void update_active_reactions();
|
||||
|
||||
td_api::object_ptr<td_api::updateReactions> get_update_reactions_object() const;
|
||||
@ -719,8 +719,6 @@ class StickersManager final : public Actor {
|
||||
|
||||
void load_special_sticker_set(SpecialStickerSet &sticker_set);
|
||||
|
||||
void reload_special_sticker_set_by_type(SpecialStickerSetType type, bool is_recursive = false);
|
||||
|
||||
void reload_special_sticker_set(SpecialStickerSet &sticker_set, int32 hash);
|
||||
|
||||
static void add_sticker_thumbnail(Sticker *s, PhotoSize thumbnail);
|
||||
|
@ -38,10 +38,12 @@
|
||||
#include "td/telegram/PollId.h"
|
||||
#include "td/telegram/PollManager.h"
|
||||
#include "td/telegram/PrivacyManager.h"
|
||||
#include "td/telegram/PublicDialogType.h"
|
||||
#include "td/telegram/ScheduledServerMessageId.h"
|
||||
#include "td/telegram/SecretChatId.h"
|
||||
#include "td/telegram/SecretChatsManager.h"
|
||||
#include "td/telegram/ServerMessageId.h"
|
||||
#include "td/telegram/SpecialStickerSetType.h"
|
||||
#include "td/telegram/StateManager.h"
|
||||
#include "td/telegram/StickerSetId.h"
|
||||
#include "td/telegram/StickersManager.h"
|
||||
@ -1557,15 +1559,34 @@ void UpdatesManager::after_get_difference() {
|
||||
<< postponed_pts_updates_.size() << " pending pts updates";
|
||||
}
|
||||
|
||||
td_->animations_manager_->after_get_difference();
|
||||
td_->contacts_manager_->after_get_difference();
|
||||
td_->download_manager_->after_get_difference();
|
||||
td_->inline_queries_manager_->after_get_difference();
|
||||
td_->messages_manager_->after_get_difference();
|
||||
td_->notification_settings_manager_->after_get_difference();
|
||||
td_->stickers_manager_->after_get_difference();
|
||||
send_closure_later(td_->notification_manager_actor_, &NotificationManager::after_get_difference);
|
||||
send_closure(G()->state_manager(), &StateManager::on_synchronized, true);
|
||||
|
||||
try_reload_data();
|
||||
}
|
||||
|
||||
void UpdatesManager::try_reload_data() {
|
||||
if (td_->auth_manager_->is_bot() || running_get_difference_ || !td_->is_online()) {
|
||||
return;
|
||||
}
|
||||
|
||||
td_->animations_manager_->get_saved_animations(Auto());
|
||||
td_->contacts_manager_->reload_created_public_dialogs(PublicDialogType::HasUsername, Auto());
|
||||
td_->contacts_manager_->reload_created_public_dialogs(PublicDialogType::IsLocationBased, Auto());
|
||||
td_->notification_settings_manager_->reload_saved_ringtones(Auto());
|
||||
td_->stickers_manager_->reload_reactions();
|
||||
td_->stickers_manager_->get_installed_sticker_sets(false, Auto());
|
||||
td_->stickers_manager_->get_installed_sticker_sets(true, Auto());
|
||||
td_->stickers_manager_->get_featured_sticker_sets(0, 1000, Auto());
|
||||
td_->stickers_manager_->get_recent_stickers(false, Auto());
|
||||
td_->stickers_manager_->get_recent_stickers(true, Auto());
|
||||
td_->stickers_manager_->get_favorite_stickers(Auto());
|
||||
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::animated_emoji());
|
||||
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::animated_emoji_click());
|
||||
}
|
||||
|
||||
void UpdatesManager::on_pending_updates(vector<tl_object_ptr<telegram_api::Update>> &&updates, int32 seq_begin,
|
||||
|
@ -331,6 +331,8 @@ class UpdatesManager final : public Actor {
|
||||
|
||||
void after_get_difference();
|
||||
|
||||
void try_reload_data();
|
||||
|
||||
static bool have_update_pts_changed(const vector<tl_object_ptr<telegram_api::Update>> &updates);
|
||||
|
||||
static bool check_pts_update_dialog_id(DialogId dialog_id);
|
||||
|
Loading…
Reference in New Issue
Block a user