Remove updatePinnedSavedMessagesTopics and handle updates on the TDLib side.

This commit is contained in:
levlam 2024-02-06 15:12:03 +03:00
parent 4882919461
commit 5d0b8c71a5
4 changed files with 7 additions and 10 deletions

View File

@ -6513,9 +6513,6 @@ updateChatOnlineMemberCount chat_id:int53 online_member_count:int32 = Update;
//@description Basic information about a Saved Messages topic has changed @topic New information about the topic
updateSavedMessagesTopic topic:foundSavedMessagesTopic = Update;
//@description The list of pinned Saved Messages topics has changed. The app can call getPinnedSavedMessagesTopics to get the new list
updatePinnedSavedMessagesTopics = Update;
//@description Basic information about a topic in a forum chat was changed @chat_id Chat identifier @info New information about the topic
updateForumTopicInfo chat_id:int53 info:forumTopicInfo = Update;

View File

@ -259,11 +259,11 @@ class ToggleSavedDialogPinQuery final : public Td::ResultHandler {
return on_error(result_ptr.move_as_error());
}
td_->saved_messages_manager_->on_update_pinned_saved_messages_topics();
promise_.set_value(Unit());
}
void on_error(Status status) final {
td_->saved_messages_manager_->reload_pinned_saved_messages_topics();
promise_.set_error(std::move(status));
}
};
@ -296,11 +296,11 @@ class ReorderPinnedSavedDialogsQuery final : public Td::ResultHandler {
if (!result) {
return on_error(Status::Error(400, "Result is false"));
}
td_->saved_messages_manager_->on_update_pinned_saved_messages_topics();
promise_.set_value(Unit());
}
void on_error(Status status) final {
td_->saved_messages_manager_->reload_pinned_saved_messages_topics();
promise_.set_error(std::move(status));
}
};
@ -872,13 +872,13 @@ void SavedMessagesManager::set_pinned_saved_messages_topics(vector<SavedMessages
td_->create_handler<ReorderPinnedSavedDialogsQuery>(std::move(promise))->send(std::move(saved_messages_topic_ids));
}
void SavedMessagesManager::on_update_pinned_saved_messages_topics() {
void SavedMessagesManager::reload_pinned_saved_messages_topics() {
if (td_->auth_manager_->is_bot()) {
// just in case
return;
}
send_closure(G()->td(), &Td::send_update, td_api::make_object<td_api::updatePinnedSavedMessagesTopics>());
td_->create_handler<GetPinnedSavedDialogsQuery>(Auto())->send();
}
void SavedMessagesManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {

View File

@ -57,7 +57,7 @@ class SavedMessagesManager final : public Actor {
void set_pinned_saved_messages_topics(vector<SavedMessagesTopicId> saved_messages_topic_ids, Promise<Unit> &&promise);
void on_update_pinned_saved_messages_topics();
void reload_pinned_saved_messages_topics();
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;

View File

@ -4048,12 +4048,12 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updatePinnedDialogs>
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateSavedDialogPinned> update, Promise<Unit> &&promise) {
td_->saved_messages_manager_->on_update_pinned_saved_messages_topics();
td_->saved_messages_manager_->reload_pinned_saved_messages_topics();
promise.set_value(Unit());
}
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updatePinnedSavedDialogs> update, Promise<Unit> &&promise) {
td_->saved_messages_manager_->on_update_pinned_saved_messages_topics();
td_->saved_messages_manager_->reload_pinned_saved_messages_topics();
promise.set_value(Unit());
}