tdesktop/Telegram/SourceFiles/data/data_user_photos.h

56 lines
1.3 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "data/data_abstract_sparse_ids.h"
#include "storage/storage_user_photos.h"
#include "base/weak_ptr.h"
class UserData;
2020-06-08 09:06:50 +00:00
namespace Main {
class Session;
} // namespace Main
class UserPhotosSlice final : public AbstractSparseIds<std::deque<PhotoId>> {
public:
using Key = Storage::UserPhotosKey;
UserPhotosSlice(Key key);
2017-09-06 14:50:11 +00:00
UserPhotosSlice(
Key key,
2017-11-23 09:58:12 +00:00
std::deque<PhotoId> &&ids,
2018-09-21 16:28:46 +00:00
std::optional<int> fullCount,
std::optional<int> skippedBefore,
std::optional<int> skippedAfter);
2017-11-23 09:58:12 +00:00
2018-09-21 16:28:46 +00:00
std::optional<int> distance(const Key &a, const Key &b) const;
const Key &key() const { return _key; }
private:
Key _key;
2017-09-06 14:50:11 +00:00
friend class UserPhotosSliceBuilder;
};
2017-09-06 14:50:11 +00:00
rpl::producer<UserPhotosSlice> UserPhotosViewer(
2020-06-08 09:06:50 +00:00
not_null<Main::Session*> session,
2017-09-06 14:50:11 +00:00
UserPhotosSlice::Key key,
int limitBefore,
int limitAfter);
2017-11-23 09:58:12 +00:00
rpl::producer<UserPhotosSlice> UserPhotosReversedViewer(
2020-06-08 09:06:50 +00:00
not_null<Main::Session*> session,
2017-11-23 09:58:12 +00:00
UserPhotosSlice::Key key,
int limitBefore,
int limitAfter);
[[nodiscard]] std::optional<PhotoId> SyncUserFallbackPhotoViewer(
not_null<UserData*> user);