From 250aacbbdfc1ce1bcc8eb1f4e37ac51b2fc901b2 Mon Sep 17 00:00:00 2001 From: Bernd Kampl Date: Fri, 25 Oct 2024 13:15:24 +0200 Subject: [PATCH] Release 52.0.2 --- example/RNExampleApp/android/app/build.gradle | 2 +- example/RNExampleApp/package.json | 2 +- .../anyline/reactnative/AnylineSDKPlugin.java | 31 +++++++++++++++++++ plugin/package.json | 16 +++++----- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/example/RNExampleApp/android/app/build.gradle b/example/RNExampleApp/android/app/build.gradle index 703f5fc3..08ef6745 100644 --- a/example/RNExampleApp/android/app/build.gradle +++ b/example/RNExampleApp/android/app/build.gradle @@ -87,7 +87,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 5 - versionName "52.0.1" + versionName "52.0.2" multiDexEnabled true buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString()) diff --git a/example/RNExampleApp/package.json b/example/RNExampleApp/package.json index 9463cb55..f89d7bcb 100644 --- a/example/RNExampleApp/package.json +++ b/example/RNExampleApp/package.json @@ -1,6 +1,6 @@ { "name": "react-native-example-app", - "version": "52.0.1", + "version": "52.0.2", "private": true, "scripts": { "initProject": "yarn add expo && yarn add ../../plugin", diff --git a/plugin/android/src/main/java/com/anyline/reactnative/AnylineSDKPlugin.java b/plugin/android/src/main/java/com/anyline/reactnative/AnylineSDKPlugin.java index 260ee947..1edff5c7 100755 --- a/plugin/android/src/main/java/com/anyline/reactnative/AnylineSDKPlugin.java +++ b/plugin/android/src/main/java/com/anyline/reactnative/AnylineSDKPlugin.java @@ -17,6 +17,7 @@ import org.json.JSONException; import org.json.JSONObject; +import java.io.File; import java.io.IOException; import java.util.HashMap; @@ -224,12 +225,42 @@ public void exportCachedEvents(final Promise promise) { } } + /** + * This function removes all previous scan result images from disk, either from external + * or external files dir, e.g.: + * /sdcard/Android/[applicationId]/files/results/image1729849635965 + */ + private void deleteAllPreviousScanResultImages() { + String imagePath = ""; + if (reactContext.getExternalFilesDir(null) != null) { + imagePath = reactContext + .getExternalFilesDir(null) + .toString() + "/results/"; + + } else if (reactContext.getFilesDir() != null) { + imagePath = reactContext + .getFilesDir() + .toString() + "/results/"; + } + + File resultFolder = new File(imagePath); + File[] files = resultFolder.listFiles(); + if (files != null) { + for (int fileIndex = 0; fileIndex < files.length; fileIndex++) { + if (files[fileIndex].getName().startsWith("image")) { + files[fileIndex].delete(); + } + } + } + } + @ReactMethod public void setupPromise(String config, String scanMode, final Promise promise) { this.promise = promise; this.returnMethod = "promise"; this.config = config; + deleteAllPreviousScanResultImages(); routeScanMode(scanMode); } diff --git a/plugin/package.json b/plugin/package.json index 11f33208..79793cad 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -1,6 +1,6 @@ { - "_from": "anyline-ocr-react-native-module@^52.0.1", - "_id": "anyline-ocr-react-native-module@^52.0.1", + "_from": "anyline-ocr-react-native-module@^52.0.2", + "_id": "anyline-ocr-react-native-module@^52.0.2", "_inBundle": false, "_integrity": "sha512-BGi9zNkSsoxXywDBIqzgBRvKUBniQOJHDKBrozZubKthZNRBAj8Ry5tW0Me0yLXt/fauME//hbC0wsenfPJZqw==", "_location": "/anyline-ocr-react-native-module", @@ -8,19 +8,19 @@ "_requested": { "type": "range", "registry": true, - "raw": "anyline-ocr-react-native-module@^52.0.1", + "raw": "anyline-ocr-react-native-module@^52.0.2", "name": "anyline-ocr-react-native-module", "escapedName": "anyline-ocr-react-native-module", - "rawSpec": "^52.0.1", + "rawSpec": "^52.0.2", "saveSpec": null, - "fetchSpec": "^52.0.1" + "fetchSpec": "^52.0.2" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-52.0.1.tgz", + "_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-52.0.2.tgz", "_shasum": "bacbcd260cc662244f59393ed81a6edba009b52c", - "_spec": "anyline-ocr-react-native-module@^52.0.1", + "_spec": "anyline-ocr-react-native-module@^52.0.2", "_where": "/Users/amiransari/Projects/anyline-ocr-react-native-module1/example/RNExampleApp", "bugs": { "url": "https://github.com/Anyline/anyline-ocr-react-native-module/issues" @@ -47,5 +47,5 @@ "type": "git", "url": "git+https://github.com/Anyline/anyline-ocr-react-native-module.git" }, - "version": "52.0.1" + "version": "52.0.2" }