Handle APP_VERSION_OUTDATED in saving/accepting.
This commit is contained in:
		
							parent
							
								
									6bf3006eb9
								
							
						
					
					
						commit
						dc114d62c5
					
				
					 2 changed files with 14 additions and 5 deletions
				
			
		| 
						 | 
					@ -707,7 +707,8 @@ std::vector<not_null<const Value*>> FormController::submitGetErrors() {
 | 
				
			||||||
			[=] { cancel(); });
 | 
								[=] { cancel(); });
 | 
				
			||||||
	}).fail([=](const RPCError &error) {
 | 
						}).fail([=](const RPCError &error) {
 | 
				
			||||||
		_submitRequestId = 0;
 | 
							_submitRequestId = 0;
 | 
				
			||||||
		if (AcceptErrorRequiresRestart(error.type())) {
 | 
							if (handleAppUpdateError(error.type())) {
 | 
				
			||||||
 | 
							} else if (AcceptErrorRequiresRestart(error.type())) {
 | 
				
			||||||
			suggestRestart();
 | 
								suggestRestart();
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			_view->show(Box<InformBox>(
 | 
								_view->show(Box<InformBox>(
 | 
				
			||||||
| 
						 | 
					@ -1925,7 +1926,8 @@ void FormController::sendSaveRequest(
 | 
				
			||||||
	}).fail([=](const RPCError &error) {
 | 
						}).fail([=](const RPCError &error) {
 | 
				
			||||||
		value->saveRequestId = 0;
 | 
							value->saveRequestId = 0;
 | 
				
			||||||
		const auto code = error.type();
 | 
							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) {
 | 
								if (value->type == Value::Type::Phone) {
 | 
				
			||||||
				startPhoneVerification(value);
 | 
									startPhoneVerification(value);
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
| 
						 | 
					@ -2420,14 +2422,20 @@ bool FormController::parseForm(const MTPaccount_AuthorizationForm &result) {
 | 
				
			||||||
void FormController::formFail(const QString &error) {
 | 
					void FormController::formFail(const QString &error) {
 | 
				
			||||||
	_savedPasswordValue = QByteArray();
 | 
						_savedPasswordValue = QByteArray();
 | 
				
			||||||
	_serviceErrorText = error;
 | 
						_serviceErrorText = error;
 | 
				
			||||||
	if (error == "APP_VERSION_OUTDATED") {
 | 
						if (!handleAppUpdateError(error)) {
 | 
				
			||||||
		_view->showUpdateAppBox();
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		_view->showCriticalError(
 | 
							_view->showCriticalError(
 | 
				
			||||||
			lang(lng_passport_form_error) + "\n" + error);
 | 
								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() {
 | 
					void FormController::requestPassword() {
 | 
				
			||||||
	if (_passwordRequestId) {
 | 
						if (_passwordRequestId) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -399,6 +399,7 @@ private:
 | 
				
			||||||
	void fillDownloadedFile(
 | 
						void fillDownloadedFile(
 | 
				
			||||||
		File &destination,
 | 
							File &destination,
 | 
				
			||||||
		const std::vector<EditFile> &source) const;
 | 
							const std::vector<EditFile> &source) const;
 | 
				
			||||||
 | 
						bool handleAppUpdateError(const QString &error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void submitPassword(
 | 
						void submitPassword(
 | 
				
			||||||
		const Core::CloudPasswordResult &check,
 | 
							const Core::CloudPasswordResult &check,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue