/* 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 "mtproto/sender.h" class ApiWrap; namespace Main { class Session; } // namespace Main namespace Api { enum class ReactionsNotifyFrom : uchar { None, Contacts, All, }; class ReactionsNotifySettings final { public: explicit ReactionsNotifySettings(not_null api); void reload(Fn callback = nullptr); void updateMessagesFrom(ReactionsNotifyFrom value); void updatePollVotesFrom(ReactionsNotifyFrom value); void setAllFrom(ReactionsNotifyFrom value); void updateShowPreviews(bool value); [[nodiscard]] ReactionsNotifyFrom messagesFromCurrent() const; [[nodiscard]] rpl::producer messagesFrom() const; [[nodiscard]] ReactionsNotifyFrom pollVotesFromCurrent() const; [[nodiscard]] rpl::producer pollVotesFrom() const; [[nodiscard]] bool showPreviewsCurrent() const; [[nodiscard]] rpl::producer showPreviews() const; [[nodiscard]] bool enabledCurrent() const; [[nodiscard]] rpl::producer enabled() const; private: void apply(const MTPReactionsNotifySettings &settings); void save(); const not_null _session; MTP::Sender _api; mtpRequestId _requestId = 0; rpl::variable _messagesFrom = ReactionsNotifyFrom::All; rpl::variable _storiesFrom = ReactionsNotifyFrom::All; rpl::variable _pollVotesFrom = ReactionsNotifyFrom::All; rpl::variable _showPreviews = true; std::vector> _callbacks; }; } // namespace Api