Skip to content

Commit

Permalink
Merge pull request #12 from vicajilau/develop
Browse files Browse the repository at this point in the history
Release 2.8.2
  • Loading branch information
vicajilau authored Aug 11, 2023
2 parents 23de7b2 + 033e53b commit 6f57c42
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 19 deletions.
1 change: 1 addition & 0 deletions assets/strings/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
1 change: 1 addition & 0 deletions assets/strings/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
39 changes: 26 additions & 13 deletions lib/view/mobile/home_screen_mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ class _HomeScreenMobileState extends State<HomeScreenMobile>
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,
Expand All @@ -83,6 +86,25 @@ class _HomeScreenMobileState extends State<HomeScreenMobile>
}
}

Future<void> 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(
Expand All @@ -91,9 +113,8 @@ class _HomeScreenMobileState extends State<HomeScreenMobile>
? 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<String>(
Expand Down Expand Up @@ -122,15 +143,7 @@ class _HomeScreenMobileState extends State<HomeScreenMobile>
.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
),
Expand Down
9 changes: 5 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 4 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6f57c42

Please sign in to comment.