diff --git a/Telegram/SourceFiles/passport/passport_panel_controller.cpp b/Telegram/SourceFiles/passport/passport_panel_controller.cpp index dc7cc4164d..d3a39468c1 100644 --- a/Telegram/SourceFiles/passport/passport_panel_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_controller.cpp @@ -1322,6 +1322,7 @@ void PanelController::processVerificationNeeded( return show(VerifyPhoneBox( text, value->verification.codeLength, + value->verification.fragmentUrl, [=](const QString &code) { _form->verify(value, code); }, value->verification.call ? rpl::single( diff --git a/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp b/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp index 874efae815..859c17c514 100644 --- a/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_edit_contact.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "passport/passport_panel_edit_contact.h" +#include "core/file_utilities.h" #include "passport/passport_panel_controller.h" #include "passport/ui/passport_details_row.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 "main/main_session.h" #include "lang/lang_keys.h" +#include "styles/style_boxes.h" #include "styles/style_passport.h" #include "styles/style_layers.h" @@ -39,6 +41,7 @@ public: rpl::producer title, const QString &text, int codeLength, + const QString &openUrl, Fn submit, Fn resend, rpl::producer call, @@ -54,6 +57,7 @@ private: void setupControls( const QString &text, int codeLength, + const QString &openUrl, Fn submit, Fn resend, rpl::producer call, @@ -72,6 +76,7 @@ VerifyBox::VerifyBox( rpl::producer title, const QString &text, int codeLength, + const QString &openUrl, Fn submit, Fn resend, rpl::producer call, @@ -81,6 +86,7 @@ VerifyBox::VerifyBox( setupControls( text, codeLength, + openUrl, submit, resend, std::move(call), @@ -91,6 +97,7 @@ VerifyBox::VerifyBox( void VerifyBox::setupControls( const QString &text, int codeLength, + const QString &openUrl, Fn submit, Fn resend, rpl::producer call, @@ -130,6 +137,17 @@ void VerifyBox::setupControls( std::move(call), st::boxDividerLabel), small); + if (!openUrl.isEmpty()) { + const auto button = _content->add( + object_ptr( + _content, + tr::lng_intro_fragment_button(), + st::fragmentBoxButton), + small); + button->setClickedCallback([=] { ::File::OpenUrl(openUrl); }); + button->setTextTransform( + Ui::RoundButton::TextTransform::NoTransform); + } if (resend) { auto link = TextWithEntities{ tr::lng_cloud_password_resend(tr::now) }; link.entities.push_back({ @@ -144,9 +162,7 @@ void VerifyBox::setupControls( link ) | rpl::then(rpl::duplicate( resent - ) | rpl::map([](const QString &value) { - return TextWithEntities{ value }; - })), + ) | rpl::map(TextWithEntities::Simple)), st::boxDividerLabel), small); std::move( @@ -392,6 +408,7 @@ void PanelEditContact::save(const QString &value) { object_ptr VerifyPhoneBox( const QString &phone, int codeLength, + const QString &openUrl, Fn submit, rpl::producer call, rpl::producer error) { @@ -402,6 +419,7 @@ object_ptr VerifyPhoneBox( lt_phone, Ui::FormatPhone(phone)), codeLength, + openUrl, submit, nullptr, std::move(call), @@ -420,6 +438,7 @@ object_ptr VerifyEmailBox( tr::lng_passport_email_title(), tr::lng_passport_confirm_email(tr::now, lt_email, email), codeLength, + QString(), submit, resend, rpl::single(QString()), diff --git a/Telegram/SourceFiles/passport/passport_panel_edit_contact.h b/Telegram/SourceFiles/passport/passport_panel_edit_contact.h index f911dac894..718a8e9c2a 100644 --- a/Telegram/SourceFiles/passport/passport_panel_edit_contact.h +++ b/Telegram/SourceFiles/passport/passport_panel_edit_contact.h @@ -78,6 +78,7 @@ private: object_ptr VerifyPhoneBox( const QString &phone, int codeLength, + const QString &openUrl, Fn submit, rpl::producer call, rpl::producer error);