Warn on passport save before upload is finished.

This commit is contained in:
John Preston 2018-07-10 22:32:34 +03:00
parent e3e8d083ea
commit 7be9e0fb94
3 changed files with 13 additions and 1 deletions

View file

@ -1664,6 +1664,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_passport_error_bad_size" = "Sorry, this image has wrong dimensions."; "lng_passport_error_bad_size" = "Sorry, this image has wrong dimensions.";
"lng_passport_error_cant_read" = "Can't read this file. Please choose an image."; "lng_passport_error_cant_read" = "Can't read this file. Please choose an image.";
"lng_passport_bad_name" = "Please use latin characters only."; "lng_passport_bad_name" = "Please use latin characters only.";
"lng_passport_wait_upload" = "Please wait while upload is finished.";
"lng_export_title" = "Export Personal Data"; "lng_export_title" = "Export Personal Data";
"lng_export_progress_title" = "Exporting personal data"; "lng_export_progress_title" = "Exporting personal data";

View file

@ -1065,6 +1065,13 @@ void PanelController::processValueSaveFinished(
} }
} }
bool PanelController::uploadingScopeScan() const {
Expects(_editValue != nullptr);
return _form->uploadingScan(_editValue)
|| (_editDocument && _form->uploadingScan(_editDocument));
}
bool PanelController::savingScope() const { bool PanelController::savingScope() const {
Expects(_editValue != nullptr); Expects(_editValue != nullptr);
@ -1179,7 +1186,10 @@ void PanelController::saveScope(ValueMap &&data, ValueMap &&filesData) {
Expects(_panel != nullptr); Expects(_panel != nullptr);
Expects(_editValue != nullptr); Expects(_editValue != nullptr);
if (savingScope()) { if (uploadingScopeScan()) {
showToast(lang(lng_passport_wait_upload));
return;
} else if (savingScope()) {
return; return;
} }

View file

@ -144,6 +144,7 @@ private:
void processVerificationNeeded(not_null<const Value*> value); void processVerificationNeeded(not_null<const Value*> value);
bool savingScope() const; bool savingScope() const;
bool uploadingScopeScan() const;
bool hasValueDocument() const; bool hasValueDocument() const;
bool hasValueFields() const; bool hasValueFields() const;
ScanInfo collectScanInfo(const EditFile &file) const; ScanInfo collectScanInfo(const EditFile &file) const;