Skip to content

Commit eb6debf

Browse files
Release 54.2.2 (#184)
1 parent 6c20f65 commit eb6debf

File tree

4 files changed

+48
-10
lines changed

4 files changed

+48
-10
lines changed

example/RNExampleApp/android/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ android {
8787
minSdkVersion rootProject.ext.minSdkVersion
8888
targetSdkVersion rootProject.ext.targetSdkVersion
8989
versionCode 5
90-
versionName "54.2.1"
90+
versionName "54.2.2"
9191
multiDexEnabled true
9292

9393
buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())

example/RNExampleApp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-example-app",
3-
"version": "54.2.1",
3+
"version": "54.2.2",
44
"private": true,
55
"scripts": {
66
"initProject": "yarn add expo && yarn add ../../plugin",

plugin/android/src/main/java/com/anyline/reactnative/AnylineSDKPlugin.java

+38
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
import org.json.JSONException;
1818
import org.json.JSONObject;
1919

20+
import java.io.File;
2021
import java.io.IOException;
2122
import java.util.HashMap;
2223

2324
import io.anyline2.WrapperConfig;
2425
import io.anyline2.WrapperInfo;
2526
import io.anyline2.core.ScanController;
27+
import io.anyline2.di.context.ContextProvider;
2628
import io.anyline2.legacy.products.AnylineUpdater;
2729
import io.anyline2.legacy.trainer.AssetContext;
2830
import io.anyline2.AnylineSdk;
@@ -32,6 +34,11 @@
3234

3335
class AnylineSDKPlugin extends ReactContextBaseJavaModule implements ResultReporter.OnResultListener {
3436

37+
static {
38+
System.loadLibrary("opencv_java3_al");
39+
System.loadLibrary("anylineCore");
40+
}
41+
3542
public static final String REACT_CLASS = "AnylineSDKPlugin";
3643
public static final String EXTRA_LICENSE_KEY = "EXTRA_LICENSE_KEY";
3744
public static final String EXTRA_CONFIG_JSON = "EXTRA_CONFIG_JSON";
@@ -63,6 +70,7 @@ class AnylineSDKPlugin extends ReactContextBaseJavaModule implements ResultRepor
6370
super(context);
6471
this.reactContext = context;
6572
this.assetContextJsonParser = new AssetContextJsonParser();
73+
ContextProvider.setInstance(context);
6674
}
6775

6876
@Override
@@ -232,6 +240,35 @@ public void exportCachedEvents(final Promise promise) {
232240
}
233241
}
234242

243+
/**
244+
* This function removes all previous scan result images from disk, either from external
245+
* or internal files dir, e.g.:
246+
* /sdcard/Android/[applicationId]/files/results/image1729849635965
247+
*/
248+
private void deleteAllPreviousScanResultImages() {
249+
String imagePath = "";
250+
if (reactContext.getExternalFilesDir(null) != null) {
251+
imagePath = reactContext
252+
.getExternalFilesDir(null)
253+
.toString() + "/results/";
254+
255+
} else if (reactContext.getFilesDir() != null) {
256+
imagePath = reactContext
257+
.getFilesDir()
258+
.toString() + "/results/";
259+
}
260+
261+
File resultFolder = new File(imagePath);
262+
File[] files = resultFolder.listFiles();
263+
if (files != null) {
264+
for (int fileIndex = 0; fileIndex < files.length; fileIndex++) {
265+
if (files[fileIndex].getName().startsWith("image")) {
266+
files[fileIndex].delete();
267+
}
268+
}
269+
}
270+
}
271+
235272
@ReactMethod
236273
public void setupPromise(String config, String scanMode, final Promise promise) {
237274
setupPromiseWithInitializationParameters(null, config, scanMode, promise);
@@ -243,6 +280,7 @@ public void setupPromiseWithInitializationParameters(String initializationParame
243280
this.config = config;
244281
this.scanViewInitializationParameters = initializationParameters;
245282

283+
deleteAllPreviousScanResultImages();
246284
routeScanMode(scanMode);
247285
}
248286

plugin/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
2-
"_from": "anyline-ocr-react-native-module@^54.2.1",
3-
"_id": "anyline-ocr-react-native-module@^54.2.1",
2+
"_from": "anyline-ocr-react-native-module@^54.2.2",
3+
"_id": "anyline-ocr-react-native-module@^54.2.2",
44
"_inBundle": false,
55
"_integrity": "sha512-BGi9zNkSsoxXywDBIqzgBRvKUBniQOJHDKBrozZubKthZNRBAj8Ry5tW0Me0yLXt/fauME//hbC0wsenfPJZqw==",
66
"_location": "/anyline-ocr-react-native-module",
77
"_phantomChildren": {},
88
"_requested": {
99
"type": "range",
1010
"registry": true,
11-
"raw": "anyline-ocr-react-native-module@^54.2.1",
11+
"raw": "anyline-ocr-react-native-module@^54.2.2",
1212
"name": "anyline-ocr-react-native-module",
1313
"escapedName": "anyline-ocr-react-native-module",
14-
"rawSpec": "^54.2.1",
14+
"rawSpec": "^54.2.2",
1515
"saveSpec": null,
16-
"fetchSpec": "^54.2.1"
16+
"fetchSpec": "^54.2.2"
1717
},
1818
"_requiredBy": [
1919
"/"
2020
],
21-
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-54.2.1.tgz",
21+
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-54.2.2.tgz",
2222
"_shasum": "bacbcd260cc662244f59393ed81a6edba009b52c",
23-
"_spec": "anyline-ocr-react-native-module@^54.2.1",
23+
"_spec": "anyline-ocr-react-native-module@^54.2.2",
2424
"_where": "/Users/amiransari/Projects/anyline-ocr-react-native-module1/example/RNExampleApp",
2525
"bugs": {
2626
"url": "https://github.com/Anyline/anyline-ocr-react-native-module/issues"
@@ -47,5 +47,5 @@
4747
"type": "git",
4848
"url": "git+https://github.com/Anyline/anyline-ocr-react-native-module.git"
4949
},
50-
"version": "54.2.1"
50+
"version": "54.2.2"
5151
}

0 commit comments

Comments
 (0)