2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-07 01:45:39 +00:00

Update API scheme to layer 152.

This commit is contained in:
John Preston
2023-01-10 17:10:34 +04:00
parent 37cf12f06e
commit 90cb61676a
20 changed files with 187 additions and 112 deletions

View File

@@ -266,25 +266,7 @@ void CodeWidget::checkRequest() {
void CodeWidget::codeSubmitDone(const MTPauth_Authorization &result) {
stopCheck();
_sentRequest = 0;
result.match([&](const MTPDauth_authorization &data) {
if (data.vuser().type() != mtpc_user
|| !data.vuser().c_user().is_self()) {
showError(rpl::single(Lang::Hard::ServerError()));
return;
}
finish(data.vuser());
}, [&](const MTPDauth_authorizationSignUpRequired &data) {
if (const auto terms = data.vterms_of_service()) {
terms->match([&](const MTPDhelp_termsOfService &data) {
getData()->termsLock = Window::TermsLock::FromMTP(
nullptr,
data);
});
} else {
getData()->termsLock = Window::TermsLock();
}
goReplace<SignupWidget>(Animate::Forward);
});
finish(result);
}
void CodeWidget::codeSubmitFail(const MTP::Error &error) {
@@ -343,17 +325,19 @@ void CodeWidget::sendCall() {
}
}
void CodeWidget::callDone(const MTPauth_SentCode &v) {
if (v.type() == mtpc_auth_sentCode) {
fillSentCodeData(v.c_auth_sentCode());
void CodeWidget::callDone(const MTPauth_SentCode &result) {
result.match([&](const MTPDauth_sentCode &data) {
fillSentCodeData(data);
_code->setDigitsCountMax(getData()->codeLength);
}
if (_callStatus == CallStatus::Calling) {
_callStatus = CallStatus::Called;
getData()->callStatus = _callStatus;
getData()->callTimeout = _callTimeout;
updateCallText();
}
if (_callStatus == CallStatus::Calling) {
_callStatus = CallStatus::Called;
getData()->callStatus = _callStatus;
getData()->callTimeout = _callTimeout;
updateCallText();
}
}, [&](const MTPDauth_sentCodeSuccess &data) {
finish(data.vauthorization());
});
}
void CodeWidget::gotPassword(const MTPaccount_Password &result) {
@@ -455,24 +439,23 @@ void CodeWidget::noTelegramCode() {
void CodeWidget::noTelegramCodeDone(const MTPauth_SentCode &result) {
_noTelegramCodeRequestId = 0;
if (result.type() != mtpc_auth_sentCode) {
showCodeError(rpl::single(Lang::Hard::ServerError()));
return;
}
const auto &d = result.c_auth_sentCode();
fillSentCodeData(d);
_code->setDigitsCountMax(getData()->codeLength);
const auto next = d.vnext_type();
if (next && next->type() == mtpc_auth_codeTypeCall) {
getData()->callStatus = CallStatus::Waiting;
getData()->callTimeout = d.vtimeout().value_or(60);
} else {
getData()->callStatus = CallStatus::Disabled;
getData()->callTimeout = 0;
}
getData()->codeByTelegram = false;
updateDescText();
result.match([&](const MTPDauth_sentCode &data) {
const auto &d = result.c_auth_sentCode();
fillSentCodeData(data);
_code->setDigitsCountMax(getData()->codeLength);
const auto next = data.vnext_type();
if (next && next->type() == mtpc_auth_codeTypeCall) {
getData()->callStatus = CallStatus::Waiting;
getData()->callTimeout = d.vtimeout().value_or(60);
} else {
getData()->callStatus = CallStatus::Disabled;
getData()->callTimeout = 0;
}
getData()->codeByTelegram = false;
updateDescText();
}, [&](const MTPDauth_sentCodeSuccess &data) {
finish(data.vauthorization());
});
}
void CodeWidget::noTelegramCodeFail(const MTP::Error &error) {