Add td_api::clearAutosaveSettingsExceptions.
This commit is contained in:
parent
c5c9707837
commit
255d887bce
@ -7831,6 +7831,9 @@ setAutoDownloadSettings settings:autoDownloadSettings type:NetworkType = Ok;
|
||||
//@description Returns autosave settings for the current user
|
||||
getAutosaveSettings = AutosaveSettings;
|
||||
|
||||
//@description Clears the list of all autosave settings exceptions
|
||||
clearAutosaveSettingsExceptions = Ok;
|
||||
|
||||
|
||||
//@description Returns information about a bank card @bank_card_number The bank card number
|
||||
getBankCardInfo bank_card_number:string = BankCardInfo;
|
||||
|
@ -24,7 +24,7 @@ class GetAutosaveSettingsQuery final : public Td::ResultHandler {
|
||||
}
|
||||
|
||||
void send() {
|
||||
send_query(G()->net_query_creator().create(telegram_api::account_getAutoSaveSettings()));
|
||||
send_query(G()->net_query_creator().create(telegram_api::account_getAutoSaveSettings(), {{"me"}}));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
@ -43,6 +43,32 @@ class GetAutosaveSettingsQuery final : public Td::ResultHandler {
|
||||
}
|
||||
};
|
||||
|
||||
class DeleteAutosaveExceptionsQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
|
||||
public:
|
||||
explicit DeleteAutosaveExceptionsQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send() {
|
||||
send_query(G()->net_query_creator().create(telegram_api::account_deleteAutoSaveExceptions(), {{"me"}}));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
auto result_ptr = fetch_result<telegram_api::account_deleteAutoSaveExceptions>(packet);
|
||||
if (result_ptr.is_error()) {
|
||||
return on_error(result_ptr.move_as_error());
|
||||
}
|
||||
|
||||
promise_.set_value(Unit());
|
||||
}
|
||||
|
||||
void on_error(Status status) final {
|
||||
promise_.set_error(std::move(status));
|
||||
td_->autosave_manager_->reload_autosave_settings(Auto());
|
||||
}
|
||||
};
|
||||
|
||||
AutosaveManager::AutosaveManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
|
||||
}
|
||||
|
||||
@ -82,6 +108,10 @@ void AutosaveManager::get_autosave_settings(Promise<td_api::object_ptr<td_api::a
|
||||
return promise.set_value(settings_.get_autosave_settings_object());
|
||||
}
|
||||
|
||||
reload_autosave_settings(std::move(promise));
|
||||
}
|
||||
|
||||
void AutosaveManager::reload_autosave_settings(Promise<td_api::object_ptr<td_api::autosaveSettings>> &&promise) {
|
||||
load_settings_queries_.push_back(std::move(promise));
|
||||
if (load_settings_queries_.size() != 1) {
|
||||
return;
|
||||
@ -127,4 +157,9 @@ void AutosaveManager::on_get_autosave_settings(
|
||||
}
|
||||
}
|
||||
|
||||
void AutosaveManager::clear_autosave_settings_excpetions(Promise<Unit> &&promise) {
|
||||
settings_.exceptions_.clear();
|
||||
td_->create_handler<DeleteAutosaveExceptionsQuery>(std::move(promise))->send();
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -25,8 +25,12 @@ class AutosaveManager final : public Actor {
|
||||
public:
|
||||
AutosaveManager(Td *td, ActorShared<> parent);
|
||||
|
||||
void reload_autosave_settings(Promise<td_api::object_ptr<td_api::autosaveSettings>> &&promise);
|
||||
|
||||
void get_autosave_settings(Promise<td_api::object_ptr<td_api::autosaveSettings>> &&promise);
|
||||
|
||||
void clear_autosave_settings_excpetions(Promise<Unit> &&promise);
|
||||
|
||||
private:
|
||||
struct DialogAutosaveSettings {
|
||||
bool autosave_photos_ = false;
|
||||
|
@ -4952,6 +4952,12 @@ void Td::on_request(uint64 id, const td_api::getAutosaveSettings &request) {
|
||||
autosave_manager_->get_autosave_settings(std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::clearAutosaveSettingsExceptions &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
autosave_manager_->clear_autosave_settings_excpetions(std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getTopChats &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
|
@ -592,6 +592,8 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, const td_api::getAutosaveSettings &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::clearAutosaveSettingsExceptions &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::getTopChats &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::removeTopChat &request);
|
||||
|
@ -2833,6 +2833,8 @@ class CliClient final : public Actor {
|
||||
td_api::make_object<td_api::autoDownloadSettings>(), as_network_type(args)));
|
||||
} else if (op == "gaus") {
|
||||
send_request(td_api::make_object<td_api::getAutosaveSettings>());
|
||||
} else if (op == "cause") {
|
||||
send_request(td_api::make_object<td_api::clearAutosaveSettingsExceptions>());
|
||||
} else if (op == "ansc") {
|
||||
int32 sent_bytes;
|
||||
int32 received_bytes;
|
||||
|
Loading…
Reference in New Issue
Block a user