anyline-ocr-react-native-module 35.0.0 → 36.0.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/.classpath
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<classpath>
|
|
3
|
-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-
|
|
3
|
+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-15/"/>
|
|
4
4
|
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
|
5
|
-
<classpathentry kind="output" path="bin"/>
|
|
5
|
+
<classpathentry kind="output" path="bin/default"/>
|
|
6
6
|
</classpath>
|
package/android/build.gradle
CHANGED
|
@@ -65,7 +65,7 @@ repositories {
|
|
|
65
65
|
|
|
66
66
|
dependencies {
|
|
67
67
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
|
68
|
-
implementation 'io.anyline:anylinesdk:
|
|
68
|
+
implementation 'io.anyline:anylinesdk:36.0.0'
|
|
69
69
|
implementation "com.facebook.react:react-native:+" // from node_modules
|
|
70
70
|
implementation("com.google.android.material:material:1.4.0-rc01")
|
|
71
71
|
implementation 'androidx.multidex:multidex:2.0.1'
|
|
@@ -36,10 +36,6 @@ import io.anyline.plugin.barcode.BarcodeScanPlugin;
|
|
|
36
36
|
import io.anyline.plugin.barcode.BarcodeScanResult;
|
|
37
37
|
import io.anyline.plugin.barcode.BarcodeScanViewPlugin;
|
|
38
38
|
import io.anyline.plugin.barcode.PDF417;
|
|
39
|
-
import io.anyline.plugin.id.DrivingLicenseConfig;
|
|
40
|
-
import io.anyline.plugin.id.DrivingLicenseIdentification;
|
|
41
|
-
import io.anyline.plugin.id.GermanIdFrontConfig;
|
|
42
|
-
import io.anyline.plugin.id.GermanIdFrontIdentification;
|
|
43
39
|
import io.anyline.plugin.id.ID;
|
|
44
40
|
import io.anyline.plugin.id.IdScanPlugin;
|
|
45
41
|
import io.anyline.plugin.id.IdScanViewPlugin;
|
|
@@ -71,11 +67,12 @@ public class Anyline4Activity extends AnylineBaseActivity {
|
|
|
71
67
|
private String cropAndTransformError;
|
|
72
68
|
private Boolean isFirstCameraOpen; // only if camera is opened the first time get coordinates of the cutout to avoid flickering when switching between analog and digital
|
|
73
69
|
private RelativeLayout parentLayout;
|
|
70
|
+
private boolean defaultOrientationApplied;
|
|
71
|
+
private static final String KEY_DEFAULT_ORIENTATION_APPLIED = "default_orientation_applied";
|
|
74
72
|
|
|
75
73
|
@Override
|
|
76
74
|
protected void onCreate(Bundle savedInstanceState) {
|
|
77
75
|
super.onCreate(savedInstanceState);
|
|
78
|
-
|
|
79
76
|
isFirstCameraOpen = true;
|
|
80
77
|
|
|
81
78
|
// init the scan view
|
|
@@ -88,6 +85,10 @@ public class Anyline4Activity extends AnylineBaseActivity {
|
|
|
88
85
|
parentLayout.addView(anylineScanView, layoutParams);
|
|
89
86
|
setContentView(parentLayout, layoutParams);
|
|
90
87
|
|
|
88
|
+
if (savedInstanceState != null) {
|
|
89
|
+
defaultOrientationApplied = savedInstanceState.getBoolean(KEY_DEFAULT_ORIENTATION_APPLIED);
|
|
90
|
+
}
|
|
91
|
+
|
|
91
92
|
try {
|
|
92
93
|
// start initialize anyline
|
|
93
94
|
initAnyline();
|
|
@@ -98,6 +99,12 @@ public class Anyline4Activity extends AnylineBaseActivity {
|
|
|
98
99
|
setDebugListener();
|
|
99
100
|
}
|
|
100
101
|
|
|
102
|
+
@Override
|
|
103
|
+
protected void onSaveInstanceState(Bundle outState) {
|
|
104
|
+
super.onSaveInstanceState(outState);
|
|
105
|
+
outState.putBoolean(KEY_DEFAULT_ORIENTATION_APPLIED, defaultOrientationApplied);
|
|
106
|
+
}
|
|
107
|
+
|
|
101
108
|
@Override
|
|
102
109
|
protected void onResume() {
|
|
103
110
|
super.onResume();
|
|
@@ -173,6 +180,8 @@ public class Anyline4Activity extends AnylineBaseActivity {
|
|
|
173
180
|
addRotateButtonToView(rotateButtonConfig);
|
|
174
181
|
}
|
|
175
182
|
|
|
183
|
+
setDefaultOrientation(json);
|
|
184
|
+
|
|
176
185
|
if (scanViewPlugin != null) {
|
|
177
186
|
//set nativeBarcodeMode
|
|
178
187
|
AnylinePluginHelper.setNativeBarcodeMode(json, anylineScanView);
|
|
@@ -212,27 +221,6 @@ public class Anyline4Activity extends AnylineBaseActivity {
|
|
|
212
221
|
jsonIdResult = AnylinePluginHelper.jsonHelper(Anyline4Activity.this, subResult,
|
|
213
222
|
jsonIdResult);
|
|
214
223
|
|
|
215
|
-
jsonResult.put(subResult.getPluginId(), jsonIdResult);
|
|
216
|
-
} catch (JSONException e) {
|
|
217
|
-
e.printStackTrace();
|
|
218
|
-
}
|
|
219
|
-
} else if (subResult.getResult() instanceof DrivingLicenseIdentification) {
|
|
220
|
-
JSONObject jsonIdResult = ((DrivingLicenseIdentification) subResult.getResult())
|
|
221
|
-
.toJSONObject();
|
|
222
|
-
try {
|
|
223
|
-
jsonIdResult = AnylinePluginHelper.jsonHelper(Anyline4Activity.this, subResult,
|
|
224
|
-
jsonIdResult);
|
|
225
|
-
|
|
226
|
-
jsonResult.put(subResult.getPluginId(), jsonIdResult);
|
|
227
|
-
} catch (JSONException e) {
|
|
228
|
-
e.printStackTrace();
|
|
229
|
-
}
|
|
230
|
-
} else if (subResult.getResult() instanceof GermanIdFrontIdentification) {
|
|
231
|
-
JSONObject jsonIdResult = ((GermanIdFrontIdentification) subResult.getResult()).toJSONObject();
|
|
232
|
-
try {
|
|
233
|
-
jsonIdResult = AnylinePluginHelper.jsonHelper(Anyline4Activity.this, subResult,
|
|
234
|
-
jsonIdResult);
|
|
235
|
-
|
|
236
224
|
jsonResult.put(subResult.getPluginId(), jsonIdResult);
|
|
237
225
|
} catch (JSONException e) {
|
|
238
226
|
e.printStackTrace();
|
|
@@ -330,41 +318,6 @@ public class Anyline4Activity extends AnylineBaseActivity {
|
|
|
330
318
|
}
|
|
331
319
|
|
|
332
320
|
});
|
|
333
|
-
} else if (((IdScanPlugin) ((IdScanViewPlugin) scanViewPlugin).getScanPlugin()).getIdConfig() instanceof DrivingLicenseConfig) {
|
|
334
|
-
scanViewPlugin.addScanResultListener(new ScanResultListener<ScanResult<ID>>() {
|
|
335
|
-
@Override
|
|
336
|
-
public void onResult(ScanResult<ID> idScanResult) {
|
|
337
|
-
JSONObject jsonResult = ((DrivingLicenseIdentification) idScanResult.getResult()).toJSONObject();
|
|
338
|
-
|
|
339
|
-
try {
|
|
340
|
-
jsonResult = AnylinePluginHelper.jsonHelper(Anyline4Activity.this, idScanResult,
|
|
341
|
-
jsonResult);
|
|
342
|
-
} catch (Exception e) {
|
|
343
|
-
Log.e(TAG, "Exception is: ", e);
|
|
344
|
-
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
setResult(scanViewPlugin, jsonResult);
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
});
|
|
352
|
-
} else if (((IdScanPlugin) ((IdScanViewPlugin) scanViewPlugin).getScanPlugin()).getIdConfig() instanceof GermanIdFrontConfig) {
|
|
353
|
-
scanViewPlugin.addScanResultListener(new ScanResultListener<ScanResult<ID>>() {
|
|
354
|
-
@Override
|
|
355
|
-
public void onResult(ScanResult<ID> idScanResult) {
|
|
356
|
-
JSONObject jsonResult = ((GermanIdFrontIdentification) idScanResult.getResult()).toJSONObject();
|
|
357
|
-
|
|
358
|
-
try {
|
|
359
|
-
jsonResult = AnylinePluginHelper.jsonHelper(Anyline4Activity.this, idScanResult,
|
|
360
|
-
jsonResult);
|
|
361
|
-
} catch (Exception e) {
|
|
362
|
-
Log.e(TAG, "Exception is: ", e);
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
setResult(scanViewPlugin, jsonResult);
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
321
|
} else if (((IdScanPlugin) ((IdScanViewPlugin) scanViewPlugin).getScanPlugin()).getIdConfig() instanceof UniversalIdConfig) {
|
|
369
322
|
scanViewPlugin.addScanResultListener(new ScanResultListener<ScanResult<ID>>() {
|
|
370
323
|
@Override
|
|
@@ -428,7 +381,7 @@ public class Anyline4Activity extends AnylineBaseActivity {
|
|
|
428
381
|
|
|
429
382
|
PDF417 pdf417 = barcodeList.get(i).getParsedPDF417();
|
|
430
383
|
|
|
431
|
-
if(pdf417 != null) {
|
|
384
|
+
if (pdf417 != null) {
|
|
432
385
|
barcode.put("parsedPDF417", pdf417.toJSONObject());
|
|
433
386
|
}
|
|
434
387
|
barcodeArray.put(barcode);
|
|
@@ -487,7 +440,17 @@ public class Anyline4Activity extends AnylineBaseActivity {
|
|
|
487
440
|
getString(getResources().getIdentifier("error_invalid_json_data", "string", getPackageName()))
|
|
488
441
|
+ "\n" + e.getLocalizedMessage());
|
|
489
442
|
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
private void setDefaultOrientation(JSONObject jsonObject) {
|
|
446
|
+
if (defaultOrientationApplied) return;
|
|
490
447
|
|
|
448
|
+
if (jsonObject.has("defaultOrientation")
|
|
449
|
+
&& jsonObject.optString("defaultOrientation").equals("landscape")
|
|
450
|
+
&& getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
|
451
|
+
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
|
452
|
+
}
|
|
453
|
+
defaultOrientationApplied = true;
|
|
491
454
|
}
|
|
492
455
|
|
|
493
456
|
private boolean shouldEnablePDF417(JSONObject jsonObject) {
|
package/ios/ALPluginHelper.m
CHANGED
|
@@ -423,46 +423,6 @@
|
|
|
423
423
|
[dictResult setValue:[ALPluginHelper stringForDate:[scanResult.result dayOfBirthDateObject]] forKey:@"dateOfBirthObject"];
|
|
424
424
|
[dictResult setValue:[ALPluginHelper stringForDate:[scanResult.result dateOfExpiryObject]] forKey:@"dateOfExpiryObject"];
|
|
425
425
|
[dictResult setValue:confidences forKey:@"fieldConfidences"];
|
|
426
|
-
} else if ([scanResult.result isKindOfClass:[ALDrivingLicenseIdentification class]]) {
|
|
427
|
-
NSMutableArray<NSString *> *keys=[@[
|
|
428
|
-
@"surname",
|
|
429
|
-
@"givenNames",
|
|
430
|
-
@"dateOfBirth",
|
|
431
|
-
@"placeOfBirth",
|
|
432
|
-
@"dateOfIssue",
|
|
433
|
-
@"dateOfExpiry",
|
|
434
|
-
@"authority",
|
|
435
|
-
@"documentNumber",
|
|
436
|
-
@"categories",
|
|
437
|
-
@"drivingLicenseString"
|
|
438
|
-
] mutableCopy];
|
|
439
|
-
dictResult = [[scanResult.result dictionaryWithValuesForKeys:keys] mutableCopy];
|
|
440
|
-
//we have field confidences for everything but drivingLicenseString
|
|
441
|
-
[keys removeObject:@"drivingLicenseString"];
|
|
442
|
-
[dictResult setValue:[[scanResult.result fieldConfidences] dictionaryWithValuesForKeys:keys] forKey:@"fieldConfidences"];
|
|
443
|
-
[dictResult setValue:[ALPluginHelper stringForDate:[scanResult.result dateOfBirthObject]] forKey:@"dateOfBirthObject"];
|
|
444
|
-
[dictResult setValue:[ALPluginHelper stringForDate:[scanResult.result dateOfIssueObject]] forKey:@"dateOfIssueObject"];
|
|
445
|
-
[dictResult setValue:[ALPluginHelper stringForDate:[scanResult.result dateOfExpiryObject]] forKey:@"dateOfExpiryObject"];
|
|
446
|
-
|
|
447
|
-
} else if ([scanResult.result isKindOfClass:[ALGermanIDFrontIdentification class]]) {
|
|
448
|
-
ALGermanIDFrontIdentification *germanIDFrontIdentification = (ALGermanIDFrontIdentification *)scanResult.result;
|
|
449
|
-
NSMutableArray<NSString *> *keys=[@[
|
|
450
|
-
@"surname",
|
|
451
|
-
@"givenNames",
|
|
452
|
-
@"dateOfBirth",
|
|
453
|
-
@"nationality",
|
|
454
|
-
@"placeOfBirth",
|
|
455
|
-
@"dateOfExpiry",
|
|
456
|
-
@"documentNumber",
|
|
457
|
-
@"cardAccessNumber",
|
|
458
|
-
@"germanIdFrontString"
|
|
459
|
-
] mutableCopy];
|
|
460
|
-
dictResult = [[germanIDFrontIdentification dictionaryWithValuesForKeys:keys] mutableCopy];
|
|
461
|
-
//we have field confidences for everything but germanIdFrontString
|
|
462
|
-
[keys removeObject:@"germanIdFrontString"];
|
|
463
|
-
[dictResult setValue:[[scanResult.result fieldConfidences] dictionaryWithValuesForKeys:keys] forKey:@"fieldConfidences"];
|
|
464
|
-
[dictResult setValue:[ALPluginHelper stringForDate:[scanResult.result dateOfBirthObject]] forKey:@"dateOfBirthObject"];
|
|
465
|
-
[dictResult setValue:[ALPluginHelper stringForDate:[scanResult.result dateOfExpiryObject]] forKey:@"dateOfExpiryObject"];
|
|
466
426
|
}
|
|
467
427
|
|
|
468
428
|
[dictResult setValue:imagePath forKey:@"imagePath"];
|
|
@@ -597,6 +557,7 @@
|
|
|
597
557
|
//Create the result Object
|
|
598
558
|
NSMutableDictionary *dictResult = [NSMutableDictionary dictionaryWithCapacity:5];
|
|
599
559
|
[dictResult setValue:scanResult.country forKey:@"country"];
|
|
560
|
+
[dictResult setValue:scanResult.area forKey:@"area"];
|
|
600
561
|
[dictResult setValue:scanResult.result forKey:@"licensePlate"];
|
|
601
562
|
[dictResult setValue:[ALPluginHelper stringForOutline:outline] forKey:@"outline"];
|
|
602
563
|
[dictResult setValue:@(scanResult.confidence) forKey:@"confidence"];
|
package/ios/AnylineReact.podspec
CHANGED
|
@@ -19,6 +19,6 @@ Pod::Spec.new do |s|
|
|
|
19
19
|
s.source = { :git => "https://github.com/Anyline/anyline-ocr-react-native-module.git", :tag => "#{s.version}" }
|
|
20
20
|
|
|
21
21
|
s.source_files = "*.{h,m}"
|
|
22
|
-
s.dependency "Anyline", "~>
|
|
22
|
+
s.dependency "Anyline", "~> 36"
|
|
23
23
|
s.dependency "React"
|
|
24
24
|
end
|
package/ios/AnylineSDKPlugin.m
CHANGED
|
@@ -235,7 +235,7 @@ RCT_EXPORT_METHOD(getSDKVersion:(RCTPromiseResolveBlock)resolve rejecter:(RCTPro
|
|
|
235
235
|
|
|
236
236
|
- (BOOL)scanModeIndex:(NSString *)scanMode{
|
|
237
237
|
|
|
238
|
-
NSArray *possibleScanModes = @[@"DOCUMENT", @"MRZ", @"BARCODE", @"LICENSE_PLATE", @"ANYLINE_OCR", @"ANALOG_METER", @"DIGITAL_METER", @"AUTO_ANALOG_DIGITAL_METER",
|
|
238
|
+
NSArray *possibleScanModes = @[@"DOCUMENT", @"MRZ", @"BARCODE", @"LICENSE_PLATE", @"LICENSE_PLATE_US", @"ANYLINE_OCR", @"ANALOG_METER", @"DIGITAL_METER", @"AUTO_ANALOG_DIGITAL_METER",
|
|
239
239
|
@"DIAL_METER", @"SERIAL_NUMBER", @"HEAT_METER_4", @"HEAT_METER_5", @"HEAT_METER_6", @"DOT_MATRIX_METER"];
|
|
240
240
|
|
|
241
241
|
return [possibleScanModes containsObject: [scanMode uppercaseString]];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_from": "anyline-ocr-react-native-module@^
|
|
3
|
-
"_id": "anyline-ocr-react-native-module@
|
|
2
|
+
"_from": "anyline-ocr-react-native-module@^36.0.0",
|
|
3
|
+
"_id": "anyline-ocr-react-native-module@36.0.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@^
|
|
11
|
+
"raw": "anyline-ocr-react-native-module@^36.0.0",
|
|
12
12
|
"name": "anyline-ocr-react-native-module",
|
|
13
13
|
"escapedName": "anyline-ocr-react-native-module",
|
|
14
|
-
"rawSpec": "^
|
|
14
|
+
"rawSpec": "^36.0.0",
|
|
15
15
|
"saveSpec": null,
|
|
16
|
-
"fetchSpec": "^
|
|
16
|
+
"fetchSpec": "^36.0.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-
|
|
21
|
+
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-36.0.0.tgz",
|
|
22
22
|
"_shasum": "bacbcd260cc662244f59393ed81a6edba009b52c",
|
|
23
|
-
"_spec": "anyline-ocr-react-native-module@^
|
|
23
|
+
"_spec": "anyline-ocr-react-native-module@^36.0.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": "
|
|
50
|
+
"version": "36.0.0"
|
|
51
51
|
}
|