2019-01-15 15:11:00 +01:00
|
|
|
//
|
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2019
|
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
2019-01-17 01:27:43 +01:00
|
|
|
#include "td/telegram/Photo.h"
|
2019-01-15 15:11:00 +01:00
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
|
|
|
|
#include "td/actor/actor.h"
|
|
|
|
#include "td/actor/PromiseFuture.h"
|
|
|
|
|
2019-01-17 01:27:43 +01:00
|
|
|
#include "td/utils/Status.h"
|
|
|
|
|
2019-01-15 15:11:00 +01:00
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class Td;
|
|
|
|
|
|
|
|
class WallpaperManager : public Actor {
|
|
|
|
public:
|
|
|
|
WallpaperManager(Td *td, ActorShared<> parent);
|
|
|
|
|
2019-01-18 12:33:23 +01:00
|
|
|
void get_wallpapers(Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void reload_wallpapers(Promise<Unit> &&promise);
|
2019-01-17 01:27:43 +01:00
|
|
|
|
|
|
|
td_api::object_ptr<td_api::wallpapers> get_wallpapers_object() const;
|
2019-01-15 15:11:00 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void tear_down() override;
|
|
|
|
|
2019-01-17 01:27:43 +01:00
|
|
|
void on_get_wallpapers(Result<vector<telegram_api::object_ptr<telegram_api::WallPaper>>> result);
|
|
|
|
|
|
|
|
struct Wallpaper {
|
|
|
|
int32 id = 0;
|
|
|
|
vector<PhotoSize> sizes;
|
|
|
|
int32 color = 0;
|
|
|
|
|
|
|
|
Wallpaper(int32 id, vector<PhotoSize> sizes, int32 color) : id(id), sizes(std::move(sizes)), color(color) {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
vector<Wallpaper> wallpapers_;
|
|
|
|
|
|
|
|
vector<Promise<Unit>> pending_get_wallpapers_queries_;
|
|
|
|
|
2019-01-15 15:11:00 +01:00
|
|
|
Td *td_;
|
|
|
|
ActorShared<> parent_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace td
|