2021-09-07 18:44:01 +03: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 HistoryItem;
|
|
|
|
|
2021-09-09 00:10:49 +03:00
|
|
|
namespace style {
|
|
|
|
struct WhoRead;
|
|
|
|
} // namespace style
|
|
|
|
|
2021-09-07 18:44:01 +03:00
|
|
|
namespace Ui {
|
|
|
|
struct WhoReadContent;
|
2022-01-18 20:46:10 +03:00
|
|
|
enum class WhoReadType;
|
2021-09-07 18:44:01 +03:00
|
|
|
} // namespace Ui
|
|
|
|
|
2022-08-16 14:28:17 +03:00
|
|
|
namespace Data {
|
|
|
|
struct ReactionId;
|
|
|
|
} // namespace Data
|
|
|
|
|
2021-09-07 18:44:01 +03:00
|
|
|
namespace Api {
|
|
|
|
|
2022-08-26 13:35:19 +04:00
|
|
|
enum class WhoReactedList {
|
|
|
|
All,
|
|
|
|
One,
|
|
|
|
};
|
|
|
|
|
2023-06-01 20:01:29 +04:00
|
|
|
[[nodiscard]] QString FormatReadDate(TimeId date, const QDateTime &now);
|
2021-09-07 18:44:01 +03:00
|
|
|
[[nodiscard]] bool WhoReadExists(not_null<HistoryItem*> item);
|
2022-08-26 13:35:19 +04:00
|
|
|
[[nodiscard]] bool WhoReactedExists(
|
|
|
|
not_null<HistoryItem*> item,
|
|
|
|
WhoReactedList list);
|
2021-09-07 18:44:01 +03:00
|
|
|
|
2023-03-03 17:15:02 +04:00
|
|
|
struct WhoReadPeer {
|
|
|
|
PeerId peer = 0;
|
|
|
|
TimeId date = 0;
|
2023-03-08 14:06:08 +04:00
|
|
|
bool dateReacted = false;
|
2023-03-03 17:15:02 +04:00
|
|
|
|
|
|
|
friend inline bool operator==(
|
|
|
|
const WhoReadPeer &a,
|
|
|
|
const WhoReadPeer &b) noexcept = default;
|
|
|
|
};
|
|
|
|
|
2022-01-18 20:46:10 +03:00
|
|
|
struct WhoReadList {
|
2023-03-03 17:15:02 +04:00
|
|
|
std::vector<WhoReadPeer> list;
|
2022-01-18 20:46:10 +03:00
|
|
|
Ui::WhoReadType type = {};
|
|
|
|
};
|
|
|
|
|
2021-09-07 18:44:01 +03:00
|
|
|
// The context must be destroyed before the session holding this item.
|
2021-12-24 13:51:53 +00:00
|
|
|
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhoReacted(
|
2021-09-07 18:44:01 +03:00
|
|
|
not_null<HistoryItem*> item,
|
2022-01-18 20:46:10 +03:00
|
|
|
not_null<QWidget*> context, // Cache results for this lifetime.
|
|
|
|
const style::WhoRead &st,
|
|
|
|
std::shared_ptr<WhoReadList> whoReadIds = nullptr);
|
2022-01-14 18:42:24 +03:00
|
|
|
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhoReacted(
|
|
|
|
not_null<HistoryItem*> item,
|
2022-08-16 14:28:17 +03:00
|
|
|
const Data::ReactionId &reaction,
|
2022-01-18 20:46:10 +03:00
|
|
|
not_null<QWidget*> context, // Cache results for this lifetime.
|
|
|
|
const style::WhoRead &st);
|
2024-10-11 14:08:04 +04:00
|
|
|
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhenEdited(
|
|
|
|
not_null<PeerData*> author,
|
|
|
|
TimeId date);
|
2024-12-11 14:30:14 +04:00
|
|
|
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhenOriginal(
|
|
|
|
not_null<PeerData*> author,
|
|
|
|
TimeId date);
|
2021-09-07 18:44:01 +03:00
|
|
|
|
|
|
|
} // namespace Api
|