/* 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 "iv/iv_delegate.h" namespace Main { class Session; class SessionShow; } // namespace Main namespace Window { class SessionController; } // namespace Window namespace Iv { class Data; class Shown; class Instance final { public: explicit Instance(not_null delegate); ~Instance(); void show( not_null controller, not_null data, QString hash); void show( std::shared_ptr show, not_null data, QString hash); void show( not_null session, not_null data, QString hash); void openWithIvPreferred( not_null controller, QString uri, QVariant context = {}); void openWithIvPreferred( not_null session, QString uri, QVariant context = {}); [[nodiscard]] bool hasActiveWindow( not_null session) const; bool closeActive(); bool minimizeActive(); void closeAll(); [[nodiscard]] rpl::lifetime &lifetime(); private: void processOpenChannel(const QString &context); void processJoinChannel(const QString &context); void requestFull(not_null session, const QString &id); void trackSession(not_null session); const not_null _delegate; std::unique_ptr _shown; Main::Session *_shownSession = nullptr; base::flat_set> _tracking; base::flat_map< not_null, base::flat_set>> _joining; base::flat_map< not_null, base::flat_set> _fullRequested; base::flat_map< not_null, base::flat_map> _ivCache; Main::Session *_ivRequestSession = nullptr; QString _ivRequestUri; mtpRequestId _ivRequestId = 0; rpl::lifetime _lifetime; }; [[nodiscard]] bool PreferForUri(const QString &uri); } // namespace Iv