Return request for code resend on auth.

This commit is contained in:
John Preston 2021-04-13 17:51:42 +04:00
parent 5ff70315cb
commit d71b6effd6
1 changed files with 14 additions and 12 deletions

View File

@ -397,18 +397,17 @@ void CodeWidget::submit() {
}
void CodeWidget::noTelegramCode() {
Ui::show(Box<InformBox>(tr::lng_code_register_phone(tr::now)));
//if (_noTelegramCodeRequestId) {
// return;
//}
//_noTelegramCodeRequestId = api().request(MTPauth_ResendCode(
// MTP_string(getData()->phone),
// MTP_bytes(getData()->phoneHash)
//)).done([=](const MTPauth_SentCode &result) {
// noTelegramCodeDone(result);
//}).fail([=](const MTP::Error &error) {
// noTelegramCodeFail(error);
//}).handleFloodErrors().send();
if (_noTelegramCodeRequestId) {
return;
}
_noTelegramCodeRequestId = api().request(MTPauth_ResendCode(
MTP_string(getData()->phone),
MTP_bytes(getData()->phoneHash)
)).done([=](const MTPauth_SentCode &result) {
noTelegramCodeDone(result);
}).fail([=](const MTP::Error &error) {
noTelegramCodeFail(error);
}).handleFloodErrors().send();
}
void CodeWidget::noTelegramCodeDone(const MTPauth_SentCode &result) {
@ -439,6 +438,9 @@ void CodeWidget::noTelegramCodeFail(const MTP::Error &error) {
_noTelegramCodeRequestId = 0;
showCodeError(tr::lng_flood_error());
return;
} else if (error.type() == u"SEND_CODE_UNAVAILABLE"_q) {
_noTelegramCodeRequestId = 0;
return;
}
_noTelegramCodeRequestId = 0;