2018-03-29 19:49:31 +00:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
|
2018-04-03 18:24:31 +00:00
|
|
|
#include "passport/passport_form_controller.h"
|
|
|
|
|
2018-03-29 19:49:31 +00:00
|
|
|
namespace Passport {
|
|
|
|
|
2018-04-03 18:24:31 +00:00
|
|
|
struct Scope {
|
|
|
|
enum class Type {
|
|
|
|
Identity,
|
|
|
|
Address,
|
|
|
|
Phone,
|
|
|
|
Email,
|
|
|
|
};
|
|
|
|
Scope(Type type, not_null<const Value*> fields);
|
|
|
|
|
|
|
|
Type type;
|
|
|
|
not_null<const Value*> fields;
|
2018-04-12 15:45:04 +00:00
|
|
|
std::vector<not_null<const Value*>> documents;
|
2018-04-03 18:24:31 +00:00
|
|
|
bool selfieRequired = false;
|
|
|
|
};
|
|
|
|
|
2018-04-12 15:45:04 +00:00
|
|
|
struct ScopeRow {
|
|
|
|
QString title;
|
|
|
|
QString description;
|
|
|
|
QString ready;
|
2018-04-13 17:42:28 +00:00
|
|
|
QString error;
|
2018-04-12 15:45:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<Scope> ComputeScopes(
|
|
|
|
not_null<const FormController*> controller);
|
|
|
|
QString ComputeScopeRowReadyString(const Scope &scope);
|
|
|
|
ScopeRow ComputeScopeRow(const Scope &scope);
|
2018-03-29 19:49:31 +00:00
|
|
|
|
|
|
|
class ViewController {
|
|
|
|
public:
|
2018-03-31 01:45:40 +00:00
|
|
|
virtual void showAskPassword() = 0;
|
|
|
|
virtual void showNoPassword() = 0;
|
2018-04-15 15:06:53 +00:00
|
|
|
virtual void showCriticalError(const QString &error) = 0;
|
2018-04-03 18:24:31 +00:00
|
|
|
virtual void editScope(int index) = 0;
|
2018-03-29 19:49:31 +00:00
|
|
|
|
2018-04-16 17:02:40 +00:00
|
|
|
virtual void showBox(
|
|
|
|
object_ptr<BoxContent> box,
|
|
|
|
LayerOptions options,
|
|
|
|
anim::type animated) = 0;
|
2018-04-13 10:54:17 +00:00
|
|
|
virtual void showToast(const QString &text) = 0;
|
2018-06-04 15:35:11 +00:00
|
|
|
virtual void suggestReset(Fn<void()> callback) = 0;
|
2018-04-06 16:23:09 +00:00
|
|
|
|
2018-04-13 18:14:14 +00:00
|
|
|
virtual int closeGetDuration() = 0;
|
|
|
|
|
2018-03-29 19:49:31 +00:00
|
|
|
virtual ~ViewController() {
|
|
|
|
}
|
|
|
|
|
2018-04-06 16:23:09 +00:00
|
|
|
template <typename BoxType>
|
2018-04-16 17:02:40 +00:00
|
|
|
QPointer<BoxType> show(
|
|
|
|
object_ptr<BoxType> box,
|
|
|
|
LayerOptions options = LayerOption::KeepOther,
|
|
|
|
anim::type animated = anim::type::normal) {
|
|
|
|
auto result = QPointer<BoxType>(box.data());
|
|
|
|
showBox(std::move(box), options, animated);
|
2018-04-06 16:23:09 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2018-03-29 19:49:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Passport
|