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-21 19:25:30 +01:00
|
|
|
#include "td/telegram/files/FileId.h"
|
|
|
|
#include "td/telegram/files/FileSourceId.h"
|
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"
|
2019-01-19 18:19:29 +01:00
|
|
|
#include "td/telegram/telegram_api.h"
|
2019-01-15 15:11:00 +01:00
|
|
|
|
|
|
|
#include "td/actor/actor.h"
|
|
|
|
#include "td/actor/PromiseFuture.h"
|
|
|
|
|
2019-02-12 22:26:36 +01:00
|
|
|
#include "td/utils/common.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
|
|
|
|
2019-01-30 22:37:38 +01:00
|
|
|
FileSourceId get_wallpapers_file_source_id();
|
2019-01-22 15:35:29 +01:00
|
|
|
|
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_;
|
2019-01-21 19:25:30 +01:00
|
|
|
vector<FileId> wallpaper_file_ids_;
|
|
|
|
FileSourceId wallpaper_source_id_;
|
2019-01-17 01:27:43 +01:00
|
|
|
|
|
|
|
vector<Promise<Unit>> pending_get_wallpapers_queries_;
|
|
|
|
|
2019-01-15 15:11:00 +01:00
|
|
|
Td *td_;
|
|
|
|
ActorShared<> parent_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace td
|