2017-08-29 19:52:52 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-08-29 19:52:52 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-08-29 19:52:52 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2021-06-30 19:10:53 +00:00
|
|
|
#include "data/data_abstract_sparse_ids.h"
|
2017-08-29 19:52:52 +00:00
|
|
|
#include "storage/storage_user_photos.h"
|
2017-11-30 17:33:27 +00:00
|
|
|
#include "base/weak_ptr.h"
|
2017-08-29 19:52:52 +00:00
|
|
|
|
2022-12-19 10:01:32 +00:00
|
|
|
class UserData;
|
|
|
|
|
2020-06-08 09:06:50 +00:00
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
2021-06-30 19:10:53 +00:00
|
|
|
class UserPhotosSlice final : public AbstractSparseIds<std::deque<PhotoId>> {
|
2017-08-29 19:52:52 +00:00
|
|
|
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;
|
2021-06-30 19:10:53 +00:00
|
|
|
const Key &key() const { return _key; }
|
2017-08-29 19:52:52 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Key _key;
|
|
|
|
|
2017-09-06 14:50:11 +00:00
|
|
|
friend class UserPhotosSliceBuilder;
|
2017-08-29 19:52:52 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
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);
|
2022-12-19 10:01:32 +00:00
|
|
|
|
|
|
|
[[nodiscard]] std::optional<PhotoId> SyncUserFallbackPhotoViewer(
|
|
|
|
not_null<UserData*> user);
|