Handle APP_VERSION_OUTDATED in saving/accepting.

This commit is contained in:
John Preston 2018-08-17 14:11:09 +03:00
parent 6bf3006eb9
commit dc114d62c5
2 changed files with 14 additions and 5 deletions

View File

@ -707,7 +707,8 @@ std::vector<not_null<const Value*>> FormController::submitGetErrors() {
[=] { cancel(); });
}).fail([=](const RPCError &error) {
_submitRequestId = 0;
if (AcceptErrorRequiresRestart(error.type())) {
if (handleAppUpdateError(error.type())) {
} else if (AcceptErrorRequiresRestart(error.type())) {
suggestRestart();
} else {
_view->show(Box<InformBox>(
@ -1925,7 +1926,8 @@ void FormController::sendSaveRequest(
}).fail([=](const RPCError &error) {
value->saveRequestId = 0;
const auto code = error.type();
if (code == qstr("PHONE_VERIFICATION_NEEDED")) {
if (handleAppUpdateError(code)) {
} else if (code == qstr("PHONE_VERIFICATION_NEEDED")) {
if (value->type == Value::Type::Phone) {
startPhoneVerification(value);
return;
@ -2420,14 +2422,20 @@ bool FormController::parseForm(const MTPaccount_AuthorizationForm &result) {
void FormController::formFail(const QString &error) {
_savedPasswordValue = QByteArray();
_serviceErrorText = error;
if (error == "APP_VERSION_OUTDATED") {
_view->showUpdateAppBox();
} else {
if (!handleAppUpdateError(error)) {
_view->showCriticalError(
lang(lng_passport_form_error) + "\n" + error);
}
}
bool FormController::handleAppUpdateError(const QString &error) {
if (error == qstr("APP_VERSION_OUTDATED")) {
_view->showUpdateAppBox();
return true;
}
return false;
}
void FormController::requestPassword() {
if (_passwordRequestId) {
return;

View File

@ -399,6 +399,7 @@ private:
void fillDownloadedFile(
File &destination,
const std::vector<EditFile> &source) const;
bool handleAppUpdateError(const QString &error);
void submitPassword(
const Core::CloudPasswordResult &check,