Skip to content

Commit

Permalink
Release 54.2.2 (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
berndkamplanyline authored Nov 4, 2024
1 parent 6c20f65 commit eb6debf
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 10 deletions.
2 changes: 1 addition & 1 deletion example/RNExampleApp/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 5
versionName "54.2.1"
versionName "54.2.2"
multiDexEnabled true

buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
Expand Down
2 changes: 1 addition & 1 deletion example/RNExampleApp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-example-app",
"version": "54.2.1",
"version": "54.2.2",
"private": true,
"scripts": {
"initProject": "yarn add expo && yarn add ../../plugin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;

import io.anyline2.WrapperConfig;
import io.anyline2.WrapperInfo;
import io.anyline2.core.ScanController;
import io.anyline2.di.context.ContextProvider;
import io.anyline2.legacy.products.AnylineUpdater;
import io.anyline2.legacy.trainer.AssetContext;
import io.anyline2.AnylineSdk;
Expand All @@ -32,6 +34,11 @@

class AnylineSDKPlugin extends ReactContextBaseJavaModule implements ResultReporter.OnResultListener {

static {
System.loadLibrary("opencv_java3_al");
System.loadLibrary("anylineCore");
}

public static final String REACT_CLASS = "AnylineSDKPlugin";
public static final String EXTRA_LICENSE_KEY = "EXTRA_LICENSE_KEY";
public static final String EXTRA_CONFIG_JSON = "EXTRA_CONFIG_JSON";
Expand Down Expand Up @@ -63,6 +70,7 @@ class AnylineSDKPlugin extends ReactContextBaseJavaModule implements ResultRepor
super(context);
this.reactContext = context;
this.assetContextJsonParser = new AssetContextJsonParser();
ContextProvider.setInstance(context);
}

@Override
Expand Down Expand Up @@ -232,6 +240,35 @@ public void exportCachedEvents(final Promise promise) {
}
}

/**
* This function removes all previous scan result images from disk, either from external
* or internal 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) {
setupPromiseWithInitializationParameters(null, config, scanMode, promise);
Expand All @@ -243,6 +280,7 @@ public void setupPromiseWithInitializationParameters(String initializationParame
this.config = config;
this.scanViewInitializationParameters = initializationParameters;

deleteAllPreviousScanResultImages();
routeScanMode(scanMode);
}

Expand Down
16 changes: 8 additions & 8 deletions plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"_from": "anyline-ocr-react-native-module@^54.2.1",
"_id": "anyline-ocr-react-native-module@^54.2.1",
"_from": "anyline-ocr-react-native-module@^54.2.2",
"_id": "anyline-ocr-react-native-module@^54.2.2",
"_inBundle": false,
"_integrity": "sha512-BGi9zNkSsoxXywDBIqzgBRvKUBniQOJHDKBrozZubKthZNRBAj8Ry5tW0Me0yLXt/fauME//hbC0wsenfPJZqw==",
"_location": "/anyline-ocr-react-native-module",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "anyline-ocr-react-native-module@^54.2.1",
"raw": "anyline-ocr-react-native-module@^54.2.2",
"name": "anyline-ocr-react-native-module",
"escapedName": "anyline-ocr-react-native-module",
"rawSpec": "^54.2.1",
"rawSpec": "^54.2.2",
"saveSpec": null,
"fetchSpec": "^54.2.1"
"fetchSpec": "^54.2.2"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-54.2.1.tgz",
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-54.2.2.tgz",
"_shasum": "bacbcd260cc662244f59393ed81a6edba009b52c",
"_spec": "anyline-ocr-react-native-module@^54.2.1",
"_spec": "anyline-ocr-react-native-module@^54.2.2",
"_where": "/Users/amiransari/Projects/anyline-ocr-react-native-module1/example/RNExampleApp",
"bugs": {
"url": "https://github.com/Anyline/anyline-ocr-react-native-module/issues"
Expand All @@ -47,5 +47,5 @@
"type": "git",
"url": "git+https://github.com/Anyline/anyline-ocr-react-native-module.git"
},
"version": "54.2.1"
"version": "54.2.2"
}

0 comments on commit eb6debf

Please sign in to comment.