2022-01-26 16:01:40 +00:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
|
|
|
|
class ApiWrap;
|
|
|
|
class PeerData;
|
|
|
|
class ChannelData;
|
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
namespace Data {
|
|
|
|
class Thread;
|
|
|
|
} // namespace Data
|
2022-10-07 13:56:07 +00:00
|
|
|
|
2022-01-26 16:01:40 +00:00
|
|
|
namespace Api {
|
|
|
|
|
|
|
|
class UnreadThings final {
|
|
|
|
public:
|
|
|
|
explicit UnreadThings(not_null<ApiWrap*> api);
|
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
[[nodiscard]] bool trackMentions(Data::Thread *thread) const;
|
|
|
|
[[nodiscard]] bool trackReactions(Data::Thread *thread) const;
|
2022-01-26 16:01:40 +00:00
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
void preloadEnough(Data::Thread *thread);
|
2022-01-26 16:01:40 +00:00
|
|
|
|
|
|
|
void mediaAndMentionsRead(
|
|
|
|
const base::flat_set<MsgId> &readIds,
|
|
|
|
ChannelData *channel = nullptr);
|
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
void cancelRequests(not_null<Data::Thread*> thread);
|
2022-10-07 13:56:07 +00:00
|
|
|
|
2022-01-26 16:01:40 +00:00
|
|
|
private:
|
2022-10-13 10:32:03 +00:00
|
|
|
void preloadEnoughMentions(not_null<Data::Thread*> thread);
|
|
|
|
void preloadEnoughReactions(not_null<Data::Thread*> thread);
|
2022-01-26 16:01:40 +00:00
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
void requestMentions(not_null<Data::Thread*> thread, int loaded);
|
|
|
|
void requestReactions(not_null<Data::Thread*> thread, int loaded);
|
2022-01-26 16:01:40 +00:00
|
|
|
|
|
|
|
const not_null<ApiWrap*> _api;
|
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
base::flat_map<not_null<Data::Thread*>, mtpRequestId> _mentionsRequests;
|
|
|
|
base::flat_map<not_null<Data::Thread*>, mtpRequestId> _reactionsRequests;
|
2022-01-26 16:01:40 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Api
|