dynamsoft-capture-vision-react-native 2.6.1016 → 3.0.5100

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.
Files changed (138) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +7 -9
  3. package/android/build.gradle +73 -42
  4. package/android/src/main/cpp/CMakeLists.txt +22 -0
  5. package/android/src/main/cpp/ImgHO.cpp +95 -0
  6. package/android/src/main/cpp/ImgHO.h +34 -0
  7. package/android/src/main/cpp/JsiCore.cpp +284 -0
  8. package/android/src/main/cpp/JsiCore.h +51 -0
  9. package/android/src/main/cpp/JsiCvr.cpp +327 -0
  10. package/android/src/main/cpp/JsiCvr.h +54 -0
  11. package/android/src/main/cpp/JsiDbr.cpp +38 -0
  12. package/android/src/main/cpp/JsiDbr.h +26 -0
  13. package/android/src/main/cpp/JsiDce.cpp +59 -0
  14. package/android/src/main/cpp/JsiDce.h +17 -0
  15. package/android/src/main/cpp/JsiDcp.cpp +51 -0
  16. package/android/src/main/cpp/JsiDcp.h +31 -0
  17. package/android/src/main/cpp/JsiDdn.cpp +50 -0
  18. package/android/src/main/cpp/JsiDdn.h +28 -0
  19. package/android/src/main/cpp/JsiDlr.cpp +51 -0
  20. package/android/src/main/cpp/JsiDlr.h +26 -0
  21. package/android/src/main/cpp/JsiUtility.cpp +196 -0
  22. package/android/src/main/cpp/JsiUtility.h +16 -0
  23. package/android/src/main/cpp/RawBuffer.cpp +24 -0
  24. package/android/src/main/cpp/RawBuffer.h +24 -0
  25. package/android/src/main/cpp/android_log.h +14 -0
  26. package/android/src/main/dysJniLibs/debug/arm64-v8a/librn_dys.so +0 -0
  27. package/android/src/main/dysJniLibs/debug/armeabi-v7a/librn_dys.so +0 -0
  28. package/android/src/main/dysJniLibs/debug/x86/librn_dys.so +0 -0
  29. package/android/src/main/dysJniLibs/debug/x86_64/librn_dys.so +0 -0
  30. package/android/src/main/dysJniLibs/release/arm64-v8a/librn_dys.so +0 -0
  31. package/android/src/main/dysJniLibs/release/armeabi-v7a/librn_dys.so +0 -0
  32. package/android/src/main/dysJniLibs/release/x86/librn_dys.so +0 -0
  33. package/android/src/main/dysJniLibs/release/x86_64/librn_dys.so +0 -0
  34. package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CVRModule.kt +4 -4
  35. package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/DCEModule.kt +10 -0
  36. package/android/src/main/java/com/dynamsoft/reactnativelib/ReactNativeDcvPackage.kt +13 -85
  37. package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/VersionsModule.kt +2 -2
  38. package/android/src/main/java/com/dynamsoft/reactnativelib/cvr/CaptureVisionRouterModuleImpl.kt +25 -25
  39. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +23 -2
  40. package/android/src/main/java/com/dynamsoft/reactnativelib/license/LicenseModuleImpl.kt +1 -1
  41. package/android/src/main/java/com/dynamsoft/reactnativelib/utility/ImageManagerModuleImpl.kt +19 -4
  42. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCore.kt +14 -0
  43. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCvr.kt +12 -7
  44. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDBR.kt +1 -7
  45. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDCE.kt +2 -2
  46. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDDN.kt +27 -19
  47. package/dynamsoft-capture-vision-react-native.podspec +9 -7
  48. package/ios/CPP/DSImageData+HostObject.h +1 -1
  49. package/ios/CPP/RNDynamsoft+JSI.h +2 -2
  50. package/ios/CPP/RNDynamsoft+JSI.mm +18 -10
  51. package/ios/CPP/RNDynamsoft+Json.h +2 -13
  52. package/ios/CPP/RNDynamsoft+Json.m +48 -39
  53. package/ios/CPP/YeetJSIUtils.h +3 -1
  54. package/ios/CPP/YeetJSIUtils.mm +5 -0
  55. package/ios/RNDynamsoftCameraView.m +1 -1
  56. package/ios/RNDynamsoftCameraViewManager.m +23 -8
  57. package/ios/RNDynamsoftCaptureVisionRouter.mm +76 -45
  58. package/ios/RNDynamsoftImageEditorView.m +1 -1
  59. package/ios/RNDynamsoftImageEditorViewManager.mm +36 -13
  60. package/ios/RNDynamsoftImageManager.mm +33 -4
  61. package/ios/RNDynamsoftImageSourceAdapter.mm +1 -1
  62. package/ios/RNDynamsoftLicense.m +1 -1
  63. package/ios/RNDynamsoftMultiCrossFilter.m +9 -9
  64. package/ios/RNDynamsoftVersions.m +1 -13
  65. package/package.json +3 -11
  66. package/src/core/CapturedResultBase.tsx +18 -0
  67. package/src/core/EnumCaptureResultItemType.tsx +12 -6
  68. package/src/core/EnumCrossVerificationStatus.tsx +6 -6
  69. package/src/core/ImageData.tsx +1 -1
  70. package/src/core/index.tsx +1 -0
  71. package/src/cvr/CaptureVisionRouter.tsx +47 -51
  72. package/src/cvr/CapturedResult.tsx +24 -46
  73. package/src/cvr/CapturedResultReceiver.tsx +12 -19
  74. package/src/cvr/NativeDynamsoftCaptureVisionRouterModule.tsx +2 -2
  75. package/src/cvr/SimplifiedCaptureVisionSettings.tsx +4 -4
  76. package/src/dbr/DecodedBarcodesResult.tsx +3 -17
  77. package/src/dce/CameraEnhancer.tsx +9 -0
  78. package/src/dce/DynamsoftCameraViewNativeComponent.ts +2 -2
  79. package/src/dce/EnumResolution.tsx +7 -0
  80. package/src/dce/NativeDynamsoftCameraViewModule.tsx +4 -0
  81. package/src/dce/index.tsx +1 -0
  82. package/src/dcp/ParsedResult.tsx +3 -14
  83. package/src/ddn/DeskewedImageResultItem.tsx +40 -0
  84. package/src/ddn/DetectedQuadResultItem.tsx +3 -1
  85. package/src/ddn/EnhancedImageResultItem.tsx +20 -0
  86. package/src/ddn/ProcessedDocumentResult.tsx +27 -0
  87. package/src/ddn/SimplifiedDocumentNormalizerSettings.tsx +18 -3
  88. package/src/ddn/index.tsx +3 -3
  89. package/src/dlr/RecognizedTextLinesResult.tsx +2 -16
  90. package/src/index.tsx +0 -1
  91. package/src/utility/ImageManager.tsx +66 -45
  92. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/BarcodeScannerModuleImpl.kt +0 -80
  93. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/MRZScannerModuleImpl.kt +0 -77
  94. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/ScannerInterface.kt +0 -47
  95. package/android/src/main/jniLibs/arm64-v8a/librn_dys.so +0 -0
  96. package/android/src/main/jniLibs/armeabi-v7a/librn_dys.so +0 -0
  97. package/android/src/main/jniLibs/x86/librn_dys.so +0 -0
  98. package/android/src/main/jniLibs/x86_64/librn_dys.so +0 -0
  99. package/android/src/newarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -22
  100. package/android/src/newarch/com/dynamsoft/reactnativelib/CVRModule.kt +0 -91
  101. package/android/src/newarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -52
  102. package/android/src/newarch/com/dynamsoft/reactnativelib/DCEModule.kt +0 -91
  103. package/android/src/newarch/com/dynamsoft/reactnativelib/ISAModule.kt +0 -60
  104. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -16
  105. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -24
  106. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -12
  107. package/android/src/newarch/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -14
  108. package/android/src/newarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -22
  109. package/android/src/newarch/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -58
  110. package/android/src/newarch/com/dynamsoft/reactnativelib/VersionsModule.kt +0 -41
  111. package/android/src/oldarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -24
  112. package/android/src/oldarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -24
  113. package/ios/RNDynamsoftBarcodeScanner.h +0 -14
  114. package/ios/RNDynamsoftBarcodeScanner.m +0 -169
  115. package/ios/RNDynamsoftMRZScanner.h +0 -14
  116. package/ios/RNDynamsoftMRZScanner.m +0 -140
  117. package/src/ddn/DetectedQuadsResult.tsx +0 -31
  118. package/src/ddn/NormalizedImageResultItem.tsx +0 -32
  119. package/src/ddn/NormalizedImagesResult.tsx +0 -27
  120. package/src/rtu/BarcodeScanConfig.tsx +0 -104
  121. package/src/rtu/BarcodeScanResult.tsx +0 -31
  122. package/src/rtu/BarcodeScanner.tsx +0 -112
  123. package/src/rtu/EnumResultState.tsx +0 -21
  124. package/src/rtu/MRZScanConfig.tsx +0 -67
  125. package/src/rtu/MRZScanResult.tsx +0 -84
  126. package/src/rtu/MRZScanner.tsx +0 -90
  127. package/src/rtu/NativeDynamsoftBarcodeScannerModule.tsx +0 -6
  128. package/src/rtu/NativeDynamsoftMRZScannerModule.tsx +0 -6
  129. package/src/rtu/index.tsx +0 -7
  130. /package/android/src/main/{withNamespace/AndroidManifest.xml → AndroidManifest.xml} +0 -0
  131. /package/android/src/main/{withoutNamespace/AndroidManifest.xml → AndroidManifest_noPackage.xml} +0 -0
  132. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -0
  133. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ISAModule.kt +0 -0
  134. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -0
  135. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -0
  136. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -0
  137. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -0
  138. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -0
@@ -1,24 +0,0 @@
1
- package com.dynamsoft.reactnativelib
2
-
3
- import com.dynamsoft.reactnativelib.rtu.MRZScannerModuleImpl
4
- import com.facebook.react.bridge.Promise
5
- import com.facebook.react.bridge.ReactApplicationContext
6
- import com.facebook.react.bridge.ReactContextBaseJavaModule
7
- import com.facebook.react.bridge.ReactMethod
8
- import com.facebook.react.bridge.ReadableMap
9
-
10
- class MRZScannerModule(reactApplicationContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactApplicationContext) {
11
- override fun getName() = MRZScannerModuleImpl.NAME
12
-
13
- val impl by lazy { MRZScannerModuleImpl(reactApplicationContext) }
14
-
15
- @ReactMethod
16
- fun startMRZScanner(config: ReadableMap, promise: Promise) {
17
- impl.startMRZScanner(config, promise)
18
- }
19
-
20
- @ReactMethod
21
- fun closeMRZScanner(promise: Promise) {
22
- impl.closeMRZScanner(promise)
23
- }
24
- }
@@ -1,14 +0,0 @@
1
- /*
2
- * Copyright © Dynamsoft Corporation. All rights reserved.
3
- */
4
-
5
- #import "RCTEventEmitter.h"
6
- #import <React/RCTBridgeModule.h>
7
-
8
- NS_ASSUME_NONNULL_BEGIN
9
-
10
- @interface RNDynamsoftBarcodeScanner : RCTEventEmitter <RCTBridgeModule>
11
-
12
- @end
13
-
14
- NS_ASSUME_NONNULL_END
@@ -1,169 +0,0 @@
1
- /*
2
- * Copyright © Dynamsoft Corporation. All rights reserved.
3
- */
4
-
5
- #import "RNDynamsoftBarcodeScanner.h"
6
- #import <DynamsoftBarcodeReaderBundle/DynamsoftBarcodeReaderBundle-Swift.h>
7
- #import <DynamsoftBarcodeReaderBundle/DynamsoftBarcodeReaderBundle.h>
8
- #import <React/RCTUtils.h>
9
- #import "RNDynamsoft+Json.h"
10
-
11
- @implementation DSBarcodeScanResult (json)
12
-
13
- - (NSDictionary *)toJson {
14
- id barcodes = [NSNull null];
15
- if (self.barcodes != nil && self.barcodes.count > 0) {
16
- barcodes = [NSMutableArray array];
17
- for (DSBarcodeResultItem *item in self.barcodes) {
18
- NSDictionary *dic = [item toJson];
19
- if (dic) {
20
- [barcodes addObject:dic];
21
- }
22
- }
23
- }
24
- id errorString = self.errorString ? self.errorString : [NSNull null];
25
- NSDictionary *dictionary = @{ @"resultStatus":@(self.resultStatus), @"barcodes":barcodes, @"errorCode":@(self.errorCode), @"errorString":errorString };
26
- return dictionary;
27
- }
28
-
29
- @end
30
-
31
- @interface RNDynamsoftBarcodeScanner ()
32
-
33
- @end
34
-
35
- @implementation RNDynamsoftBarcodeScanner
36
- RCT_EXPORT_MODULE(DynamsoftBarcodeScannerModule)
37
-
38
- RCT_EXPORT_METHOD(startBarcodeScanner:(NSDictionary*)configuration
39
- withResolver:(RCTPromiseResolveBlock)resolve
40
- withRejecter:(RCTPromiseRejectBlock)reject) {
41
-
42
- runOnMainThread(^{
43
- UIViewController *presentedViewController = [self presentedViewController:reject];
44
- if (presentedViewController == NULL) {
45
- return;
46
- }
47
- DSBarcodeScannerViewController *viewController = [[DSBarcodeScannerViewController alloc] init];
48
- viewController.modalPresentationStyle = UIModalPresentationFullScreen;
49
- DSBarcodeScannerConfig *config = [self configWithDictionary:configuration];
50
- if (config) {
51
- viewController.config = config;
52
- }
53
- viewController.onScannedResult = ^(DSBarcodeScanResult *result) {
54
- resolve([result toJson]);
55
- };
56
- [presentedViewController presentViewController:viewController animated:true completion:NULL];
57
- });
58
- }
59
-
60
- RCT_EXPORT_METHOD(closeBarcodeScanner:
61
- (RCTPromiseResolveBlock)resolve
62
- withRejecter:(RCTPromiseRejectBlock)reject) {
63
- runOnMainThread(^{
64
- UIViewController *presentedViewController = [self presentedViewController:reject];
65
- if (presentedViewController == NULL) {
66
- return;
67
- }
68
- [presentedViewController dismissViewControllerAnimated:true completion:nil];
69
- resolve(@(true));
70
- });
71
- }
72
-
73
- - (nullable UIViewController *) presentedViewController:(RCTPromiseRejectBlock)reject {
74
- UIViewController *presentedViewController = RCTPresentedViewController();
75
- if (presentedViewController == NULL) {
76
- reject(@"RTUUI_ERROR", @"No active view controller", nil);
77
- return NULL;
78
- }
79
- return presentedViewController;
80
- }
81
-
82
- - (nullable DSBarcodeScannerConfig *)configWithDictionary:(NSDictionary*)configuration {
83
- if (configuration) {
84
- DSBarcodeScannerConfig *config = [[DSBarcodeScannerConfig alloc] init];
85
-
86
- NSString *license = [configuration valueForKey:@"license"];
87
- if (license) {
88
- config.license = license;
89
- }
90
-
91
- NSString *templateFile = [configuration valueForKey:@"templateFile"];
92
- if (templateFile) {
93
- config.templateFile = templateFile;
94
- }
95
-
96
- NSNumber *isTorchButtonVisible = [configuration valueForKey:@"isTorchButtonVisible"];
97
- if (isTorchButtonVisible) {
98
- config.isTorchButtonVisible = isTorchButtonVisible.boolValue;
99
- }
100
-
101
- NSDictionary *region = [configuration valueForKey:@"scanRegion"];
102
- if (region) {
103
- NSNumber *top = [region valueForKey:@"top"];
104
- NSNumber *left = [region valueForKey:@"left"];
105
- NSNumber *right = [region valueForKey:@"right"];
106
- NSNumber *bottom = [region valueForKey:@"bottom"];
107
- NSNumber *measuredInPercentage = [region valueForKey:@"measuredInPercentage"];
108
- if (top && left && right && bottom && measuredInPercentage) {
109
- DSRect *rect = [[DSRect alloc] init];
110
- rect.top = top.floatValue;
111
- rect.left = left.floatValue;
112
- rect.right = right.floatValue;
113
- rect.bottom = bottom.floatValue;
114
- rect.measuredInPercentage = measuredInPercentage.boolValue;
115
- config.scanRegion = rect;
116
- }
117
- }
118
-
119
- NSNumber *isBeepEnabled = [configuration valueForKey:@"isBeepEnabled"];
120
- if (isBeepEnabled) {
121
- config.isBeepEnabled = isBeepEnabled.boolValue;
122
- }
123
-
124
- NSNumber *isScanLaserVisible = [configuration valueForKey:@"isScanLaserVisible"];
125
- if (isScanLaserVisible) {
126
- config.isScanLaserVisible = isScanLaserVisible.boolValue;
127
- }
128
-
129
- NSNumber *isAutoZoomEnabled = [configuration valueForKey:@"isAutoZoomEnabled"];
130
- if (isAutoZoomEnabled) {
131
- config.isAutoZoomEnabled = isAutoZoomEnabled.boolValue;
132
- }
133
-
134
- NSNumber *isCloseButtonVisible = [configuration valueForKey:@"isCloseButtonVisible"];
135
- if (isCloseButtonVisible) {
136
- config.isCloseButtonVisible = isCloseButtonVisible.boolValue;
137
- }
138
-
139
- NSString *_barcodeFormatNumberString = [configuration valueForKey:@"_barcodeFormatNumberString"];
140
- if (_barcodeFormatNumberString) {
141
- config.barcodeFormats = _barcodeFormatNumberString.integerValue;
142
- }
143
-
144
- NSNumber *scanningMode = [configuration valueForKey:@"scanningMode"];
145
- if (scanningMode) {
146
- config.scanningMode = scanningMode.integerValue;
147
- }
148
-
149
- NSNumber *maxConsecutiveStableFramesToExit = [configuration valueForKey:@"maxConsecutiveStableFramesToExit"];
150
- if (maxConsecutiveStableFramesToExit) {
151
- config.maxConsecutiveStableFramesToExit = maxConsecutiveStableFramesToExit.integerValue;
152
- }
153
-
154
- NSNumber *expectedBarcodesCount = [configuration valueForKey:@"expectedBarcodesCount"];
155
- if (expectedBarcodesCount) {
156
- config.expectedBarcodesCount = expectedBarcodesCount.integerValue;
157
- }
158
-
159
- NSNumber *isCameraToggleButtonVisible = [configuration valueForKey:@"isCameraToggleButtonVisible"];
160
- if (isCameraToggleButtonVisible) {
161
- config.isCameraToggleButtonVisible = isCameraToggleButtonVisible.boolValue;
162
- }
163
-
164
- return config;
165
- }
166
- return nil;
167
- }
168
-
169
- @end
@@ -1,14 +0,0 @@
1
- /*
2
- * Copyright © Dynamsoft Corporation. All rights reserved.
3
- */
4
-
5
- #import "RCTEventEmitter.h"
6
- #import <React/RCTBridgeModule.h>
7
-
8
- NS_ASSUME_NONNULL_BEGIN
9
-
10
- @interface RNDynamsoftMRZScanner : RCTEventEmitter <RCTBridgeModule>
11
-
12
- @end
13
-
14
- NS_ASSUME_NONNULL_END
@@ -1,140 +0,0 @@
1
- /*
2
- * Copyright © Dynamsoft Corporation. All rights reserved.
3
- */
4
-
5
- #import "RNDynamsoftMRZScanner.h"
6
- #import <DynamsoftMRZScannerBundle/DynamsoftMRZScannerBundle-Swift.h>
7
- #import <DynamsoftMRZScannerBundle/DynamsoftMRZScannerBundle.h>
8
- #import <React/RCTUtils.h>
9
- #import "RNDynamsoft+Json.h"
10
-
11
- @implementation DSMRZScanResult (json)
12
-
13
- - (NSDictionary *)toJson {
14
- id data = [NSNull null];
15
- if (self.data != nil ) {
16
- DSMRZData *mrzData = self.data;
17
- data = @{
18
- @"firstName":mrzData.firstName,
19
- @"lastName":mrzData.lastName,
20
- @"sex":mrzData.sex,
21
- @"issuingState":mrzData.issuingState,
22
- @"nationality":mrzData.nationality,
23
- @"dateOfBirth":mrzData.dateOfBirth,
24
- @"dateOfExpire":mrzData.dateOfExpire,
25
- @"documentType":mrzData.documentType,
26
- @"documentNumber":mrzData.documentNumber,
27
- @"age":@(mrzData.age),
28
- @"mrzText":mrzData.mrzText
29
- };
30
- }
31
- id errorString = self.errorString ? self.errorString : [NSNull null];
32
- NSDictionary *dictionary = @{
33
- @"resultStatus":@(self.resultStatus),
34
- @"data":data,
35
- @"errorCode":@(self.errorCode),
36
- @"errorString":errorString
37
- };
38
- return dictionary;
39
- }
40
-
41
- @end
42
-
43
- @implementation RNDynamsoftMRZScanner
44
-
45
- RCT_EXPORT_MODULE(DynamsoftMRZScannerModule)
46
-
47
- RCT_EXPORT_METHOD(startMRZScanner:(NSDictionary*)configuration
48
- withResolver:(RCTPromiseResolveBlock)resolve
49
- withRejecter:(RCTPromiseRejectBlock)reject) {
50
-
51
- runOnMainThread(^{
52
- UIViewController *presentedViewController = [self presentedViewController:reject];
53
- if (presentedViewController == NULL) {
54
- return;
55
- }
56
- DSMRZScannerViewController *viewController = [[DSMRZScannerViewController alloc] init];
57
- viewController.modalPresentationStyle = UIModalPresentationFullScreen;
58
- DSMRZScannerConfig *config = [self configWithDictionary:configuration];
59
- if (config) {
60
- viewController.config = config;
61
- }
62
- viewController.onScannedResult = ^(DSMRZScanResult *result) {
63
- resolve([result toJson]);
64
- };
65
- [presentedViewController presentViewController:viewController animated:true completion:NULL];
66
- });
67
- }
68
-
69
- RCT_EXPORT_METHOD(closeMRZScanner:
70
- (RCTPromiseResolveBlock)resolve
71
- withRejecter:(RCTPromiseRejectBlock)reject) {
72
- runOnMainThread(^{
73
- UIViewController *presentedViewController = [self presentedViewController:reject];
74
- if (presentedViewController == NULL) {
75
- return;
76
- }
77
- [presentedViewController dismissViewControllerAnimated:true completion:nil];
78
- resolve(@(true));
79
- });
80
- }
81
-
82
- - (nullable UIViewController *) presentedViewController:(RCTPromiseRejectBlock)reject {
83
- UIViewController *presentedViewController = RCTPresentedViewController();
84
- if (presentedViewController == NULL) {
85
- reject(@"RTUUI_ERROR", @"No active view controller", nil);
86
- return NULL;
87
- }
88
- return presentedViewController;
89
- }
90
-
91
- - (nullable DSMRZScannerConfig *)configWithDictionary:(NSDictionary*)configuration {
92
- if (configuration) {
93
- DSMRZScannerConfig *config = [[DSMRZScannerConfig alloc] init];
94
-
95
- NSString *license = [configuration valueForKey:@"license"];
96
- if (license) {
97
- config.license = license;
98
- }
99
-
100
- // NSString *templateFile = [configuration valueForKey:@"templateFile"];
101
- // if (templateFile) {
102
- // config.templateFile = templateFile;
103
- // }
104
-
105
- NSNumber *isTorchButtonVisible = [configuration valueForKey:@"isTorchButtonVisible"];
106
- if (isTorchButtonVisible) {
107
- config.isTorchButtonVisible = isTorchButtonVisible.boolValue;
108
- }
109
-
110
- NSNumber *isBeepEnabled = [configuration valueForKey:@"isBeepEnabled"];
111
- if (isBeepEnabled) {
112
- config.isBeepEnabled = isBeepEnabled.boolValue;
113
- }
114
-
115
- NSNumber *isCloseButtonVisible = [configuration valueForKey:@"isCloseButtonVisible"];
116
- if (isCloseButtonVisible) {
117
- config.isCloseButtonVisible = isCloseButtonVisible.boolValue;
118
- }
119
-
120
- NSNumber *documentType = [configuration valueForKey:@"documentType"];
121
- if (documentType) {
122
- config.documentType = documentType.integerValue;
123
- }
124
-
125
- NSNumber *isGuideFrameVisible = [configuration valueForKey:@"isGuideFrameVisible"];
126
- if (isGuideFrameVisible) {
127
- config.isGuideFrameVisible = isGuideFrameVisible.boolValue;
128
- }
129
-
130
- NSNumber *isCameraToggleButtonVisible = [configuration valueForKey:@"isCameraToggleButtonVisible"];
131
- if (isCameraToggleButtonVisible) {
132
- config.isCameraToggleButtonVisible = isCameraToggleButtonVisible.boolValue;
133
- }
134
-
135
- return config;
136
- }
137
- return nil;
138
- }
139
-
140
- @end
@@ -1,31 +0,0 @@
1
- import type {DetectedQuadResultItem} from "./DetectedQuadResultItem";
2
- import {type CapturedResultReceiver, IntermediateResultManager} from "../cvr";
3
-
4
- /**{@link IntermediateResultManager}*/
5
-
6
- /**
7
- * The DetectedQuadsResult interface holds information on detected quadrilaterals,
8
- * of type {@link DetectedQuadResultItem}, within an image.
9
- * @see {@link CapturedResultReceiver.onDetectedQuadsReceived}
10
- * */
11
- export interface DetectedQuadsResult {
12
- /**
13
- * The hash ID of the original image.
14
- * @see IntermediateResultManager.getOriginalImage
15
- * */
16
- originalImageHashId: string;
17
-
18
- /**
19
- * An array of {@link DetectedQuadResultItem} objects, each representing a detected quadrilateral within the original image.
20
- * */
21
- items?: Array<DetectedQuadResultItem>;
22
-
23
- /**The error code of the barcode reading result, if an error occurred.*/
24
- errorCode: number;
25
-
26
- /**The error message of the barcode reading result, if an error occurred.*/
27
- errorMessage?: string;
28
-
29
- /**the rotation transformation matrix of the original image relative to the rotated image.*/
30
- rotationTransformMatrix: Array<number>;
31
- }
@@ -1,32 +0,0 @@
1
- import type {ImageData, CapturedResultItem, Quadrilateral, EnumCrossVerificationStatus, EnumCapturedResultItemType} from "../core";
2
- import {CaptureVisionRouter} from "../cvr";
3
- import {MultiFrameResultCrossFilter} from "../utility";
4
-
5
- /**
6
- * The NormalizedImageResultItem interface extends the CapturedResultItem interface and represents a normalized image result item.
7
- * @see {@link NormalizedImagesResult}
8
- * @see {@link EnumCapturedResultItemType.CRIT_NORMALIZED_IMAGE}
9
- * */
10
- export interface NormalizedImageResultItem extends CapturedResultItem {
11
- /**
12
- * The location where the normalized image was extracted from within the original image, represented as a quadrilateral.
13
- * @see {@link Quadrilateral}
14
- * */
15
- location: Quadrilateral;
16
-
17
- /**The image data for the normalized image result.
18
- * @see {@link ImageData}*/
19
- imageData: ImageData;
20
-
21
- /**
22
- * The cross verification status of type {@link EnumCrossVerificationStatus}.
23
- *
24
- * @remarks If {@link CaptureVisionRouter} doesn't add {@link MultiFrameResultCrossFilter} via {@link CaptureVisionRouter.addFilter}
25
- * or added {@link MultiFrameResultCrossFilter} doesn't enable verification for the corresponding type,
26
- * the crossVerificationStatus property of the item for that type will always remain {@link EnumCrossVerificationStatus.CVS_NOT_VERIFIED}.
27
- *
28
- * @see {@link EnumCrossVerificationStatus}
29
- * @see {@link MultiFrameResultCrossFilter.enableResultCrossVerification}
30
- * */
31
- crossVerificationStatus: EnumCrossVerificationStatus | number
32
- }
@@ -1,27 +0,0 @@
1
- import type {NormalizedImageResultItem} from "./NormalizedImageResultItem";
2
- import {type CapturedResultReceiver, IntermediateResultManager} from "../cvr";
3
-
4
- /**{@link IntermediateResultManager}*/
5
-
6
- /**
7
- * The NormalizedImagesResult interface holds information on normalized images, of type NormalizedImageResultItem, derived from an original image.
8
- * @see {@link CapturedResultReceiver.onNormalizedImagesReceived}
9
- * */
10
- export interface NormalizedImagesResult {
11
- /**
12
- * The hash ID of the original image.
13
- * @see IntermediateResultManager.getOriginalImage
14
- * */
15
- originalImageHashId: string;
16
-
17
- /**
18
- * An array of {@link NormalizedImageResultItem} objects, each representing a piece of the original image after normalization.
19
- * */
20
- items?: Array<NormalizedImageResultItem>;
21
-
22
- /**The error code of the barcode reading result, if an error occurred.*/
23
- errorCode: number;
24
-
25
- /**The error message of the barcode reading result, if an error occurred.*/
26
- errorMessage?: string;
27
- }
@@ -1,104 +0,0 @@
1
- import type {EnumBarcodeFormat} from "../dbr";
2
- import type {DSRect} from "../core";
3
-
4
- export interface BarcodeScanConfig {
5
- /**
6
- * Sets the barcode format(s) to read.
7
- * This value is a combination of EnumBarcodeFormat flags that determine which barcode types to read.
8
- * For example, to scan QR codes and OneD codes,
9
- * set the value to `EnumBarcodeFormat.BF_QR_CODE | EnumBarcodeFormat.BF_ONED`.
10
- *
11
- * @see {@link EnumBarcodeFormat}
12
- * */
13
- barcodeFormats?: EnumBarcodeFormat,
14
-
15
- /**
16
- * internal field, don't set it.
17
- * */
18
- _barcodeFormatNumberString?: string,
19
-
20
- /**
21
- * The license key required to initialize the barcode reader.
22
- */
23
- license?: string,
24
-
25
- /**
26
- * Defines the scanning area as a DSRect object where barcodes will be detected.
27
- * Only the barcodes located within this defined region will be processed.
28
- *
29
- * @see {@link DSRect}
30
- */
31
- scanRegion?: DSRect,
32
- /**
33
- * Determines whether the torch (flashlight) button is visible in the scanning UI.
34
- * Set to true to display the torch button, enabling users to turn the flashlight on/off.
35
- */
36
- isTorchButtonVisible?: boolean,
37
-
38
- /**
39
- * Specifies if a beep sound should be played when a barcode is successfully detected.
40
- * Set to true to enable the beep sound, or false to disable it.
41
- */
42
- isBeepEnabled?: boolean,
43
-
44
- /**
45
- * Enables or disables the auto-zoom feature during scanning.
46
- * When enabled (true), the scanner will automatically zoom in to improve barcode detection.
47
- */
48
- isAutoZoomEnabled?: boolean,
49
-
50
- /**
51
- * Determines whether the close button is visible on the scanner UI.
52
- * This button allows users to exit the scanning interface.
53
- */
54
- isCloseButtonVisible?: boolean,
55
-
56
- /**
57
- * Specifies whether the camera toggle button is displayed.
58
- * This button lets users switch between available cameras (e.g., front and rear).
59
- */
60
- isCameraToggleButtonVisible?: boolean,
61
-
62
- /**
63
- * Determines if a scanning laser overlay is shown on the scanning screen.
64
- * This visual aid (scan laser) helps indicate the scanning line during barcode detection.
65
- */
66
- isScanLaserVisible?: boolean,
67
-
68
- /**
69
- * Sets the scanning mode for the barcode reader.
70
- * The mode is defined by the EnumScanningMode and affects the scanning behavior.
71
- *
72
- * @see {@link EnumScanningMode}
73
- */
74
- scanningMode?: EnumScanningMode,
75
-
76
- /**
77
- * Defines the expected number of barcodes to be scanned.
78
- * The scanning process will automatically stop when the number of detected barcodes reaches this count.
79
- */
80
- expectedBarcodesCount?: number,
81
-
82
- /**
83
- * Specifies the maximum number of consecutive stable frames to process before exiting scanning.
84
- * A "stable frame" is one where no new barcode is detected; the default value is typically 10.
85
- */
86
- maxConsecutiveStableFramesToExit?: number,
87
-
88
- /**
89
- * Specifies the template configuration for the barcode scanner.
90
- * This can be either a file path or a JSON string that defines various scanning parameters.
91
- */
92
- templateFile?: string,
93
-
94
- /**
95
- * Provides a Node.js 'require' function to load the template file when running in a Node environment.
96
- * This facilitates importing external template configuration files.
97
- */
98
- templateNodeRequire?: NodeRequire,
99
- }
100
-
101
- export enum EnumScanningMode {
102
- SM_SINGLE,
103
- SM_MULTIPLE
104
- }
@@ -1,31 +0,0 @@
1
- import type {BarcodeResultItem} from "../dbr";
2
- import type {EnumResultStatus} from "./EnumResultState";
3
-
4
- /**
5
- * BarcodeScanResult contains all decoded barcodes and their associated info.
6
- * */
7
- export interface BarcodeScanResult {
8
- /**
9
- * The status of the barcode scan result.
10
- * - {@link EnumResultStatus.RS_FINISHED}: The barcode scanning is finished.
11
- * - {@link EnumResultStatus.RS_CANCELED}: The barcode scanning activity is closed before the process is finished.
12
- * - {@link EnumResultStatus.RS_EXCEPTION}: Failed to start barcode scanning or an error occurs when scanning the barcodes.
13
- * */
14
- resultStatus: EnumResultStatus,
15
-
16
- /**
17
- * Returns the error code when the resultStatus is {@link EnumResultStatus.RS_EXCEPTION}.
18
- * */
19
- errorCode?: number,
20
-
21
- /**
22
- * Returns the errorString when the resultStatus is {@link EnumResultStatus.RS_EXCEPTION}.
23
- * */
24
- errorString?: string,
25
-
26
- /**
27
- * The decoded barcodes when the resultStatus is {@link EnumResultStatus.RS_FINISHED}.
28
- * @see {@link BarcodeResultItem}
29
- * */
30
- barcodes?: BarcodeResultItem[]
31
- }