mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-30 17:16:46 +00:00
Added support of setting up of login email from intro.
This commit is contained in:
@@ -84,16 +84,19 @@ void CodeWidget::updateDescText() {
|
||||
const auto byTelegram = getData()->codeByTelegram;
|
||||
const auto isFragment = !getData()->codeByFragmentUrl.isEmpty();
|
||||
_isFragment = isFragment;
|
||||
setDescriptionText(
|
||||
isFragment
|
||||
? tr::lng_intro_fragment_about(
|
||||
lt_phone_number,
|
||||
rpl::single(TextWithEntities{
|
||||
.text = Ui::FormatPhone(getData()->phone)
|
||||
}),
|
||||
Ui::Text::RichLangValue)
|
||||
: (byTelegram ? tr::lng_code_from_telegram : tr::lng_code_desc)(
|
||||
Ui::Text::RichLangValue));
|
||||
setDescriptionText(isEmailVerification()
|
||||
? tr::lng_intro_email_confirm_subtitle(
|
||||
lt_email,
|
||||
rpl::single(Ui::Text::WrapEmailPattern(getData()->emailPattern)),
|
||||
Ui::Text::WithEntities)
|
||||
: isFragment
|
||||
? tr::lng_intro_fragment_about(
|
||||
lt_phone_number,
|
||||
rpl::single(
|
||||
TextWithEntities::Simple(Ui::FormatPhone(getData()->phone))),
|
||||
Ui::Text::RichLangValue)
|
||||
: (byTelegram ? tr::lng_code_from_telegram : tr::lng_code_desc)(
|
||||
Ui::Text::RichLangValue));
|
||||
if (getData()->codeByTelegram) {
|
||||
_noTelegramCode->show();
|
||||
_callTimer.cancel();
|
||||
@@ -350,11 +353,13 @@ void CodeWidget::submitCode(const QString &text) {
|
||||
_code->setEnabled(false);
|
||||
getData()->pwdState = Core::CloudPasswordState();
|
||||
_sentRequest = api().request(MTPauth_SignIn(
|
||||
MTP_flags(MTPauth_SignIn::Flag::f_phone_code),
|
||||
MTP_flags(isEmailVerification()
|
||||
? MTPauth_SignIn::Flag::f_email_verification
|
||||
: MTPauth_SignIn::Flag::f_phone_code),
|
||||
MTP_string(getData()->phone),
|
||||
MTP_bytes(getData()->phoneHash),
|
||||
MTP_string(_sentCode),
|
||||
MTPEmailVerification()
|
||||
MTP_emailVerificationCode(MTP_string(_sentCode))
|
||||
)).done([=](const MTPauth_Authorization &result) {
|
||||
codeSubmitDone(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
@@ -362,6 +367,10 @@ void CodeWidget::submitCode(const QString &text) {
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
||||
bool CodeWidget::isEmailVerification() const {
|
||||
return !getData()->emailPattern.isEmpty();
|
||||
}
|
||||
|
||||
rpl::producer<QString> CodeWidget::nextButtonText() const {
|
||||
return _isFragment.value(
|
||||
) | rpl::map([=](bool isFragment) {
|
||||
|
||||
Reference in New Issue
Block a user