anyline-ocr-react-native-module 54.5.1 → 54.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -61,7 +61,7 @@ repositories {
|
|
|
61
61
|
|
|
62
62
|
dependencies {
|
|
63
63
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
|
64
|
-
implementation 'io.anyline:anylinesdk:54.
|
|
64
|
+
implementation 'io.anyline:anylinesdk:54.6.0'
|
|
65
65
|
implementation "com.facebook.react:react-native:+"
|
|
66
66
|
implementation("com.google.android.material:material:1.9.0")
|
|
67
67
|
implementation 'androidx.multidex:multidex:2.0.1'
|
|
@@ -34,6 +34,7 @@ import java.util.TimerTask;
|
|
|
34
34
|
import io.anyline.plugin.config.ScanViewInitializationParameters;
|
|
35
35
|
import io.anyline2.ScanResult;
|
|
36
36
|
import io.anyline2.view.ScanView;
|
|
37
|
+
import io.anyline2.view.ScanViewLoadResult;
|
|
37
38
|
import io.anyline2.viewplugin.ScanViewPlugin;
|
|
38
39
|
import io.anyline2.viewplugin.ViewPluginBase;
|
|
39
40
|
|
|
@@ -87,63 +88,68 @@ public class ScanActivity extends AppCompatActivity {
|
|
|
87
88
|
orientation = this.getResources().getConfiguration().orientation;
|
|
88
89
|
|
|
89
90
|
scanView = binding.scanView;
|
|
91
|
+
scanView.setOnScanViewLoaded(scanViewLoadResult -> {
|
|
92
|
+
if (scanViewLoadResult instanceof ScanViewLoadResult.Succeeded) {
|
|
93
|
+
if (getIntent().hasExtra(EXTRA_CONFIG_JSON)) {
|
|
94
|
+
try {
|
|
95
|
+
JSONObject configJSON = new JSONObject(getIntent().getStringExtra(EXTRA_CONFIG_JSON));
|
|
96
|
+
|
|
97
|
+
applyDefaultOrientation(configJSON);
|
|
98
|
+
setupChangeOrientationButton(configJSON);
|
|
99
|
+
setupCustomUIFeedback(configJSON);
|
|
100
|
+
|
|
101
|
+
String initializationParametersString = getIntent().getStringExtra(EXTRA_SCANVIEW_INITIALIZATION_PARAMETERS);
|
|
102
|
+
if (initializationParametersString != null) {
|
|
103
|
+
ScanViewInitializationParameters scanViewInitializationParameters =
|
|
104
|
+
getScanViewInitializationParametersFromJsonObject(
|
|
105
|
+
this,
|
|
106
|
+
new JSONObject(initializationParametersString));
|
|
107
|
+
scanView.init(configJSON, scanViewInitializationParameters);
|
|
108
|
+
} else {
|
|
109
|
+
scanView.init(configJSON);
|
|
110
|
+
}
|
|
111
|
+
scanView.start();
|
|
112
|
+
|
|
113
|
+
ViewPluginBase viewPluginBase = scanView.getScanViewPlugin();
|
|
114
|
+
|
|
115
|
+
observeUIFeedbackEvents(viewPluginBase);
|
|
116
|
+
|
|
117
|
+
viewPluginBase.resultReceived = scanResult -> {
|
|
118
|
+
setResult(AnylineSDKPlugin.RESULT_OK);
|
|
119
|
+
JSONObject resultObject = getResultWithImagePath(scanResult);
|
|
120
|
+
ResultReporter.onResult(resultObject.toString(), true);
|
|
121
|
+
finish();
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
viewPluginBase.resultsReceived = scanResults -> {
|
|
125
|
+
JSONArray resultJSONArray = new JSONArray();
|
|
126
|
+
|
|
127
|
+
for (ScanResult scanResult : scanResults) {
|
|
128
|
+
JSONObject resultObject = getResultWithImagePath(scanResult);
|
|
129
|
+
resultJSONArray.put(resultObject);
|
|
130
|
+
}
|
|
131
|
+
setResult(AnylineSDKPlugin.RESULT_OK);
|
|
132
|
+
ResultReporter.onResult(resultJSONArray.toString(), true);
|
|
133
|
+
finish();
|
|
134
|
+
};
|
|
135
|
+
} catch (JSONException e) {
|
|
136
|
+
finishWithError("Error parsing view config: " + e.getMessage());
|
|
137
|
+
} catch (Exception e) {
|
|
138
|
+
finishWithError(getString(getResources().getIdentifier("error_invalid_json_data", "string", getPackageName()))
|
|
139
|
+
+ "\n" + e.getLocalizedMessage());
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
finishWithError("View config not found");
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
ScanViewLoadResult.Failed scanViewLoadFailed = (ScanViewLoadResult.Failed) scanViewLoadResult;
|
|
146
|
+
finishWithError(scanViewLoadFailed.getErrorMessage());
|
|
147
|
+
}
|
|
148
|
+
});
|
|
90
149
|
|
|
91
150
|
if (savedInstanceState != null) {
|
|
92
151
|
defaultOrientationApplied = savedInstanceState.getBoolean(KEY_DEFAULT_ORIENTATION_APPLIED);
|
|
93
152
|
}
|
|
94
|
-
|
|
95
|
-
if (getIntent().hasExtra(EXTRA_CONFIG_JSON)) {
|
|
96
|
-
// TODO check for throws clauses
|
|
97
|
-
try {
|
|
98
|
-
JSONObject configJSON = new JSONObject(getIntent().getStringExtra(EXTRA_CONFIG_JSON));
|
|
99
|
-
|
|
100
|
-
applyDefaultOrientation(configJSON);
|
|
101
|
-
setupChangeOrientationButton(configJSON);
|
|
102
|
-
setupCustomUIFeedback(configJSON);
|
|
103
|
-
|
|
104
|
-
String initializationParametersString = getIntent().getStringExtra(EXTRA_SCANVIEW_INITIALIZATION_PARAMETERS);
|
|
105
|
-
if (initializationParametersString != null) {
|
|
106
|
-
ScanViewInitializationParameters scanViewInitializationParameters =
|
|
107
|
-
getScanViewInitializationParametersFromJsonObject(
|
|
108
|
-
this,
|
|
109
|
-
new JSONObject(initializationParametersString));
|
|
110
|
-
scanView.init(configJSON, scanViewInitializationParameters);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
scanView.init(configJSON);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
ViewPluginBase viewPluginBase = scanView.getScanViewPlugin();
|
|
117
|
-
|
|
118
|
-
observeUIFeedbackEvents(viewPluginBase);
|
|
119
|
-
|
|
120
|
-
viewPluginBase.resultReceived = scanResult -> {
|
|
121
|
-
setResult(AnylineSDKPlugin.RESULT_OK);
|
|
122
|
-
JSONObject resultObject = getResultWithImagePath(scanResult);
|
|
123
|
-
ResultReporter.onResult(resultObject.toString(), true);
|
|
124
|
-
finish();
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
viewPluginBase.resultsReceived = scanResults -> {
|
|
128
|
-
JSONArray resultJSONArray = new JSONArray();
|
|
129
|
-
|
|
130
|
-
for (ScanResult scanResult : scanResults) {
|
|
131
|
-
JSONObject resultObject = getResultWithImagePath(scanResult);
|
|
132
|
-
resultJSONArray.put(resultObject);
|
|
133
|
-
}
|
|
134
|
-
setResult(AnylineSDKPlugin.RESULT_OK);
|
|
135
|
-
ResultReporter.onResult(resultJSONArray.toString(), true);
|
|
136
|
-
finish();
|
|
137
|
-
};
|
|
138
|
-
} catch (JSONException e) {
|
|
139
|
-
finishWithError("Error parsing view config: " + e.getMessage());
|
|
140
|
-
} catch (Exception e) {
|
|
141
|
-
finishWithError(getString(getResources().getIdentifier("error_invalid_json_data", "string", getPackageName()))
|
|
142
|
-
+ "\n" + e.getLocalizedMessage());
|
|
143
|
-
}
|
|
144
|
-
} else {
|
|
145
|
-
finishWithError("View config not found");
|
|
146
|
-
}
|
|
147
153
|
}
|
|
148
154
|
|
|
149
155
|
private void applyDefaultOrientation(JSONObject configJSON) {
|
|
@@ -408,7 +414,6 @@ public class ScanActivity extends AppCompatActivity {
|
|
|
408
414
|
protected void onPause() {
|
|
409
415
|
if (scanView.isInitialized()) {
|
|
410
416
|
scanView.stop();
|
|
411
|
-
scanView.getCameraView().releaseCameraInBackground();
|
|
412
417
|
}
|
|
413
418
|
super.onPause();
|
|
414
419
|
}
|
package/ios/ALPluginHelper.h
CHANGED
package/ios/AnylineReact.podspec
CHANGED
|
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
|
|
|
18
18
|
s.source = { :git => "https://github.com/Anyline/anyline-ocr-react-native-module.git", :tag => "#{s.version}" }
|
|
19
19
|
|
|
20
20
|
s.source_files = "*.{h,m}"
|
|
21
|
-
s.dependency "Anyline", "54.
|
|
21
|
+
s.dependency "Anyline", "54.6.0"
|
|
22
22
|
s.dependency "React"
|
|
23
23
|
|
|
24
24
|
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_from": "anyline-ocr-react-native-module@^54.
|
|
3
|
-
"_id": "anyline-ocr-react-native-module@^54.
|
|
2
|
+
"_from": "anyline-ocr-react-native-module@^54.6.0",
|
|
3
|
+
"_id": "anyline-ocr-react-native-module@^54.6.0",
|
|
4
4
|
"_inBundle": false,
|
|
5
5
|
"_integrity": "sha512-BGi9zNkSsoxXywDBIqzgBRvKUBniQOJHDKBrozZubKthZNRBAj8Ry5tW0Me0yLXt/fauME//hbC0wsenfPJZqw==",
|
|
6
6
|
"_location": "/anyline-ocr-react-native-module",
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
"_requested": {
|
|
9
9
|
"type": "range",
|
|
10
10
|
"registry": true,
|
|
11
|
-
"raw": "anyline-ocr-react-native-module@^54.
|
|
11
|
+
"raw": "anyline-ocr-react-native-module@^54.6.0",
|
|
12
12
|
"name": "anyline-ocr-react-native-module",
|
|
13
13
|
"escapedName": "anyline-ocr-react-native-module",
|
|
14
|
-
"rawSpec": "^54.
|
|
14
|
+
"rawSpec": "^54.6.0",
|
|
15
15
|
"saveSpec": null,
|
|
16
|
-
"fetchSpec": "^54.
|
|
16
|
+
"fetchSpec": "^54.6.0"
|
|
17
17
|
},
|
|
18
18
|
"_requiredBy": [
|
|
19
19
|
"/"
|
|
20
20
|
],
|
|
21
|
-
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-54.
|
|
21
|
+
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-54.6.0.tgz",
|
|
22
22
|
"_shasum": "bacbcd260cc662244f59393ed81a6edba009b52c",
|
|
23
|
-
"_spec": "anyline-ocr-react-native-module@^54.
|
|
23
|
+
"_spec": "anyline-ocr-react-native-module@^54.6.0",
|
|
24
24
|
"_where": "/Users/amiransari/Projects/anyline-ocr-react-native-module1/example/RNExampleApp",
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/Anyline/anyline-ocr-react-native-module/issues"
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"type": "git",
|
|
48
48
|
"url": "git+https://github.com/Anyline/anyline-ocr-react-native-module.git"
|
|
49
49
|
},
|
|
50
|
-
"version": "54.
|
|
50
|
+
"version": "54.6.0"
|
|
51
51
|
}
|