Add reload_wallpaper method.
GitOrigin-RevId: 3750ae5bc58719da6d1715d00e4edb054bde12ed
This commit is contained in:
parent
2bb8a7549d
commit
b275a77a84
@ -55,6 +55,10 @@ void WallpaperManager::get_wallpapers(Promise<Unit> &&promise) {
|
|||||||
return promise.set_value(Unit());
|
return promise.set_value(Unit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reload_wallpapers(std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
|
void WallpaperManager::reload_wallpapers(Promise<Unit> &&promise) {
|
||||||
pending_get_wallpapers_queries_.push_back(std::move(promise));
|
pending_get_wallpapers_queries_.push_back(std::move(promise));
|
||||||
if (pending_get_wallpapers_queries_.size() == 1) {
|
if (pending_get_wallpapers_queries_.size() == 1) {
|
||||||
auto request_promise = PromiseCreator::lambda(
|
auto request_promise = PromiseCreator::lambda(
|
||||||
@ -67,13 +71,13 @@ void WallpaperManager::get_wallpapers(Promise<Unit> &&promise) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WallpaperManager::on_get_wallpapers(Result<vector<telegram_api::object_ptr<telegram_api::WallPaper>>> result) {
|
void WallpaperManager::on_get_wallpapers(Result<vector<telegram_api::object_ptr<telegram_api::WallPaper>>> result) {
|
||||||
CHECK(wallpapers_.empty());
|
|
||||||
|
|
||||||
auto promises = std::move(pending_get_wallpapers_queries_);
|
auto promises = std::move(pending_get_wallpapers_queries_);
|
||||||
CHECK(!promises.empty());
|
CHECK(!promises.empty());
|
||||||
reset_to_empty(pending_get_wallpapers_queries_);
|
reset_to_empty(pending_get_wallpapers_queries_);
|
||||||
|
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
|
// do not clear wallpapers_
|
||||||
|
|
||||||
auto error = result.move_as_error();
|
auto error = result.move_as_error();
|
||||||
for (auto &promise : promises) {
|
for (auto &promise : promises) {
|
||||||
promise.set_error(error.clone());
|
promise.set_error(error.clone());
|
||||||
|
@ -22,7 +22,9 @@ class WallpaperManager : public Actor {
|
|||||||
public:
|
public:
|
||||||
WallpaperManager(Td *td, ActorShared<> parent);
|
WallpaperManager(Td *td, ActorShared<> parent);
|
||||||
|
|
||||||
void get_wallpapers(Promise<> &&promise);
|
void get_wallpapers(Promise<Unit> &&promise);
|
||||||
|
|
||||||
|
void reload_wallpapers(Promise<Unit> &&promise);
|
||||||
|
|
||||||
td_api::object_ptr<td_api::wallpapers> get_wallpapers_object() const;
|
td_api::object_ptr<td_api::wallpapers> get_wallpapers_object() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user