/* 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 "passport/passport_form_view_controller.h" #include "passport/passport_form_controller.h" namespace Passport { class FormController; class Panel; struct ScanInfo { FileKey key; QString status; QImage thumb; bool deleted = false; }; class BoxPointer { public: BoxPointer(QPointer value = nullptr); BoxPointer(BoxPointer &&other); BoxPointer &operator=(BoxPointer &&other); ~BoxPointer(); BoxContent *get() const; operator BoxContent*() const; explicit operator bool() const; BoxContent *operator->() const; private: QPointer _value; }; class PanelController : public ViewController { public: PanelController(not_null form); not_null bot() const; QString privacyPolicyUrl() const; void submitPassword(const QString &password); rpl::producer passwordError() const; QString passwordHint() const; void uploadScan(QByteArray &&content); void deleteScan(int fileIndex); void restoreScan(int fileIndex); rpl::producer scanUpdated() const; QString defaultEmail() const; QString defaultPhoneNumber() const; void showAskPassword() override; void showNoPassword() override; void showPasswordUnconfirmed() override; void fillRows( base::lambda callback); void editScope(int index) override; void saveScope(ValueMap &&data, ValueMap &&filesData); void showBox(object_ptr box) override; void cancelAuth(); rpl::lifetime &lifetime(); private: void ensurePanelCreated(); void cancelValueEdit(); std::vector valueFiles(const Value &value) const; void processValueSaved(not_null value); void processVerificationNeeded(not_null value); ScanInfo collectScanInfo(const EditFile &file) const; QString getDefaultContactValue(Scope::Type type) const; not_null _form; std::vector _scopes; std::unique_ptr _panel; Scope *_editScope = nullptr; int _editScopeFilesIndex = -1; rpl::lifetime _lifetime; }; } // namespace Passport