/* 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_thread.h" #include "dialogs/ui/dialogs_message_view.h" class PeerData; class History; namespace Data { class Session; class SavedMessages; class SavedSublist final : public Data::Thread { public: SavedSublist(not_null parent, not_null peer); ~SavedSublist(); [[nodiscard]] not_null parent() const; [[nodiscard]] not_null owningHistory() override; [[nodiscard]] ChannelData *parentChat() const; [[nodiscard]] not_null sublistPeer() const; [[nodiscard]] bool isHiddenAuthor() const; [[nodiscard]] bool isFullLoaded() const; [[nodiscard]] rpl::producer<> destroyed() const; [[nodiscard]] auto messages() const -> const std::vector> &; void applyMaybeLast(not_null item, bool added = false); void removeOne(not_null item); void append(std::vector> &&items, int fullCount); void setFullLoaded(bool loaded = true); [[nodiscard]] rpl::producer<> changes() const; [[nodiscard]] std::optional fullCount() const; [[nodiscard]] rpl::producer fullCountValue() const; int fixedOnTopIndex() const override; bool shouldBeInChatList() const override; Dialogs::UnreadState chatListUnreadState() const override; Dialogs::BadgesState chatListBadgesState() const override; HistoryItem *chatListMessage() const override; bool chatListMessageKnown() const override; const QString &chatListName() const override; const QString &chatListNameSortKey() const override; int chatListNameVersion() const override; const base::flat_set &chatListNameWords() const override; const base::flat_set &chatListFirstLetters() const override; void hasUnreadMentionChanged(bool has) override; void hasUnreadReactionChanged(bool has) override; [[nodiscard]] bool isServerSideUnread( not_null item) const override; void chatListPreloadData() override; void paintUserpic( Painter &p, Ui::PeerUserpicView &view, const Dialogs::Ui::PaintContext &context) const override; [[nodiscard]] auto sendActionPainter() -> HistoryView::SendActionPainter* override; private: enum class Flag : uchar { ResolveChatListMessage = (1 << 0), FullLoaded = (1 << 1), }; friend inline constexpr bool is_flag_type(Flag) { return true; } using Flags = base::flags; bool hasOrphanMediaGroupPart() const; void allowChatListMessageResolve(); void resolveChatListMessageGroup(); const not_null _parent; const not_null _history; std::vector> _items; std::optional _fullCount; rpl::event_stream<> _changed; Flags _flags; }; } // namespace Data