Simplify background unsaving.
This commit is contained in:
parent
c91653ba58
commit
36bcbcb418
@ -176,17 +176,16 @@ class UploadBackgroundQuery : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class SaveBackgroundQuery : public Td::ResultHandler {
|
class UnsaveBackgroundQuery : public Td::ResultHandler {
|
||||||
Promise<Unit> promise_;
|
Promise<Unit> promise_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SaveBackgroundQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
explicit UnsaveBackgroundQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void send(BackgroundId background_id, int64 access_hash, const BackgroundType &type, bool unsave) {
|
void send(telegram_api::object_ptr<telegram_api::InputWallPaper> input_wallpaper) {
|
||||||
send_query(G()->net_query_creator().create(telegram_api::account_saveWallPaper(
|
send_query(G()->net_query_creator().create(telegram_api::account_saveWallPaper(
|
||||||
telegram_api::make_object<telegram_api::inputWallPaper>(background_id.get(), access_hash), unsave,
|
std::move(input_wallpaper), true, telegram_api::make_object<telegram_api::wallPaperSettings>())));
|
||||||
get_input_wallpaper_settings(type))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_result(uint64 id, BufferSlice packet) override {
|
void on_result(uint64 id, BufferSlice packet) override {
|
||||||
@ -757,8 +756,8 @@ void BackgroundManager::remove_background(BackgroundId background_id, Promise<Un
|
|||||||
return query_promise.set_value(Unit());
|
return query_promise.set_value(Unit());
|
||||||
}
|
}
|
||||||
|
|
||||||
td_->create_handler<SaveBackgroundQuery>(std::move(query_promise))
|
td_->create_handler<UnsaveBackgroundQuery>(std::move(query_promise))
|
||||||
->send(background_id, background->access_hash, background->type, true);
|
->send(telegram_api::make_object<telegram_api::inputWallPaper>(background_id.get(), background->access_hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundManager::on_removed_background(BackgroundId background_id, Result<Unit> &&result,
|
void BackgroundManager::on_removed_background(BackgroundId background_id, Result<Unit> &&result,
|
||||||
|
Loading…
Reference in New Issue
Block a user