dynamsoft-capture-vision-react-native 2.6.1015 → 3.0.3100

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 (112) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +7 -9
  3. package/android/build.gradle +29 -42
  4. package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CVRModule.kt +4 -4
  5. package/android/src/main/java/com/dynamsoft/reactnativelib/ReactNativeDcvPackage.kt +13 -85
  6. package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/VersionsModule.kt +2 -2
  7. package/android/src/main/java/com/dynamsoft/reactnativelib/cvr/CaptureVisionRouterModuleImpl.kt +23 -25
  8. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +2 -2
  9. package/android/src/main/java/com/dynamsoft/reactnativelib/license/LicenseModuleImpl.kt +1 -1
  10. package/android/src/main/java/com/dynamsoft/reactnativelib/utility/ImageManagerModuleImpl.kt +19 -4
  11. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCore.kt +14 -0
  12. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCvr.kt +12 -7
  13. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDBR.kt +1 -7
  14. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDCE.kt +2 -2
  15. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDDN.kt +27 -19
  16. package/android/src/main/jniLibs/debug/arm64-v8a/librn_dys.so +0 -0
  17. package/android/src/main/jniLibs/debug/armeabi-v7a/librn_dys.so +0 -0
  18. package/android/src/main/jniLibs/debug/x86/librn_dys.so +0 -0
  19. package/android/src/main/jniLibs/debug/x86_64/librn_dys.so +0 -0
  20. package/android/src/main/jniLibs/release/arm64-v8a/librn_dys.so +0 -0
  21. package/android/src/main/jniLibs/release/armeabi-v7a/librn_dys.so +0 -0
  22. package/android/src/main/jniLibs/release/x86/librn_dys.so +0 -0
  23. package/android/src/main/jniLibs/release/x86_64/librn_dys.so +0 -0
  24. package/dynamsoft-capture-vision-react-native.podspec +9 -7
  25. package/ios/CPP/DSImageData+HostObject.h +1 -1
  26. package/ios/CPP/RNDynamsoft+JSI.h +2 -2
  27. package/ios/CPP/RNDynamsoft+JSI.mm +18 -10
  28. package/ios/CPP/RNDynamsoft+Json.h +2 -13
  29. package/ios/CPP/RNDynamsoft+Json.m +48 -39
  30. package/ios/CPP/YeetJSIUtils.h +3 -1
  31. package/ios/CPP/YeetJSIUtils.mm +5 -0
  32. package/ios/RNDynamsoftCameraView.m +1 -1
  33. package/ios/RNDynamsoftCameraViewManager.m +18 -6
  34. package/ios/RNDynamsoftCaptureVisionRouter.mm +76 -45
  35. package/ios/RNDynamsoftImageEditorView.m +1 -1
  36. package/ios/RNDynamsoftImageEditorViewManager.mm +36 -13
  37. package/ios/RNDynamsoftImageManager.mm +33 -4
  38. package/ios/RNDynamsoftImageSourceAdapter.mm +1 -1
  39. package/ios/RNDynamsoftLicense.m +1 -1
  40. package/ios/RNDynamsoftMultiCrossFilter.m +9 -9
  41. package/ios/RNDynamsoftVersions.m +1 -13
  42. package/package.json +3 -11
  43. package/src/core/CapturedResultBase.tsx +18 -0
  44. package/src/core/EnumCaptureResultItemType.tsx +12 -6
  45. package/src/core/EnumCrossVerificationStatus.tsx +6 -6
  46. package/src/core/ImageData.tsx +1 -1
  47. package/src/core/index.tsx +1 -0
  48. package/src/cvr/CaptureVisionRouter.tsx +47 -51
  49. package/src/cvr/CapturedResult.tsx +24 -46
  50. package/src/cvr/CapturedResultReceiver.tsx +12 -19
  51. package/src/cvr/NativeDynamsoftCaptureVisionRouterModule.tsx +2 -2
  52. package/src/cvr/SimplifiedCaptureVisionSettings.tsx +4 -4
  53. package/src/dbr/DecodedBarcodesResult.tsx +3 -17
  54. package/src/dce/DynamsoftCameraViewNativeComponent.ts +2 -2
  55. package/src/dcp/ParsedResult.tsx +3 -14
  56. package/src/ddn/DeskewedImageResultItem.tsx +40 -0
  57. package/src/ddn/DetectedQuadResultItem.tsx +3 -1
  58. package/src/ddn/EnhancedImageResultItem.tsx +20 -0
  59. package/src/ddn/ProcessedDocumentResult.tsx +27 -0
  60. package/src/ddn/SimplifiedDocumentNormalizerSettings.tsx +18 -3
  61. package/src/ddn/index.tsx +3 -3
  62. package/src/dlr/RecognizedTextLinesResult.tsx +2 -16
  63. package/src/index.tsx +0 -1
  64. package/src/utility/ImageManager.tsx +66 -45
  65. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/BarcodeScannerModuleImpl.kt +0 -80
  66. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/MRZScannerModuleImpl.kt +0 -77
  67. package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/ScannerInterface.kt +0 -47
  68. package/android/src/main/jniLibs/arm64-v8a/librn_dys.so +0 -0
  69. package/android/src/main/jniLibs/armeabi-v7a/librn_dys.so +0 -0
  70. package/android/src/main/jniLibs/x86/librn_dys.so +0 -0
  71. package/android/src/main/jniLibs/x86_64/librn_dys.so +0 -0
  72. package/android/src/newarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -22
  73. package/android/src/newarch/com/dynamsoft/reactnativelib/CVRModule.kt +0 -91
  74. package/android/src/newarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -52
  75. package/android/src/newarch/com/dynamsoft/reactnativelib/DCEModule.kt +0 -91
  76. package/android/src/newarch/com/dynamsoft/reactnativelib/ISAModule.kt +0 -60
  77. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -16
  78. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -24
  79. package/android/src/newarch/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -12
  80. package/android/src/newarch/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -14
  81. package/android/src/newarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -22
  82. package/android/src/newarch/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -58
  83. package/android/src/newarch/com/dynamsoft/reactnativelib/VersionsModule.kt +0 -41
  84. package/android/src/oldarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -24
  85. package/android/src/oldarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -24
  86. package/ios/RNDynamsoftBarcodeScanner.h +0 -14
  87. package/ios/RNDynamsoftBarcodeScanner.m +0 -169
  88. package/ios/RNDynamsoftMRZScanner.h +0 -14
  89. package/ios/RNDynamsoftMRZScanner.m +0 -140
  90. package/src/ddn/DetectedQuadsResult.tsx +0 -31
  91. package/src/ddn/NormalizedImageResultItem.tsx +0 -32
  92. package/src/ddn/NormalizedImagesResult.tsx +0 -27
  93. package/src/rtu/BarcodeScanConfig.tsx +0 -104
  94. package/src/rtu/BarcodeScanResult.tsx +0 -31
  95. package/src/rtu/BarcodeScanner.tsx +0 -112
  96. package/src/rtu/EnumResultState.tsx +0 -21
  97. package/src/rtu/MRZScanConfig.tsx +0 -67
  98. package/src/rtu/MRZScanResult.tsx +0 -84
  99. package/src/rtu/MRZScanner.tsx +0 -90
  100. package/src/rtu/NativeDynamsoftBarcodeScannerModule.tsx +0 -6
  101. package/src/rtu/NativeDynamsoftMRZScannerModule.tsx +0 -6
  102. package/src/rtu/index.tsx +0 -7
  103. /package/android/src/main/{withNamespace/AndroidManifest.xml → AndroidManifest.xml} +0 -0
  104. /package/android/src/main/{withoutNamespace/AndroidManifest.xml → AndroidManifest_noPackage.xml} +0 -0
  105. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -0
  106. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/DCEModule.kt +0 -0
  107. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ISAModule.kt +0 -0
  108. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -0
  109. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -0
  110. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -0
  111. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -0
  112. /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -0
@@ -1,60 +0,0 @@
1
- package com.dynamsoft.reactnativelib
2
-
3
- import com.dynamsoft.reactnativelib.core.ImageSourceAdapterModuleImpl
4
- import com.facebook.react.bridge.Promise
5
- import com.facebook.react.bridge.ReactApplicationContext
6
- import com.facebook.react.bridge.ReactContextBaseJavaModule
7
-
8
- class ISAModule(reactApplicationContext: ReactApplicationContext) : NativeDynamsoftImageSourceAdapterModuleSpec(reactApplicationContext) {
9
- val impl = ImageSourceAdapterModuleImpl(reactApplicationContext)
10
-
11
- override fun getName(): String = impl.getName()
12
- override fun install(): Boolean {
13
- return impl.install()
14
- }
15
-
16
- override fun createDefaultNativeISA(): String {
17
- return impl.createDefaultNativeISA()
18
- }
19
-
20
- override fun destroy(isaId: String) {
21
- impl.destroy(isaId)
22
- }
23
-
24
- override fun getImageCount(isaId: String, promise: Promise) {
25
- impl.getImageCount(isaId, promise)
26
- }
27
-
28
- override fun isBufferEmpty(isaId: String, promise: Promise) {
29
- impl.isBufferEmpty(isaId, promise)
30
- }
31
-
32
- override fun clearBuffer(isaId: String, promise: Promise) {
33
- impl.clearBuffer(isaId)
34
- }
35
-
36
- override fun getColourChannelUsageType(isaId: String, promise: Promise) {
37
- impl.getColourChannelUsageType(isaId, promise)
38
- }
39
-
40
- override fun setColourChannelUsageType(isaId: String, type: Double, promise: Promise) {
41
- impl.setColourChannelUsageType(isaId, type.toInt())
42
- }
43
-
44
- override fun getMaximumImageCount(isaId: String, promise: Promise) {
45
- impl.getMaximumImageCount(isaId, promise)
46
- }
47
-
48
- override fun setMaximumImageCount(isaId: String, maxCount: Double, promise: Promise) {
49
- impl.setMaximumImageCount(isaId, maxCount.toInt())
50
- }
51
-
52
- override fun startFetching(isaId: String) {
53
- impl.startFetching(isaId)
54
- }
55
-
56
- override fun stopFetching(isaId: String) {
57
- impl.stopFetching(isaId)
58
- }
59
-
60
- }
@@ -1,16 +0,0 @@
1
- package com.dynamsoft.reactnativelib
2
-
3
- import com.dynamsoft.dce.ImageEditorView
4
- import com.facebook.react.module.annotations.ReactModule
5
- import com.facebook.react.uimanager.SimpleViewManager
6
- import com.facebook.react.uimanager.ThemedReactContext
7
- import com.dynamsoft.reactnative.dce.ImageEditorViewManagerImpl
8
- import com.facebook.react.viewmanagers.DynamsoftImageEditorViewManagerInterface
9
-
10
- class ImageEditorViewManager :SimpleViewManager<ImageEditorView>(), DynamsoftImageEditorViewManagerInterface<ImageEditorView> {
11
- private val impl = ImageEditorViewManagerImpl()
12
- override fun getName() = impl.getName()
13
- override fun createViewInstance(context: ThemedReactContext): ImageEditorView {
14
- return impl.createViewInstance(context)
15
- }
16
- }
@@ -1,24 +0,0 @@
1
- package com.dynamsoft.reactnativelib
2
-
3
- import com.dynamsoft.reactnativelib.dce.ImageEditorViewModuleImpl
4
- import com.facebook.react.bridge.Arguments
5
- import com.facebook.react.bridge.Promise
6
- import com.facebook.react.bridge.ReactApplicationContext
7
- import com.facebook.react.bridge.ReadableArray
8
-
9
- class ImageEditorViewModule(reactContext: ReactApplicationContext) : NativeDynamsoftImageEditorViewModuleSpec(reactContext) {
10
- val impl = ImageEditorViewModuleImpl(reactContext)
11
-
12
- override fun install(): Boolean {
13
- return impl.install()
14
- }
15
-
16
- override fun setQuads(viewTag: Double, quads: ReadableArray?, layerId: Double, promise: Promise) {
17
- impl.setQuads(viewTag.toInt(), quads?: Arguments.createArray(), layerId.toInt(), promise)
18
- }
19
-
20
-
21
- override fun getSelectedQuad(viewTag: Double, promise: Promise) {
22
- impl.getSelectedQuad(viewTag.toInt(), promise)
23
- }
24
- }
@@ -1,12 +0,0 @@
1
- package com.dynamsoft.reactnativelib
2
-
3
- import com.dynamsoft.reactnativelib.utility.ImageManagerModuleImpl
4
- import com.facebook.react.bridge.ReactApplicationContext
5
-
6
- class ImageManagerModule(reactContext: ReactApplicationContext) : NativeDynamsoftImageManagerModuleSpec(reactContext) {
7
- val impl = ImageManagerModuleImpl(reactContext)
8
-
9
- override fun install(): Boolean {
10
- return impl.install()
11
- }
12
- }
@@ -1,14 +0,0 @@
1
- package com.dynamsoft.reactnativelib
2
-
3
- import com.dynamsoft.reactnativelib.license.LicenseModuleImpl
4
- import com.facebook.react.bridge.Promise
5
- import com.facebook.react.bridge.ReactApplicationContext
6
-
7
- class LicenseModule(reactApplicationContext: ReactApplicationContext) : NativeDynamsoftLicenseModuleSpec(reactApplicationContext) {
8
- val impl = LicenseModuleImpl(reactApplicationContext)
9
-
10
- override fun getName(): String = impl.getName()
11
- override fun initLicense(license: String, promise: Promise) {
12
- impl.initLicense(license, promise)
13
- }
14
- }
@@ -1,22 +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) : NativeDynamsoftMRZScannerModuleSpec(reactApplicationContext) {
11
- override fun getName() = MRZScannerModuleImpl.NAME
12
-
13
- val impl by lazy { MRZScannerModuleImpl(reactApplicationContext) }
14
-
15
- override fun startMRZScanner(config: ReadableMap, promise: Promise) {
16
- impl.startMRZScanner(config, promise)
17
- }
18
-
19
- override fun closeMRZScanner(promise: Promise) {
20
- impl.closeMRZScanner(promise)
21
- }
22
- }
@@ -1,58 +0,0 @@
1
- package com.dynamsoft.reactnativelib
2
-
3
- import com.dynamsoft.reactnativelib.utility.MultiCrossFilterModuleImpl
4
- import com.facebook.react.bridge.Promise
5
- import com.facebook.react.bridge.ReactApplicationContext
6
- import com.facebook.react.bridge.ReactContextBaseJavaModule
7
-
8
- class MultiCrossFilterModule(reactApplicationContext: ReactApplicationContext) :
9
- NativeDynamsoftMultiCrossFilterModuleSpec(reactApplicationContext) {
10
- private val impl = MultiCrossFilterModuleImpl(reactApplicationContext)
11
- override fun getName(): String = impl.getName()
12
- override fun createInstance(): String = impl.createInstance()
13
-
14
- override fun destroy(filterId: String) {
15
- impl.destroy(filterId)
16
- }
17
-
18
- override fun enableResultCrossVerification(filterId: String, resultItemTypes: Double, enable: Boolean) {
19
- impl.enableResultCrossVerification(filterId, resultItemTypes.toInt(), enable)
20
- }
21
-
22
- override fun isResultCrossVerificationEnabled(filterId: String, type: Double, promise: Promise) {
23
- impl.isResultDeduplicationEnabled(filterId, type.toInt(), promise)
24
- }
25
-
26
- override fun enableResultDeduplication(filterId: String, resultItemTypes: Double, enable: Boolean) {
27
- impl.enableResultDeduplication(filterId, resultItemTypes.toInt(), enable)
28
- }
29
-
30
- override fun isResultDeduplicationEnabled(filterId: String, type: Double, promise: Promise) {
31
- impl.isResultDeduplicationEnabled(filterId, type.toInt(), promise)
32
- }
33
-
34
- override fun setDuplicateForgetTime(filterId: String, resultItemTypes: Double, time: Double) {
35
- impl.setDuplicateForgetTime(filterId, resultItemTypes.toInt(), time.toInt())
36
- }
37
-
38
- override fun getDuplicateForgetTime(filterId: String, type: Double, promise: Promise) {
39
- impl.getDuplicateForgetTime(filterId, type.toInt(), promise)
40
- }
41
-
42
- override fun enableLatestOverlapping(filterId: String, resultItemTypes: Double, enable: Boolean) {
43
- impl.enableLatestOverlapping(filterId, resultItemTypes.toInt(), enable)
44
- }
45
-
46
- override fun isLatestOverlappingEnabled(filterId: String, type: Double, promise: Promise) {
47
- impl.isLatestOverlappingEnabled(filterId, type.toInt(), promise)
48
- }
49
-
50
- override fun setMaxOverlappingFrames(filterId: String, resultItemTypes: Double, maxFrameToCheck: Double) {
51
- impl.setMaxOverlappingFrames(filterId, resultItemTypes.toInt(), maxFrameToCheck.toInt())
52
- }
53
-
54
- override fun getMaxOverlappingFrames(filterId: String, type: Double, promise: Promise) {
55
- impl.getMaxOverlappingFrames(filterId, type.toInt(), promise)
56
- }
57
-
58
- }
@@ -1,41 +0,0 @@
1
- package com.dynamsoft.reactnativelib
2
-
3
- import com.dynamsoft.core.basic_structures.CoreModule
4
- import com.dynamsoft.cvr.CaptureVisionRouterModule
5
- import com.dynamsoft.dbr.BarcodeReaderModule
6
- import com.dynamsoft.dce.CameraEnhancerModule
7
- import com.dynamsoft.dcp.CodeParserModule
8
- import com.dynamsoft.dcp.dedicator.CodePaserDedicatorModule
9
- import com.dynamsoft.ddn.DocumentNormalizerModule
10
- import com.dynamsoft.dip.ImageProcessingModule
11
- import com.dynamsoft.dlr.LabelRecognizerModule
12
- import com.dynamsoft.dnn.NeuralNetworkModule
13
- import com.dynamsoft.license.LicenseModule
14
- import com.dynamsoft.utility.UtilityModule
15
- import com.facebook.react.bridge.ReactApplicationContext
16
-
17
- class VersionsModule(reactContext: ReactApplicationContext) : NativeDynamsoftVersionsModuleSpec(reactContext) {
18
- companion object {
19
- const val NAME = "DynamsoftVersionsModule"
20
- }
21
-
22
- override fun getName(): String = NAME
23
-
24
- override fun getTypedExportedConstants(): MutableMap<String, Any> = hashMapOf(
25
- "versions" to hashMapOf<String, String>(
26
- "core" to CoreModule.getVersion(),
27
- "cvr" to CaptureVisionRouterModule.getVersion(),
28
- "license" to LicenseModule.getVersion(),
29
- "dce" to CameraEnhancerModule.getVersion(),
30
- "dbr" to BarcodeReaderModule.getVersion(),
31
- "dlr" to LabelRecognizerModule.getVersion(),
32
- "ddn" to DocumentNormalizerModule.getVersion(),
33
- "dnn" to NeuralNetworkModule.getVersion(),
34
- "utility" to UtilityModule.getVersion(),
35
- "dcp" to CodeParserModule.getVersion(),
36
- "dcpd" to CodePaserDedicatorModule.getVersion(),
37
- "dip" to ImageProcessingModule.getVersion()
38
- )
39
- )
40
-
41
- }
@@ -1,24 +0,0 @@
1
- package com.dynamsoft.reactnativelib
2
-
3
- import com.dynamsoft.reactnativelib.rtu.BarcodeScannerModuleImpl
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 BarcodeScannerModule(reactApplicationContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactApplicationContext) {
11
- override fun getName() = BarcodeScannerModuleImpl.NAME
12
-
13
- val impl by lazy { BarcodeScannerModuleImpl(reactApplicationContext) }
14
-
15
- @ReactMethod
16
- fun startBarcodeScanner(config: ReadableMap, promise: Promise) {
17
- impl.startBarcodeScanner(config, promise)
18
- }
19
-
20
- @ReactMethod
21
- fun closeBarcodeScanner(promise: Promise) {
22
- impl.closeBarcodeScanner(promise)
23
- }
24
- }
@@ -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
- }