1 /* 2 This file is part of Telegram Desktop, 3 the official desktop application for the Telegram messaging service. 4 5 For license and copyright information please follow this link: 6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL 7 */ 8 #pragma once 9 10 #include "mtproto/sender.h" 11 12 namespace Core { 13 struct CloudPasswordState; 14 } // namespace Core 15 16 class ApiWrap; 17 18 namespace Main { 19 class Session; 20 } // namespace Main 21 22 namespace Api { 23 24 class CloudPassword final { 25 public: 26 using ResetRetryDate = int; 27 explicit CloudPassword(not_null<ApiWrap*> api); 28 29 void reload(); 30 void clearUnconfirmedPassword(); 31 rpl::producer<Core::CloudPasswordState> state() const; 32 std::optional<Core::CloudPasswordState> stateCurrent() const; 33 34 rpl::producer<ResetRetryDate, QString> resetPassword(); 35 rpl::producer<rpl::no_value, QString> cancelResetPassword(); 36 37 private: 38 MTP::Sender _api; 39 mtpRequestId _requestId = 0; 40 std::unique_ptr<Core::CloudPasswordState> _state; 41 rpl::event_stream<Core::CloudPasswordState> _stateChanges; 42 43 }; 44 45 } // namespace Api 46