From 033e53b0686c51997e046a60a37ce89ba8812c3a Mon Sep 17 00:00:00 2001 From: Victor Carreras Date: Fri, 11 Aug 2023 07:50:55 +0200 Subject: [PATCH] Release 2.8.2 --- assets/strings/en.json | 1 + assets/strings/es.json | 1 + lib/view/mobile/home_screen_mobile.dart | 39 ++++++++++++++++--------- pubspec.lock | 9 +++--- pubspec.yaml | 6 ++-- 5 files changed, 37 insertions(+), 19 deletions(-) diff --git a/assets/strings/en.json b/assets/strings/en.json index a863952..7413d53 100644 --- a/assets/strings/en.json +++ b/assets/strings/en.json @@ -33,6 +33,7 @@ "generate_file_error_subtitle": "An unexpected error occurred while generating the PDF document.", "read_file_error_title": "ERROR", "read_file_error_subtitle": "An unexpected error occurred while loading the files, possibly you have denied the application permissions to load images or files.", + "scan_file_error_subtitle": "An unexpected error occurred while scanning the files, possibly you have denied the application permissions to open de camera.", "forbidden_file_error_subtitle": "You have tried to load an invalid file format into the application.", "open_file_error_title": "ERROR", "open_file_error_subtitle": "An unexpected error occurred while opening the file.", diff --git a/assets/strings/es.json b/assets/strings/es.json index f194269..a138920 100644 --- a/assets/strings/es.json +++ b/assets/strings/es.json @@ -33,6 +33,7 @@ "generate_file_error_subtitle": "Ha ocurrido un error inesperado al generar el documento PDF.", "read_file_error_title": "ERROR", "read_file_error_subtitle": "Ha ocurrido un error inesperado al cargar los ficheros, posiblemente ha denegado los permisos a la aplicación para cargar imágenes o ficheros.", + "scan_file_error_subtitle": "Ha ocurrido un error inesperado al abrir la cámara del escaner, posiblemente ha denegado los permisos a la aplicación para la cámara.", "forbidden_file_error_subtitle": "Ha tratado de cargar un formato de archivo no válido en la aplicación.", "open_file_error_title": "ERROR", "open_file_error_subtitle": "Ha ocurrido un error inesperado al abrir el fichero.", diff --git a/lib/view/mobile/home_screen_mobile.dart b/lib/view/mobile/home_screen_mobile.dart index f03b83d..4dc0654 100644 --- a/lib/view/mobile/home_screen_mobile.dart +++ b/lib/view/mobile/home_screen_mobile.dart @@ -68,7 +68,10 @@ class _HomeScreenMobileState extends State await viewModel.loadFilesFromStorage(); } } catch (error) { - final subtitle = error.toString().contains(HomeViewModel.extensionForbidden) ? "read_file_error_subtitle" : "read_file_error_subtitle"; + final subtitle = + error.toString().contains(HomeViewModel.extensionForbidden) + ? "read_file_error_subtitle" + : "read_file_error_subtitle"; CustomDialog.showError( context: context, error: error, @@ -83,6 +86,25 @@ class _HomeScreenMobileState extends State } } + Future scanImages() async { + try { + Navigator.pop(context, 'Scan'); + final file = await viewModel.scanDocument(); + if (file != null) { + setState(() { + Utils.printInDebug("Document Scanned: $file"); + }); + } + } catch (error) { + CustomDialog.showError( + context: context, + error: error, + titleLocalized: 'read_file_error_title', + subtitleLocalized: 'scan_file_error_subtitle', + buttonTextLocalized: 'accept'); + } + } + @override Widget build(BuildContext context) { return WillPopScope( @@ -91,9 +113,8 @@ class _HomeScreenMobileState extends State ? const LoadingScreen() : Scaffold( appBar: AppBar( - automaticallyImplyLeading: false, // Remove back button - title: Text( - Localization.of(context).string('drag_pdf')), // DRAG PDF + automaticallyImplyLeading: false, + title: Text(Localization.of(context).string('drag_pdf')), actions: [ IconButton( onPressed: () => showDialog( @@ -122,15 +143,7 @@ class _HomeScreenMobileState extends State .string('load')), // LOAD ), TextButton( - onPressed: () async { - Navigator.pop(context, 'Scan'); - final file = await viewModel.scanDocument(); - if (file != null) { - setState(() { - Utils.printInDebug("Document Scanned: $file"); - }); - } - }, + onPressed: () async => await scanImages(), child: Text(Localization.of(context) .string('scan')), // SCAN ), diff --git a/pubspec.lock b/pubspec.lock index f4bdf54..a047456 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -124,10 +124,11 @@ packages: cunning_document_scanner: dependency: "direct main" description: - name: cunning_document_scanner - sha256: "90be68a6c41b8c9792ca3aa4727a87070a2732a2cd8c0912e610533c05be4e03" - url: "https://pub.dev" - source: hosted + path: "." + ref: HEAD + resolved-ref: a1d777971205fe2214004e447655686650d1b12c + url: "https://github.com/vicajilau/cunning_document_scanner" + source: git version: "1.1.2" cupertino_icons: dependency: "direct main" diff --git a/pubspec.yaml b/pubspec.yaml index 9a59687..9b66525 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 2.8.1+15 +version: 2.8.2+16 environment: sdk: '>=3.0.0 <4.0.0' @@ -47,7 +47,9 @@ dependencies: pdf: ^3.10.1 pdf_merger: ^0.0.6 share_plus: ^7.0.2 - cunning_document_scanner: ^1.1.2 + cunning_document_scanner: + git: + url: https://github.com/vicajilau/cunning_document_scanner signature: ^5.3.2 firebase_core: ^2.15.0 firebase_crashlytics: ^3.3.4