diff --git a/config.xml b/config.xml
index 6468bf8..b1419b5 100644
--- a/config.xml
+++ b/config.xml
@@ -75,9 +75,9 @@
-
+
Camera is used to scan receipts and redelivery notice slips
-
+
diff --git a/package-lock.json b/package-lock.json
index 49fba26..c8c48a3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -611,17 +611,17 @@
"recursive-readdir": "^2.2.2"
}
},
+ "cordova-plugin-camera": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/cordova-plugin-camera/-/cordova-plugin-camera-5.0.1.tgz",
+ "integrity": "sha512-9gXyZvI8u9KzsZuqmB8Yw+uheF+7f+usMAwvOMw7L7pqbykg+bm9US5zjhJbwit3A1cSblgZkpBafe5cFiMcTA==",
+ "dev": true
+ },
"cordova-plugin-device": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/cordova-plugin-device/-/cordova-plugin-device-2.0.3.tgz",
"integrity": "sha1-wrQbfv0EVd0Jf4k1bYW/3V2t6w8="
},
- "cordova-plugin-document-scanner": {
- "version": "5.0.0-beta.0",
- "resolved": "https://registry.npmjs.org/cordova-plugin-document-scanner/-/cordova-plugin-document-scanner-5.0.0-beta.0.tgz",
- "integrity": "sha512-ydBWR06fwAIKah3HQbp+ZwfCsVReebGpBVBKM53ff46rplW4WNK9pLubg02qRmByUdNwalSVZ0ugns8pGhlwRg==",
- "dev": true
- },
"cordova-plugin-headercolor": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-headercolor/-/cordova-plugin-headercolor-1.0.0.tgz",
diff --git a/package.json b/package.json
index 82bd853..60bb67c 100644
--- a/package.json
+++ b/package.json
@@ -28,13 +28,12 @@
"cordova-plugin-headercolor": {},
"cordova-plugin-theme-detection": {},
"cordova-plugin-nativestorage": {},
- "cordova-plugin-document-scanner": {
- "CAMERA_USAGE_DESCRIPTION": "This app needs camera access",
- "PHOTOLIBRARY_USAGE_DESCRIPTION": "This app needs read/write-access photo library access"
- },
"cordova-plugin-androidx": {},
"cordova-plugin-androidx-adapter": {},
- "cordova-plugin-splashscreen": {}
+ "cordova-plugin-splashscreen": {},
+ "cordova-plugin-camera": {
+ "ANDROID_SUPPORT_V4_VERSION": "27.+"
+ }
},
"platforms": [
"browser",
@@ -56,7 +55,7 @@
"cordova-plugin-add-swift-support": "^2.0.2",
"cordova-plugin-androidx": "^3.0.0",
"cordova-plugin-androidx-adapter": "^1.1.3",
- "cordova-plugin-document-scanner": "^5.0.0-beta.0",
+ "cordova-plugin-camera": "^5.0.1",
"cordova-plugin-nativestorage": "^2.3.2",
"cordova-plugin-splashscreen": "^6.0.0"
}
diff --git a/www/assets/js/noticeslip.js b/www/assets/js/noticeslip.js
index f4b8c08..6ce7a3e 100644
--- a/www/assets/js/noticeslip.js
+++ b/www/assets/js/noticeslip.js
@@ -45,7 +45,7 @@ function initNoticeSlipForm() {
function takeDocPhoto(side) {
try {
- scan.scanDoc(function (img) {
+ navigator.camera.getPicture(function (img) {
if (side == "front") {
frontSlipImg = "data:image/jpg;base64," + img;
$("#noticefrontimg").attr("src", frontSlipImg);
@@ -54,12 +54,31 @@ function takeDocPhoto(side) {
$("#noticebackimg").attr("src", backSlipImg);
}
}, function (err) {
-
+ app.dialog.alert(err, "Error");
}, {
- sourceType: 1,
- quality: 3,
- returnBase64: true
+ quality: 80,
+ targetWidth: 1000,
+ destinationType: Camera.DestinationType.DATA_URL,
+ encodingType: Camera.EncodingType.JPEG,
+ saveToPhotoAlbum: false,
+ cameraDirection: Camera.Direction.BACK
});
+// cordova-plugin-document-scanner was removed because the plugin is buggy.
+// scan.scanDoc(function (img) {
+// if (side == "front") {
+// frontSlipImg = "data:image/jpg;base64," + img;
+// $("#noticefrontimg").attr("src", frontSlipImg);
+// } else if (side == "back") {
+// backSlipImg = "data:image/jpg;base64," + img;
+// $("#noticebackimg").attr("src", backSlipImg);
+// }
+// }, function (err) {
+//
+// }, {
+// sourceType: 1,
+// quality: 3,
+// returnBase64: true
+// });
} catch (ex) {
app.dialog.alert("Looks like you can't do that with this device.", "Whoops!");
}
@@ -228,9 +247,4 @@ $("#app").on("click", "#signatureUndoBtn", function () {
data.pop(); // remove the last dot or line
signaturePad.fromData(data);
}
-});
-//$(window).on("resize", function () {
-// if (signaturePad != null) {
-// resizeCanvas(document.getElementById("signaturecanvas"));
-// }
-//});
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/www/pages/noticeslip.html b/www/pages/noticeslip.html
index 589f7a8..2106621 100644
--- a/www/pages/noticeslip.html
+++ b/www/pages/noticeslip.html
@@ -60,7 +60,7 @@
- Press the buttons to take a photo of the front and back of your signed notice slip. You'll be able to adjust the photo to ensure the image is clear.
+ Press the buttons to take a photo of the front and back of your signed notice slip.