Added button for opening custom url to passport VerifyBox.
This commit is contained in:
parent
613d4932ca
commit
9896855789
|
@ -1322,6 +1322,7 @@ void PanelController::processVerificationNeeded(
|
||||||
return show(VerifyPhoneBox(
|
return show(VerifyPhoneBox(
|
||||||
text,
|
text,
|
||||||
value->verification.codeLength,
|
value->verification.codeLength,
|
||||||
|
value->verification.fragmentUrl,
|
||||||
[=](const QString &code) { _form->verify(value, code); },
|
[=](const QString &code) { _form->verify(value, code); },
|
||||||
|
|
||||||
value->verification.call ? rpl::single(
|
value->verification.call ? rpl::single(
|
||||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "passport/passport_panel_edit_contact.h"
|
#include "passport/passport_panel_edit_contact.h"
|
||||||
|
|
||||||
|
#include "core/file_utilities.h"
|
||||||
#include "passport/passport_panel_controller.h"
|
#include "passport/passport_panel_controller.h"
|
||||||
#include "passport/ui/passport_details_row.h"
|
#include "passport/ui/passport_details_row.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
|
@ -26,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "countries/countries_instance.h" // Countries::ExtractPhoneCode.
|
#include "countries/countries_instance.h" // Countries::ExtractPhoneCode.
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
#include "styles/style_boxes.h"
|
||||||
#include "styles/style_passport.h"
|
#include "styles/style_passport.h"
|
||||||
#include "styles/style_layers.h"
|
#include "styles/style_layers.h"
|
||||||
|
|
||||||
|
@ -39,6 +41,7 @@ public:
|
||||||
rpl::producer<QString> title,
|
rpl::producer<QString> title,
|
||||||
const QString &text,
|
const QString &text,
|
||||||
int codeLength,
|
int codeLength,
|
||||||
|
const QString &openUrl,
|
||||||
Fn<void(QString code)> submit,
|
Fn<void(QString code)> submit,
|
||||||
Fn<void()> resend,
|
Fn<void()> resend,
|
||||||
rpl::producer<QString> call,
|
rpl::producer<QString> call,
|
||||||
|
@ -54,6 +57,7 @@ private:
|
||||||
void setupControls(
|
void setupControls(
|
||||||
const QString &text,
|
const QString &text,
|
||||||
int codeLength,
|
int codeLength,
|
||||||
|
const QString &openUrl,
|
||||||
Fn<void(QString code)> submit,
|
Fn<void(QString code)> submit,
|
||||||
Fn<void()> resend,
|
Fn<void()> resend,
|
||||||
rpl::producer<QString> call,
|
rpl::producer<QString> call,
|
||||||
|
@ -72,6 +76,7 @@ VerifyBox::VerifyBox(
|
||||||
rpl::producer<QString> title,
|
rpl::producer<QString> title,
|
||||||
const QString &text,
|
const QString &text,
|
||||||
int codeLength,
|
int codeLength,
|
||||||
|
const QString &openUrl,
|
||||||
Fn<void(QString code)> submit,
|
Fn<void(QString code)> submit,
|
||||||
Fn<void()> resend,
|
Fn<void()> resend,
|
||||||
rpl::producer<QString> call,
|
rpl::producer<QString> call,
|
||||||
|
@ -81,6 +86,7 @@ VerifyBox::VerifyBox(
|
||||||
setupControls(
|
setupControls(
|
||||||
text,
|
text,
|
||||||
codeLength,
|
codeLength,
|
||||||
|
openUrl,
|
||||||
submit,
|
submit,
|
||||||
resend,
|
resend,
|
||||||
std::move(call),
|
std::move(call),
|
||||||
|
@ -91,6 +97,7 @@ VerifyBox::VerifyBox(
|
||||||
void VerifyBox::setupControls(
|
void VerifyBox::setupControls(
|
||||||
const QString &text,
|
const QString &text,
|
||||||
int codeLength,
|
int codeLength,
|
||||||
|
const QString &openUrl,
|
||||||
Fn<void(QString code)> submit,
|
Fn<void(QString code)> submit,
|
||||||
Fn<void()> resend,
|
Fn<void()> resend,
|
||||||
rpl::producer<QString> call,
|
rpl::producer<QString> call,
|
||||||
|
@ -130,6 +137,17 @@ void VerifyBox::setupControls(
|
||||||
std::move(call),
|
std::move(call),
|
||||||
st::boxDividerLabel),
|
st::boxDividerLabel),
|
||||||
small);
|
small);
|
||||||
|
if (!openUrl.isEmpty()) {
|
||||||
|
const auto button = _content->add(
|
||||||
|
object_ptr<Ui::RoundButton>(
|
||||||
|
_content,
|
||||||
|
tr::lng_intro_fragment_button(),
|
||||||
|
st::fragmentBoxButton),
|
||||||
|
small);
|
||||||
|
button->setClickedCallback([=] { ::File::OpenUrl(openUrl); });
|
||||||
|
button->setTextTransform(
|
||||||
|
Ui::RoundButton::TextTransform::NoTransform);
|
||||||
|
}
|
||||||
if (resend) {
|
if (resend) {
|
||||||
auto link = TextWithEntities{ tr::lng_cloud_password_resend(tr::now) };
|
auto link = TextWithEntities{ tr::lng_cloud_password_resend(tr::now) };
|
||||||
link.entities.push_back({
|
link.entities.push_back({
|
||||||
|
@ -144,9 +162,7 @@ void VerifyBox::setupControls(
|
||||||
link
|
link
|
||||||
) | rpl::then(rpl::duplicate(
|
) | rpl::then(rpl::duplicate(
|
||||||
resent
|
resent
|
||||||
) | rpl::map([](const QString &value) {
|
) | rpl::map(TextWithEntities::Simple)),
|
||||||
return TextWithEntities{ value };
|
|
||||||
})),
|
|
||||||
st::boxDividerLabel),
|
st::boxDividerLabel),
|
||||||
small);
|
small);
|
||||||
std::move(
|
std::move(
|
||||||
|
@ -392,6 +408,7 @@ void PanelEditContact::save(const QString &value) {
|
||||||
object_ptr<Ui::BoxContent> VerifyPhoneBox(
|
object_ptr<Ui::BoxContent> VerifyPhoneBox(
|
||||||
const QString &phone,
|
const QString &phone,
|
||||||
int codeLength,
|
int codeLength,
|
||||||
|
const QString &openUrl,
|
||||||
Fn<void(QString code)> submit,
|
Fn<void(QString code)> submit,
|
||||||
rpl::producer<QString> call,
|
rpl::producer<QString> call,
|
||||||
rpl::producer<QString> error) {
|
rpl::producer<QString> error) {
|
||||||
|
@ -402,6 +419,7 @@ object_ptr<Ui::BoxContent> VerifyPhoneBox(
|
||||||
lt_phone,
|
lt_phone,
|
||||||
Ui::FormatPhone(phone)),
|
Ui::FormatPhone(phone)),
|
||||||
codeLength,
|
codeLength,
|
||||||
|
openUrl,
|
||||||
submit,
|
submit,
|
||||||
nullptr,
|
nullptr,
|
||||||
std::move(call),
|
std::move(call),
|
||||||
|
@ -420,6 +438,7 @@ object_ptr<Ui::BoxContent> VerifyEmailBox(
|
||||||
tr::lng_passport_email_title(),
|
tr::lng_passport_email_title(),
|
||||||
tr::lng_passport_confirm_email(tr::now, lt_email, email),
|
tr::lng_passport_confirm_email(tr::now, lt_email, email),
|
||||||
codeLength,
|
codeLength,
|
||||||
|
QString(),
|
||||||
submit,
|
submit,
|
||||||
resend,
|
resend,
|
||||||
rpl::single(QString()),
|
rpl::single(QString()),
|
||||||
|
|
|
@ -78,6 +78,7 @@ private:
|
||||||
object_ptr<Ui::BoxContent> VerifyPhoneBox(
|
object_ptr<Ui::BoxContent> VerifyPhoneBox(
|
||||||
const QString &phone,
|
const QString &phone,
|
||||||
int codeLength,
|
int codeLength,
|
||||||
|
const QString &openUrl,
|
||||||
Fn<void(QString code)> submit,
|
Fn<void(QString code)> submit,
|
||||||
rpl::producer<QString> call,
|
rpl::producer<QString> call,
|
||||||
rpl::producer<QString> error);
|
rpl::producer<QString> error);
|
||||||
|
|
Loading…
Reference in New Issue