From 7be9e0fb94d95a86d1f9a0d9635316810d4311bc Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 10 Jul 2018 22:32:34 +0300 Subject: [PATCH] Warn on passport save before upload is finished. --- Telegram/Resources/langs/lang.strings | 1 + .../passport/passport_panel_controller.cpp | 12 +++++++++++- .../SourceFiles/passport/passport_panel_controller.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 18a7a759f..ef23987eb 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -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_cant_read" = "Can't read this file. Please choose an image."; "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_progress_title" = "Exporting personal data"; diff --git a/Telegram/SourceFiles/passport/passport_panel_controller.cpp b/Telegram/SourceFiles/passport/passport_panel_controller.cpp index 119f4b598..7da74a454 100644 --- a/Telegram/SourceFiles/passport/passport_panel_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_controller.cpp @@ -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 { Expects(_editValue != nullptr); @@ -1179,7 +1186,10 @@ void PanelController::saveScope(ValueMap &&data, ValueMap &&filesData) { Expects(_panel != nullptr); Expects(_editValue != nullptr); - if (savingScope()) { + if (uploadingScopeScan()) { + showToast(lang(lng_passport_wait_upload)); + return; + } else if (savingScope()) { return; } diff --git a/Telegram/SourceFiles/passport/passport_panel_controller.h b/Telegram/SourceFiles/passport/passport_panel_controller.h index 487cb76d2..87b3623f4 100644 --- a/Telegram/SourceFiles/passport/passport_panel_controller.h +++ b/Telegram/SourceFiles/passport/passport_panel_controller.h @@ -144,6 +144,7 @@ private: void processVerificationNeeded(not_null value); bool savingScope() const; + bool uploadingScopeScan() const; bool hasValueDocument() const; bool hasValueFields() const; ScanInfo collectScanInfo(const EditFile &file) const;