/* 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" #include "base/timer.h" class ApiWrap; class PeerData; namespace Main { class Session; } // namespace Main namespace Api { class ViewsManager final { public: explicit ViewsManager(not_null api); void scheduleIncrement(not_null item); void removeIncremented(not_null peer); private: void viewsIncrement(); void done( QVector ids, const MTPmessages_MessageViews &result, mtpRequestId requestId); void fail(const MTP::Error &error, mtpRequestId requestId); const not_null _session; MTP::Sender _api; base::flat_map, base::flat_set> _incremented; base::flat_map, base::flat_set> _toIncrement; base::flat_map, mtpRequestId> _incrementRequests; base::flat_map> _incrementByRequest; base::Timer _incrementTimer; }; } // namespace Api