diff --git a/README.md b/README.md index ee912fef..2884157b 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ The plugin enables the connection to the SDK via React-Native. ## Getting Started -Check out our getting-started section here: https://documentation-preview.anyline.com/react-native-plugin-component/43.0.0/getting-started.html +Check out our getting-started section here: https://documentation-preview.anyline.com/react-native-plugin-component/43.0.1/getting-started.html ## Documentation -Check out our developer guide here: https://documentation-preview.anyline.com/react-native-plugin-component/43.0.0/index.html +Check out our developer guide here: https://documentation-preview.anyline.com/react-native-plugin-component/43.0.1/index.html ## License diff --git a/example/RNExampleApp/android/gradle/wrapper/gradle-wrapper.jar b/example/RNExampleApp/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..943f0cbf Binary files /dev/null and b/example/RNExampleApp/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/plugin/android/gradle/wrapper/gradle-wrapper.jar b/plugin/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..943f0cbf Binary files /dev/null and b/plugin/android/gradle/wrapper/gradle-wrapper.jar differ 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 a7d6c09f..b1da6760 100755 --- a/plugin/android/src/main/java/com/anyline/reactnative/AnylineSDKPlugin.java +++ b/plugin/android/src/main/java/com/anyline/reactnative/AnylineSDKPlugin.java @@ -94,6 +94,7 @@ public void update( } } catch (JSONException e) { e.printStackTrace(); + returnError(e.getMessage()); } } @@ -103,6 +104,7 @@ public void initSdk(String license) { AnylineSdk.init(license, reactContext); } catch (LicenseException e) { e.printStackTrace(); + returnError(e.getMessage()); } } @@ -160,36 +162,34 @@ private void routeScanMode(String scanMode) { private void scanAnyline4() { try { configObject = new JSONObject(this.config); -// JSONObject options = configObject; if (configObject != null) { scan(); } else { returnError("No ViewPlugin in config. Please check your configuration."); } + } catch (LicenseException e) { + e.printStackTrace(); + returnError("LICENSE ERROR: " + e.getMessage()); } catch (JSONException e) { e.printStackTrace(); + returnError("JSON ERROR: " + e.getMessage()); } } - private void scan() { + private void scan() throws LicenseException, JSONException { Intent intent = new Intent(getCurrentActivity(), ScanActivity.class); - try { - configObject = new JSONObject(this.config); - - license = configObject.get("license").toString(); - JSONObject optionsJSONObject = configObject.optJSONObject("options"); + configObject = new JSONObject(this.config); - if (optionsJSONObject != null) { - intent.putExtra( - EXTRA_ENABLE_BARCODE_SCANNING, - optionsJSONObject.optBoolean("nativeBarcodeEnabled", false) - ); - } + license = configObject.get("license").toString(); + JSONObject optionsJSONObject = configObject.optJSONObject("options"); - } catch (JSONException e) { - returnError("JSON ERROR: " + e.getMessage()); + if (optionsJSONObject != null) { + intent.putExtra( + EXTRA_ENABLE_BARCODE_SCANNING, + optionsJSONObject.optBoolean("nativeBarcodeEnabled", false) + ); } intent.putExtra(EXTRA_LICENSE_KEY, license); @@ -198,13 +198,7 @@ private void scan() { ResultReporter.setListener(this); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - try { - AnylineSdk.init(configObject.getString("license"), reactContext); - } catch (LicenseException e) { - e.printStackTrace(); - } catch (JSONException e) { - e.printStackTrace(); - } + AnylineSdk.init(configObject.getString("license"), reactContext); reactContext.startActivityForResult(intent, 1111, intent.getExtras()); } diff --git a/plugin/package.json b/plugin/package.json index 33ade100..fd5fe545 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -1,6 +1,6 @@ { - "_from": "anyline-ocr-react-native-module@^43.0.0", - "_id": "anyline-ocr-react-native-module@^43.0.0", + "_from": "anyline-ocr-react-native-module@^43.0.1", + "_id": "anyline-ocr-react-native-module@^43.0.1", "_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@^43.0.0", + "raw": "anyline-ocr-react-native-module@^43.0.1", "name": "anyline-ocr-react-native-module", "escapedName": "anyline-ocr-react-native-module", - "rawSpec": "^43.0.0", + "rawSpec": "^43.0.1", "saveSpec": null, - "fetchSpec": "^43.0.0" + "fetchSpec": "^43.0.1" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-43.0.0.tgz", + "_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-43.0.1.tgz", "_shasum": "bacbcd260cc662244f59393ed81a6edba009b52c", - "_spec": "anyline-ocr-react-native-module@^43.0.0", + "_spec": "anyline-ocr-react-native-module@^43.0.1", "_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": "43.0.0" + "version": "43.0.1" }