This repository has been archived on 2020-05-25. You can view files and clone it, but cannot push or open issues or pull requests.
tdlib-fork/td/telegram/WallpaperManager.h
levlam d04a1a61cc Add wallpapers file source for wallpapers registered by remote location.
GitOrigin-RevId: a0994ef92ef927d780acf6a79cfad5b424d93784
2019-01-22 17:35:29 +03:00

60 lines
1.5 KiB
C++

//
// 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
#include "td/telegram/files/FileId.h"
#include "td/telegram/files/FileSourceId.h"
#include "td/telegram/Photo.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/actor/actor.h"
#include "td/actor/PromiseFuture.h"
#include "td/utils/Status.h"
namespace td {
class Td;
class WallpaperManager : public Actor {
public:
WallpaperManager(Td *td, ActorShared<> parent);
void get_wallpapers(Promise<Unit> &&promise);
void reload_wallpapers(Promise<Unit> &&promise);
td_api::object_ptr<td_api::wallpapers> get_wallpapers_object() const;
void add_wallpapers_file_source(FileId file_id);
private:
void tear_down() override;
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<FileId> wallpaper_file_ids_;
FileSourceId wallpaper_source_id_;
vector<Promise<Unit>> pending_get_wallpapers_queries_;
Td *td_;
ActorShared<> parent_;
};
} // namespace td