2018-04-06 11:54:01 +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
|
|
|
|
*/
|
|
|
|
#include "passport/passport_panel_edit_contact.h"
|
|
|
|
|
|
|
|
#include "passport/passport_panel_controller.h"
|
2021-03-23 16:06:59 +00:00
|
|
|
#include "passport/ui/passport_details_row.h"
|
2018-04-06 11:54:01 +00:00
|
|
|
#include "ui/widgets/input_fields.h"
|
|
|
|
#include "ui/widgets/labels.h"
|
|
|
|
#include "ui/widgets/buttons.h"
|
|
|
|
#include "ui/widgets/shadow.h"
|
2019-09-18 11:19:05 +00:00
|
|
|
#include "ui/widgets/box_content_divider.h"
|
2018-04-06 11:54:01 +00:00
|
|
|
#include "ui/wrap/vertical_layout.h"
|
2018-04-15 15:06:53 +00:00
|
|
|
#include "ui/wrap/slide_wrap.h"
|
2018-04-09 17:56:07 +00:00
|
|
|
#include "ui/wrap/fade_wrap.h"
|
2019-06-17 16:59:43 +00:00
|
|
|
#include "ui/text/text_utilities.h" // Ui::Text::ToUpper
|
2019-09-16 11:14:06 +00:00
|
|
|
#include "ui/special_fields.h"
|
2018-04-06 11:54:01 +00:00
|
|
|
#include "boxes/abstract_box.h"
|
2018-04-09 17:56:07 +00:00
|
|
|
#include "boxes/confirm_phone_box.h"
|
2019-08-06 16:40:08 +00:00
|
|
|
#include "data/data_user.h"
|
|
|
|
#include "main/main_session.h"
|
2018-04-06 11:54:01 +00:00
|
|
|
#include "lang/lang_keys.h"
|
2019-09-13 06:06:02 +00:00
|
|
|
#include "app.h"
|
2018-04-06 11:54:01 +00:00
|
|
|
#include "styles/style_passport.h"
|
2019-09-18 11:19:05 +00:00
|
|
|
#include "styles/style_layers.h"
|
2018-04-06 11:54:01 +00:00
|
|
|
|
|
|
|
namespace Passport {
|
2018-04-09 17:56:07 +00:00
|
|
|
namespace {
|
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
class VerifyBox : public Ui::BoxContent {
|
2018-04-09 17:56:07 +00:00
|
|
|
public:
|
|
|
|
VerifyBox(
|
2018-04-10 07:51:19 +00:00
|
|
|
QWidget*,
|
2019-06-18 15:00:55 +00:00
|
|
|
rpl::producer<QString> title,
|
2018-04-09 17:56:07 +00:00
|
|
|
const QString &text,
|
|
|
|
int codeLength,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(QString code)> submit,
|
2018-11-07 09:39:31 +00:00
|
|
|
Fn<void()> resend,
|
2018-04-09 17:56:07 +00:00
|
|
|
rpl::producer<QString> call,
|
2018-11-07 09:39:31 +00:00
|
|
|
rpl::producer<QString> error,
|
|
|
|
rpl::producer<QString> resent);
|
2018-04-09 17:56:07 +00:00
|
|
|
|
|
|
|
void setInnerFocus() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void setupControls(
|
|
|
|
const QString &text,
|
|
|
|
int codeLength,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(QString code)> submit,
|
2018-11-07 09:39:31 +00:00
|
|
|
Fn<void()> resend,
|
2018-04-09 17:56:07 +00:00
|
|
|
rpl::producer<QString> call,
|
2018-11-07 09:39:31 +00:00
|
|
|
rpl::producer<QString> error,
|
|
|
|
rpl::producer<QString> resent);
|
2018-04-09 17:56:07 +00:00
|
|
|
|
2019-06-18 15:00:55 +00:00
|
|
|
rpl::producer<QString> _title;
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void()> _submit;
|
2018-04-09 17:56:07 +00:00
|
|
|
QPointer<SentCodeField> _code;
|
2018-11-07 09:39:31 +00:00
|
|
|
QPointer<Ui::VerticalLayout> _content;
|
2018-04-09 17:56:07 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
VerifyBox::VerifyBox(
|
2018-04-10 07:51:19 +00:00
|
|
|
QWidget*,
|
2019-06-18 15:00:55 +00:00
|
|
|
rpl::producer<QString> title,
|
2018-04-09 17:56:07 +00:00
|
|
|
const QString &text,
|
|
|
|
int codeLength,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(QString code)> submit,
|
2018-11-07 09:39:31 +00:00
|
|
|
Fn<void()> resend,
|
2018-04-09 17:56:07 +00:00
|
|
|
rpl::producer<QString> call,
|
2018-11-07 09:39:31 +00:00
|
|
|
rpl::producer<QString> error,
|
|
|
|
rpl::producer<QString> resent)
|
2019-06-18 15:00:55 +00:00
|
|
|
: _title(std::move(title)) {
|
2018-04-12 10:20:54 +00:00
|
|
|
setupControls(
|
|
|
|
text,
|
|
|
|
codeLength,
|
|
|
|
submit,
|
2018-11-07 09:39:31 +00:00
|
|
|
resend,
|
2018-04-12 10:20:54 +00:00
|
|
|
std::move(call),
|
2018-11-07 09:39:31 +00:00
|
|
|
std::move(error),
|
|
|
|
std::move(resent));
|
2018-04-09 17:56:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VerifyBox::setupControls(
|
|
|
|
const QString &text,
|
|
|
|
int codeLength,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(QString code)> submit,
|
2018-11-07 09:39:31 +00:00
|
|
|
Fn<void()> resend,
|
2018-04-09 17:56:07 +00:00
|
|
|
rpl::producer<QString> call,
|
2018-11-07 09:39:31 +00:00
|
|
|
rpl::producer<QString> error,
|
|
|
|
rpl::producer<QString> resent) {
|
|
|
|
_content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
|
|
|
|
|
|
|
const auto small = style::margins(
|
|
|
|
st::boxPadding.left(),
|
|
|
|
0,
|
|
|
|
st::boxPadding.right(),
|
|
|
|
st::boxPadding.bottom());
|
|
|
|
const auto description = _content->add(
|
2018-04-09 17:56:07 +00:00
|
|
|
object_ptr<Ui::FlatLabel>(
|
2018-11-07 09:39:31 +00:00
|
|
|
_content,
|
|
|
|
text,
|
|
|
|
st::boxLabel),
|
|
|
|
small);
|
|
|
|
_code = _content->add(
|
|
|
|
object_ptr<SentCodeField>(
|
|
|
|
_content,
|
|
|
|
st::defaultInputField,
|
2019-06-18 14:07:45 +00:00
|
|
|
tr::lng_change_phone_code_title()),
|
2018-11-07 09:39:31 +00:00
|
|
|
small);
|
|
|
|
|
|
|
|
const auto problem = _content->add(
|
|
|
|
object_ptr<Ui::FadeWrap<Ui::FlatLabel>>(
|
|
|
|
_content,
|
|
|
|
object_ptr<Ui::FlatLabel>(
|
|
|
|
_content,
|
|
|
|
QString(),
|
|
|
|
st::passportVerifyErrorLabel)),
|
|
|
|
small);
|
|
|
|
const auto waiter = _content->add(
|
|
|
|
object_ptr<Ui::FlatLabel>(
|
|
|
|
_content,
|
|
|
|
std::move(call),
|
|
|
|
st::boxDividerLabel),
|
|
|
|
small);
|
|
|
|
if (resend) {
|
2019-06-19 15:09:03 +00:00
|
|
|
auto link = TextWithEntities{ tr::lng_cloud_password_resend(tr::now) };
|
2019-04-08 15:10:06 +00:00
|
|
|
link.entities.push_back({
|
|
|
|
EntityType::CustomUrl,
|
2018-11-07 09:39:31 +00:00
|
|
|
0,
|
|
|
|
link.text.size(),
|
2019-04-08 15:10:06 +00:00
|
|
|
QString("internal:resend") });
|
2018-11-07 09:39:31 +00:00
|
|
|
const auto label = _content->add(
|
|
|
|
object_ptr<Ui::FlatLabel>(
|
|
|
|
_content,
|
|
|
|
rpl::single(
|
|
|
|
link
|
|
|
|
) | rpl::then(rpl::duplicate(
|
|
|
|
resent
|
|
|
|
) | rpl::map([](const QString &value) {
|
|
|
|
return TextWithEntities{ value };
|
|
|
|
})),
|
|
|
|
st::boxDividerLabel),
|
|
|
|
small);
|
|
|
|
std::move(
|
|
|
|
resent
|
|
|
|
) | rpl::start_with_next([=] {
|
|
|
|
_content->resizeToWidth(st::boxWidth);
|
|
|
|
}, _content->lifetime());
|
|
|
|
label->setClickHandlerFilter([=](auto&&...) {
|
|
|
|
resend();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
2018-04-09 17:56:07 +00:00
|
|
|
std::move(
|
|
|
|
error
|
|
|
|
) | rpl::start_with_next([=](const QString &error) {
|
|
|
|
if (error.isEmpty()) {
|
|
|
|
problem->hide(anim::type::normal);
|
|
|
|
} else {
|
|
|
|
problem->entity()->setText(error);
|
2018-11-07 09:39:31 +00:00
|
|
|
_content->resizeToWidth(st::boxWidth);
|
2018-04-09 17:56:07 +00:00
|
|
|
problem->show(anim::type::normal);
|
|
|
|
_code->showError();
|
|
|
|
}
|
|
|
|
}, lifetime());
|
|
|
|
|
|
|
|
_submit = [=] {
|
2018-11-19 12:15:59 +00:00
|
|
|
submit(_code->getDigitsOnly());
|
2018-04-09 17:56:07 +00:00
|
|
|
};
|
|
|
|
if (codeLength > 0) {
|
|
|
|
_code->setAutoSubmit(codeLength, _submit);
|
|
|
|
} else {
|
|
|
|
connect(_code, &SentCodeField::submitted, _submit);
|
|
|
|
}
|
|
|
|
connect(_code, &SentCodeField::changed, [=] {
|
|
|
|
problem->hide(anim::type::normal);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void VerifyBox::setInnerFocus() {
|
|
|
|
_code->setFocusFast();
|
|
|
|
}
|
|
|
|
|
|
|
|
void VerifyBox::prepare() {
|
2019-06-18 15:00:55 +00:00
|
|
|
setTitle(std::move(_title));
|
2018-04-09 17:56:07 +00:00
|
|
|
|
2019-06-18 16:53:27 +00:00
|
|
|
addButton(tr::lng_change_phone_new_submit(), _submit);
|
|
|
|
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
2018-04-09 17:56:07 +00:00
|
|
|
|
2018-11-07 09:39:31 +00:00
|
|
|
_content->resizeToWidth(st::boxWidth);
|
|
|
|
_content->heightValue(
|
|
|
|
) | rpl::start_with_next([=](int height) {
|
|
|
|
setDimensions(st::boxWidth, height);
|
|
|
|
}, _content->lifetime());
|
2018-04-09 17:56:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
2018-04-06 11:54:01 +00:00
|
|
|
|
2018-04-12 15:45:04 +00:00
|
|
|
EditContactScheme::EditContactScheme(ValueType type) : type(type) {
|
2018-04-10 17:11:43 +00:00
|
|
|
}
|
|
|
|
|
2018-04-06 11:54:01 +00:00
|
|
|
PanelEditContact::PanelEditContact(
|
|
|
|
QWidget*,
|
|
|
|
not_null<PanelController*> controller,
|
|
|
|
Scheme scheme,
|
|
|
|
const QString &data,
|
|
|
|
const QString &existing)
|
|
|
|
: _controller(controller)
|
|
|
|
, _scheme(std::move(scheme))
|
|
|
|
, _content(this)
|
|
|
|
, _bottomShadow(this)
|
|
|
|
, _done(
|
|
|
|
this,
|
2019-06-18 16:53:27 +00:00
|
|
|
tr::lng_passport_save_value(),
|
2018-04-06 11:54:01 +00:00
|
|
|
st::passportPanelSaveValue) {
|
|
|
|
setupControls(data, existing);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PanelEditContact::setupControls(
|
|
|
|
const QString &data,
|
|
|
|
const QString &existing) {
|
|
|
|
widthValue(
|
|
|
|
) | rpl::start_with_next([=](int width) {
|
|
|
|
_content->resizeToWidth(width);
|
|
|
|
}, _content->lifetime());
|
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
_content->add(object_ptr<Ui::BoxContentDivider>(
|
2018-04-06 11:54:01 +00:00
|
|
|
_content,
|
|
|
|
st::passportFormDividerHeight));
|
|
|
|
if (!existing.isEmpty()) {
|
|
|
|
_content->add(
|
2019-11-02 17:06:47 +00:00
|
|
|
object_ptr<Ui::SettingsButton>(
|
2018-04-06 11:54:01 +00:00
|
|
|
_content,
|
2019-06-18 12:16:43 +00:00
|
|
|
tr::lng_passport_use_existing(
|
|
|
|
lt_existing,
|
|
|
|
rpl::single(_scheme.format
|
|
|
|
? _scheme.format(existing)
|
|
|
|
: existing)),
|
2018-04-06 11:54:01 +00:00
|
|
|
st::passportUploadButton),
|
|
|
|
st::passportUploadButtonPadding
|
|
|
|
)->addClickHandler([=] {
|
|
|
|
save(existing);
|
|
|
|
});
|
|
|
|
_content->add(
|
2018-06-04 11:43:49 +00:00
|
|
|
object_ptr<Ui::DividerLabel>(
|
2018-04-06 11:54:01 +00:00
|
|
|
_content,
|
|
|
|
object_ptr<Ui::FlatLabel>(
|
|
|
|
_content,
|
|
|
|
_scheme.aboutExisting,
|
2018-06-04 11:43:49 +00:00
|
|
|
st::boxDividerLabel),
|
2018-04-06 11:54:01 +00:00
|
|
|
st::passportFormLabelPadding));
|
|
|
|
_content->add(
|
|
|
|
object_ptr<Ui::FlatLabel>(
|
|
|
|
_content,
|
|
|
|
_scheme.newHeader,
|
|
|
|
st::passportFormHeader),
|
|
|
|
st::passportDetailsHeaderPadding);
|
2018-04-10 17:11:43 +00:00
|
|
|
}
|
|
|
|
const auto &fieldStyle = existing.isEmpty()
|
|
|
|
? st::passportContactField
|
|
|
|
: st::passportDetailsField;
|
|
|
|
const auto fieldPadding = existing.isEmpty()
|
|
|
|
? st::passportContactFieldPadding
|
|
|
|
: st::passportContactNewFieldPadding;
|
2019-06-18 14:07:45 +00:00
|
|
|
auto fieldPlaceholder = existing.isEmpty()
|
|
|
|
? rpl::duplicate(_scheme.newPlaceholder)
|
2018-04-10 17:11:43 +00:00
|
|
|
: nullptr;
|
|
|
|
auto wrap = object_ptr<Ui::RpWidget>(_content);
|
|
|
|
if (_scheme.type == Scheme::ValueType::Phone) {
|
|
|
|
_field = Ui::CreateChild<Ui::PhoneInput>(
|
|
|
|
wrap.data(),
|
|
|
|
fieldStyle,
|
2019-06-18 14:07:45 +00:00
|
|
|
std::move(fieldPlaceholder),
|
2021-03-29 12:16:54 +00:00
|
|
|
Ui::ExtractPhonePrefix(
|
|
|
|
_controller->bot()->session().user()->phone()),
|
2018-04-10 17:11:43 +00:00
|
|
|
data);
|
2018-04-06 11:54:01 +00:00
|
|
|
} else {
|
2018-04-10 17:11:43 +00:00
|
|
|
_field = Ui::CreateChild<Ui::MaskedInputField>(
|
|
|
|
wrap.data(),
|
|
|
|
fieldStyle,
|
2019-06-18 14:07:45 +00:00
|
|
|
std::move(fieldPlaceholder),
|
2018-04-10 17:11:43 +00:00
|
|
|
data);
|
2018-04-06 11:54:01 +00:00
|
|
|
}
|
2018-04-10 17:11:43 +00:00
|
|
|
|
|
|
|
_field->move(0, 0);
|
|
|
|
_field->heightValue(
|
|
|
|
) | rpl::start_with_next([=, pointer = wrap.data()](int height) {
|
|
|
|
pointer->resize(pointer->width(), height);
|
|
|
|
}, _field->lifetime());
|
|
|
|
wrap->widthValue(
|
|
|
|
) | rpl::start_with_next([=](int width) {
|
|
|
|
_field->resize(width, _field->height());
|
|
|
|
}, _field->lifetime());
|
|
|
|
|
|
|
|
_content->add(std::move(wrap), fieldPadding);
|
2018-04-15 15:06:53 +00:00
|
|
|
const auto errorWrap = _content->add(
|
|
|
|
object_ptr<Ui::SlideWrap<Ui::FlatLabel>>(
|
|
|
|
_content,
|
|
|
|
object_ptr<Ui::FlatLabel>(
|
|
|
|
_content,
|
|
|
|
QString(),
|
|
|
|
st::passportVerifyErrorLabel),
|
|
|
|
st::passportContactErrorPadding),
|
|
|
|
st::passportContactErrorMargin);
|
|
|
|
errorWrap->hide(anim::type::instant);
|
|
|
|
|
2018-04-06 11:54:01 +00:00
|
|
|
_content->add(
|
2018-06-04 11:43:49 +00:00
|
|
|
object_ptr<Ui::DividerLabel>(
|
2018-04-06 11:54:01 +00:00
|
|
|
_content,
|
|
|
|
object_ptr<Ui::FlatLabel>(
|
|
|
|
_content,
|
|
|
|
_scheme.aboutNew,
|
2018-06-04 11:43:49 +00:00
|
|
|
st::boxDividerLabel),
|
2018-04-06 11:54:01 +00:00
|
|
|
st::passportFormLabelPadding));
|
|
|
|
|
2018-04-13 16:48:59 +00:00
|
|
|
if (auto text = _controller->deleteValueLabel()) {
|
|
|
|
_content->add(
|
2019-11-02 17:06:47 +00:00
|
|
|
object_ptr<Ui::SettingsButton>(
|
2018-04-13 16:48:59 +00:00
|
|
|
_content,
|
2019-06-17 16:59:43 +00:00
|
|
|
std::move(*text) | Ui::Text::ToUpper(),
|
2018-04-13 16:48:59 +00:00
|
|
|
st::passportDeleteButton),
|
|
|
|
st::passportUploadButtonPadding
|
|
|
|
)->addClickHandler([=] {
|
|
|
|
_controller->deleteValue();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-04-15 15:06:53 +00:00
|
|
|
_controller->saveErrors(
|
|
|
|
) | rpl::start_with_next([=](const ScopeError &error) {
|
|
|
|
if (error.key == QString("value")) {
|
|
|
|
_field->showError();
|
|
|
|
errorWrap->entity()->setText(error.text);
|
2018-07-10 22:40:55 +00:00
|
|
|
_content->resizeToWidth(width());
|
2018-04-15 15:06:53 +00:00
|
|
|
errorWrap->show(anim::type::normal);
|
|
|
|
}
|
|
|
|
}, lifetime());
|
|
|
|
|
2018-04-09 17:56:07 +00:00
|
|
|
const auto submit = [=] {
|
2018-04-06 11:54:01 +00:00
|
|
|
crl::on_main(this, [=] {
|
|
|
|
save();
|
|
|
|
});
|
2018-04-09 17:56:07 +00:00
|
|
|
};
|
2018-04-10 17:11:43 +00:00
|
|
|
connect(_field, &Ui::MaskedInputField::submitted, submit);
|
2018-04-15 15:06:53 +00:00
|
|
|
connect(_field, &Ui::MaskedInputField::changed, [=] {
|
|
|
|
errorWrap->hide(anim::type::normal);
|
|
|
|
});
|
2018-04-09 17:56:07 +00:00
|
|
|
_done->addClickHandler(submit);
|
2018-04-06 11:54:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PanelEditContact::focusInEvent(QFocusEvent *e) {
|
2018-04-13 05:11:53 +00:00
|
|
|
crl::on_main(this, [=] {
|
|
|
|
_field->setFocusFast();
|
|
|
|
});
|
2018-04-06 11:54:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PanelEditContact::resizeEvent(QResizeEvent *e) {
|
|
|
|
updateControlsGeometry();
|
|
|
|
}
|
|
|
|
|
|
|
|
void PanelEditContact::updateControlsGeometry() {
|
|
|
|
const auto submitTop = height() - _done->height();
|
|
|
|
_bottomShadow->resizeToWidth(width());
|
|
|
|
_bottomShadow->moveToLeft(0, submitTop - st::lineWidth);
|
|
|
|
_done->resizeToWidth(width());
|
|
|
|
_done->moveToLeft(0, submitTop);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PanelEditContact::save() {
|
|
|
|
const auto result = _field->getLastText();
|
|
|
|
const auto processed = _scheme.postprocess
|
|
|
|
? _scheme.postprocess(result)
|
|
|
|
: result;
|
|
|
|
if (_scheme.validate && !_scheme.validate(processed)) {
|
|
|
|
_field->showError();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
save(processed);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PanelEditContact::save(const QString &value) {
|
|
|
|
auto data = ValueMap();
|
2018-04-15 15:06:53 +00:00
|
|
|
data.fields["value"].text = value;
|
2018-04-06 11:54:01 +00:00
|
|
|
_controller->saveScope(std::move(data), {});
|
|
|
|
}
|
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
object_ptr<Ui::BoxContent> VerifyPhoneBox(
|
2018-04-09 17:56:07 +00:00
|
|
|
const QString &phone,
|
|
|
|
int codeLength,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(QString code)> submit,
|
2018-04-09 17:56:07 +00:00
|
|
|
rpl::producer<QString> call,
|
|
|
|
rpl::producer<QString> error) {
|
|
|
|
return Box<VerifyBox>(
|
2019-06-18 15:00:55 +00:00
|
|
|
tr::lng_passport_phone_title(),
|
2019-06-19 16:39:25 +00:00
|
|
|
tr::lng_passport_confirm_phone(
|
|
|
|
tr::now,
|
|
|
|
lt_phone,
|
|
|
|
App::formatPhone(phone)),
|
2018-04-09 17:56:07 +00:00
|
|
|
codeLength,
|
|
|
|
submit,
|
2018-11-07 09:39:31 +00:00
|
|
|
nullptr,
|
2018-04-09 17:56:07 +00:00
|
|
|
std::move(call),
|
2018-11-07 09:39:31 +00:00
|
|
|
std::move(error),
|
2019-06-18 14:07:45 +00:00
|
|
|
nullptr);
|
2018-04-09 17:56:07 +00:00
|
|
|
}
|
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
object_ptr<Ui::BoxContent> VerifyEmailBox(
|
2018-04-09 17:56:07 +00:00
|
|
|
const QString &email,
|
|
|
|
int codeLength,
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void(QString code)> submit,
|
2018-11-07 09:39:31 +00:00
|
|
|
Fn<void()> resend,
|
|
|
|
rpl::producer<QString> error,
|
|
|
|
rpl::producer<QString> resent) {
|
2018-04-09 17:56:07 +00:00
|
|
|
return Box<VerifyBox>(
|
2019-06-18 15:00:55 +00:00
|
|
|
tr::lng_passport_email_title(),
|
2019-06-19 16:39:25 +00:00
|
|
|
tr::lng_passport_confirm_email(tr::now, lt_email, email),
|
2018-04-09 17:56:07 +00:00
|
|
|
codeLength,
|
|
|
|
submit,
|
2018-11-07 09:39:31 +00:00
|
|
|
resend,
|
2018-04-09 17:56:07 +00:00
|
|
|
rpl::single(QString()),
|
2018-11-07 09:39:31 +00:00
|
|
|
std::move(error),
|
|
|
|
std::move(resent));
|
2018-04-09 17:56:07 +00:00
|
|
|
}
|
|
|
|
|
2018-04-06 11:54:01 +00:00
|
|
|
} // namespace Passport
|