Add AnimationsManager::get_current_state.
GitOrigin-RevId: 77349703eb55cf61b13941dba7bd513068c8519c
This commit is contained in:
parent
f9de09833c
commit
e1812c6531
@ -665,14 +665,14 @@ void AnimationsManager::remove_saved_animation(const tl_object_ptr<td_api::Input
|
||||
send_update_saved_animations();
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::updateSavedAnimations> AnimationsManager::get_update_saved_animatoions_object() const {
|
||||
return td_api::make_object<td_api::updateSavedAnimations>(
|
||||
transform(saved_animation_ids_, [](FileId animation_id) { return animation_id.get(); }));
|
||||
}
|
||||
|
||||
void AnimationsManager::send_update_saved_animations(bool from_database) {
|
||||
if (are_saved_animations_loaded_) {
|
||||
vector<int32> animations;
|
||||
animations.reserve(saved_animation_ids_.size());
|
||||
for (auto animation_id : saved_animation_ids_) {
|
||||
animations.push_back(animation_id.get());
|
||||
}
|
||||
send_closure(G()->td(), &Td::send_update, make_tl_object<td_api::updateSavedAnimations>(std::move(animations)));
|
||||
send_closure(G()->td(), &Td::send_update, get_update_saved_animatoions_object());
|
||||
|
||||
if (!from_database) {
|
||||
save_saved_animations_to_database();
|
||||
@ -694,4 +694,10 @@ string AnimationsManager::get_animation_search_text(FileId file_id) const {
|
||||
return animation->file_name;
|
||||
}
|
||||
|
||||
void AnimationsManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
|
||||
if (are_saved_animations_loaded_) {
|
||||
updates.push_back(get_update_saved_animatoions_object());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -81,6 +81,8 @@ class AnimationsManager : public Actor {
|
||||
|
||||
string get_animation_search_text(FileId file_id) const;
|
||||
|
||||
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
|
||||
|
||||
private:
|
||||
class Animation {
|
||||
public:
|
||||
@ -111,6 +113,8 @@ class AnimationsManager : public Actor {
|
||||
|
||||
void on_load_saved_animations_finished(vector<FileId> &&saved_animation_ids, bool from_database = false);
|
||||
|
||||
td_api::object_ptr<td_api::updateSavedAnimations> get_update_saved_animatoions_object() const;
|
||||
|
||||
void send_update_saved_animations(bool from_database = false);
|
||||
|
||||
void save_saved_animations_to_database();
|
||||
|
@ -4587,19 +4587,23 @@ void Td::on_request(uint64 id, const td_api::getCurrentState &request) {
|
||||
|
||||
updates.push_back(td_api::make_object<td_api::updateConnectionState>(get_connection_state_object(connection_state_)));
|
||||
|
||||
contacts_manager_->get_current_state(updates);
|
||||
if (auth_manager_->is_authorized()) {
|
||||
contacts_manager_->get_current_state(updates);
|
||||
|
||||
stickers_manager_->get_current_state(updates);
|
||||
animations_manager_->get_current_state(updates);
|
||||
|
||||
/*
|
||||
// TODO
|
||||
updateUnreadMessageCount {
|
||||
updateUnreadChatCount {
|
||||
updateScopeNotificationSettings {
|
||||
updateScopeNotificationSettings {
|
||||
updateNewChat {
|
||||
updateChatLastMessage {
|
||||
*/
|
||||
stickers_manager_->get_current_state(updates);
|
||||
|
||||
/*
|
||||
// TODO
|
||||
updateUnreadMessageCount {
|
||||
updateUnreadChatCount {
|
||||
updateScopeNotificationSettings {
|
||||
updateScopeNotificationSettings {
|
||||
updateNewChat {
|
||||
updateChatLastMessage {
|
||||
*/
|
||||
}
|
||||
|
||||
// send response synchronously to prevent "Request aborted" or other changes of the current state
|
||||
send_result(id, td_api::make_object<td_api::updates>(std::move(updates)));
|
||||
|
Loading…
Reference in New Issue
Block a user