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
package/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
1
  License Notice
2
2
 
3
- The source code of the Dynamsoft Capture Vision (DCV) React Native Edition published here is released under the Apache 2.0 license: http://www.apache.org/licenses/LICENSE-2.0. Dynamsoft Barcode Reader (DBR) and Dynamsoft Camera Enhancer (DCE) SDK upon which Dynamsoft Capture Vision (DCV) depends are provided under a commercial license from https://www.dynamsoft.com/company/license-agreement/. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4
-
3
+ The source code of the Dynamsoft Capture Vision (DCV) React Native Edition published here is released under the Apache 2.0 license: http://www.apache.org/licenses/LICENSE-2.0. Dynamsoft Barcode Reader (DBR), Dynamsoft Label Recognizer (DLR), Dynamsoft Document Normalizer (DDN), Dynamsoft Code Parser (DCP) and Dynamsoft Camera Enhancer (DCE) SDK upon which Dynamsoft Capture Vision (DCV) React Native Edition depends are provided under a commercial license from https://www.dynamsoft.com/company/license-agreement/. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4
+
5
5
  Copyright © 2003–2025 Dynamsoft. All Rights Reserved.
package/README.md CHANGED
@@ -32,7 +32,7 @@ DCV enables you to develop highly customizable applications for barcode reading,
32
32
 
33
33
  ### iOS
34
34
 
35
- - Supported OS: iOS 11+ (iOS 13+ recommended).
35
+ - Supported OS: iOS 13+.
36
36
  - Supported ABI: arm64 and x86_64.
37
37
  - Development Environment: Xcode 13+ (Xcode 14.1+ recommended).
38
38
 
@@ -41,20 +41,18 @@ DCV enables you to develop highly customizable applications for barcode reading,
41
41
  - Node: 18 or higher
42
42
 
43
43
  ## User Guide
44
- - [Foundation Barcode Reader Integration Guide](https://github.com/Dynamsoft/capture-vision-react-native-samples/blob/main/foundation-barcode-reader-guide.md)
45
- - [Ready-to-use Barcode Scanner Integration Guide](https://github.com/Dynamsoft/capture-vision-react-native-samples/blob/main/ready-to-use-barcode-scanner-guide.md)
46
- - [Document Scanner Integration Guide](https://github.com/Dynamsoft/capture-vision-react-native-samples/blob/main/document-scanner-guide.md)
47
- - [MRZ Scanner Integration Guide](https://github.com/Dynamsoft/capture-vision-react-native-samples/blob/main/mrz-scanner-guide.md)
48
- - [Divers' License Scanner Integration Guide](https://github.com/Dynamsoft/capture-vision-react-native-samples/blob/main/drivers-license-scanner-guide.md)
44
+
45
+ - [MRZ Scanner Integration Guide](https://github.com/Dynamsoft/capture-vision-react-native-samples/blob/main/guide-scan-mrz.md)
46
+ - [Document Scanner Integration Guide](https://github.com/Dynamsoft/capture-vision-react-native-samples/blob/main/guide-scan-document.md)
47
+ - [VIN Scanner Integration Guide](https://github.com/Dynamsoft/capture-vision-react-native-samples/blob/main/guide-scan-vin.md)
49
48
 
50
49
  ## Samples
51
50
 
52
51
  You can view all the DCV React Native samples via the following links:
53
52
 
54
- - [ScanBarcodes](https://github.com/Dynamsoft/capture-vision-react-native-samples/tree/main/ScanBarcodes)
55
- - [DetectAndDeskewDocument](https://github.com/Dynamsoft/capture-vision-react-native-samples/tree/main/DetectAndDeskewDocument)
56
53
  - [ScanMRZ](https://github.com/Dynamsoft/capture-vision-react-native-samples/tree/main/ScanMRZ)
57
- - [ReadDriverLicense](https://github.com/Dynamsoft/capture-vision-react-native-samples/tree/main/ReadDriverLicense)
54
+ - [ScanDocument](https://github.com/Dynamsoft/capture-vision-react-native-samples/tree/main/ScanDocument)
55
+ - [ScanVIN](https://github.com/Dynamsoft/capture-vision-react-native-samples/tree/main/ScanVIN)
58
56
 
59
57
  ## License
60
58
 
@@ -8,10 +8,7 @@ def safeExtGet(prop, fallback) {
8
8
 
9
9
  apply plugin: 'com.android.library'
10
10
  apply plugin: "kotlin-android"
11
- def isNewArchitectureEnabled = rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
12
- if (isNewArchitectureEnabled) {
13
- apply plugin: "com.facebook.react"
14
- }
11
+
15
12
  buildscript {
16
13
  def kotlinVersion = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["kotlinVersion"]
17
14
  repositories {
@@ -24,32 +21,20 @@ buildscript {
24
21
  }
25
22
  }
26
23
 
27
- def resolveBuildType() {
28
- Gradle gradle = getGradle()
29
- String tskReqStr = gradle.getStartParameter().getTaskRequests()['args'].toString()
30
-
31
- return tskReqStr.contains('Release') ? 'release' : 'debug'
32
- }
33
-
34
- def supportsNamespace() {
24
+ static def supportsNamespace() {
35
25
  def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
36
26
  def major = parsed[0].toInteger()
37
27
  def minor = parsed[1].toInteger()
38
-
39
- // Namespace support was added in 7.3.0
40
28
  return (major == 7 && minor >= 3) || major >= 8
41
29
  }
42
30
 
43
31
  android {
44
32
  if (supportsNamespace()) {
45
33
  namespace "com.dynamsoft.reactnativelib"
46
- }
47
- sourceSets {
48
- main {
49
- manifest.srcFile supportsNamespace()?
50
- "src/main/withoutNamespace/AndroidManifest.xml":
51
- "src/main/withNamespace/AndroidManifest.xml"
52
- java.srcDirs += isNewArchitectureEnabled? ["src/newarch"] : ["src/oldarch"]
34
+ sourceSets {
35
+ main {
36
+ manifest.srcFile "src/main/AndroidManifest_noPackage.xml"
37
+ }
53
38
  }
54
39
  }
55
40
 
@@ -59,17 +44,27 @@ android {
59
44
  targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
60
45
  versionCode 1
61
46
  versionName "1.0"
62
- // externalNativeBuild {
63
- // cmake {
64
- // cppFlags "-O2 -frtti -fexceptions -Wall -Wno-unused-variable -fstack-protector-all"
65
- // arguments "-DANDROID_STL=c++_shared"
66
- // }
67
- // }
68
- buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled.toString())
69
47
  }
70
48
  lintOptions {
71
49
  abortOnError false
72
50
  }
51
+
52
+ buildTypes {
53
+ release {
54
+ sourceSets {
55
+ main {
56
+ jniLibs.srcDirs = ["src/main/jniLibs/release"]
57
+ }
58
+ }
59
+ }
60
+ debug {
61
+ sourceSets {
62
+ main {
63
+ jniLibs.srcDirs = ["src/main/jniLibs/debug"]
64
+ }
65
+ }
66
+ }
67
+ }
73
68
  }
74
69
 
75
70
  repositories {
@@ -91,8 +86,13 @@ rootProject.allprojects {
91
86
  url "https://download2.dynamsoft.com/maven/aar"
92
87
  }
93
88
  }
89
+
90
+ configurations.all {
91
+ resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
92
+ }
94
93
  }
95
94
 
95
+
96
96
  dependencies {
97
97
  def kotlinVersion = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["kotlinVersion"]
98
98
 
@@ -105,18 +105,5 @@ dependencies {
105
105
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
106
106
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
107
107
 
108
- implementation("com.dynamsoft:dynamsoftcapturevisionbundle:2.6.1003") {
109
- exclude(group: "com.dynamsoft", module: "dynamsoftcameraenhancer")
110
- }
111
-
112
- implementation "com.dynamsoft:mrzscannerbundle:2.0.1@aar"
113
-
114
- implementation "com.dynamsoft:dynamsoftbarcodereaderbundle:10.4.3003-beta1@aar"
115
- implementation "com.dynamsoft:dynamsoftcameraenhancer:4.2.23-beta1@aar"
116
-
117
- def camerax_version = '1.4.0'
118
- api "androidx.camera:camera-core:$camerax_version"
119
- api "androidx.camera:camera-camera2:$camerax_version"
120
- api "androidx.camera:camera-lifecycle:$camerax_version"
121
- api "androidx.camera:camera-view:$camerax_version"
108
+ implementation "com.dynamsoft:capturevisionbundle:3.0.3100"
122
109
  }
@@ -81,13 +81,13 @@ class CVRModule(reactApplicationContext: ReactApplicationContext) : ReactContext
81
81
  }
82
82
 
83
83
  @ReactMethod
84
- fun outputSettings(templateName: String, promise: Promise) {
85
- impl.outputSettings(templateName, promise)
84
+ fun outputSettings(templateName: String, includeDefaultValues: Boolean, promise: Promise) {
85
+ impl.outputSettings(templateName, includeDefaultValues, promise)
86
86
  }
87
87
 
88
88
  @ReactMethod
89
- fun outputSettingsToFile(file: String, templateName: String, promise: Promise) {
90
- impl.outputSettingsToFile(file, templateName, promise)
89
+ fun outputSettingsToFile(file: String, templateName: String, includeDefaultValues: Boolean, promise: Promise) {
90
+ impl.outputSettingsToFile(file, templateName, includeDefaultValues, promise)
91
91
  }
92
92
 
93
93
  @ReactMethod
@@ -1,23 +1,12 @@
1
1
  // ReactNativeDcvPackage.java
2
2
  package com.dynamsoft.reactnativelib
3
3
 
4
- import com.dynamsoft.reactnativelib.core.ImageSourceAdapterModuleImpl
5
- import com.dynamsoft.reactnativelib.cvr.CaptureVisionRouterModuleImpl
6
- import com.dynamsoft.reactnativelib.dce.CameraEnhancerModuleImpl
7
- import com.dynamsoft.reactnativelib.dce.ImageEditorViewModuleImpl
8
- import com.dynamsoft.reactnativelib.license.LicenseModuleImpl
9
- import com.dynamsoft.reactnativelib.rtu.BarcodeScannerModuleImpl
10
- import com.dynamsoft.reactnativelib.rtu.MRZScannerModuleImpl
11
- import com.dynamsoft.reactnativelib.utility.ImageManagerModuleImpl
12
- import com.dynamsoft.reactnativelib.utility.MultiCrossFilterModuleImpl
13
- import com.facebook.react.TurboReactPackage
4
+ import com.facebook.react.ReactPackage
14
5
  import com.facebook.react.bridge.NativeModule
15
6
  import com.facebook.react.bridge.ReactApplicationContext
16
- import com.facebook.react.module.model.ReactModuleInfo
17
- import com.facebook.react.module.model.ReactModuleInfoProvider
18
7
  import com.facebook.react.uimanager.ViewManager
19
8
 
20
- class ReactNativeDcvPackage : TurboReactPackage() {
9
+ class ReactNativeDcvPackage : ReactPackage {
21
10
  companion object {
22
11
  init {
23
12
  System.loadLibrary("rn_dys")
@@ -28,77 +17,16 @@ class ReactNativeDcvPackage : TurboReactPackage() {
28
17
  return listOf(CameraViewManager(), ImageEditorViewManager())
29
18
  }
30
19
 
31
- override fun getModule(name: String, context: ReactApplicationContext): NativeModule? {
32
- return when (name) {
33
- CaptureVisionRouterModuleImpl.NAME -> CVRModule(context)
34
- CameraEnhancerModuleImpl.NAME -> DCEModule(context)
35
- ImageSourceAdapterModuleImpl.NAME -> ISAModule(context)
36
- LicenseModuleImpl.NAME -> LicenseModule(context)
37
- MultiCrossFilterModuleImpl.NAME -> MultiCrossFilterModule(context)
38
- VersionsModule.NAME -> VersionsModule(context)
39
- ImageEditorViewModuleImpl.NAME -> ImageEditorViewModule(context)
40
- ImageManagerModuleImpl.NAME -> ImageManagerModule(context)
41
- BarcodeScannerModuleImpl.NAME -> BarcodeScannerModule(context)
42
- MRZScannerModuleImpl.NAME -> MRZScannerModule(context)
43
- else -> null
44
- }
45
- }
46
-
47
- override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
48
- val isEnableNewArch = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
49
- return ReactModuleInfoProvider {
50
- mapOf(
51
- CaptureVisionRouterModuleImpl.NAME to ReactModuleInfo(
52
- CaptureVisionRouterModuleImpl.NAME,
53
- CaptureVisionRouterModuleImpl.NAME,
54
- false, false, true, false, isEnableNewArch
55
- ),
56
- CameraEnhancerModuleImpl.NAME to ReactModuleInfo(
57
- CameraEnhancerModuleImpl.NAME,
58
- CameraEnhancerModuleImpl.NAME,
59
- false, false, true, false, isEnableNewArch
60
- ),
61
- ImageSourceAdapterModuleImpl.NAME to ReactModuleInfo(
62
- ImageSourceAdapterModuleImpl.NAME,
63
- ImageSourceAdapterModuleImpl.NAME,
64
- false, false, true, false, isEnableNewArch
65
- ),
66
- LicenseModuleImpl.NAME to ReactModuleInfo(
67
- LicenseModuleImpl.NAME,
68
- LicenseModuleImpl.NAME,
69
- false, false, true, false, isEnableNewArch
70
- ),
71
- MultiCrossFilterModuleImpl.NAME to ReactModuleInfo(
72
- MultiCrossFilterModuleImpl.NAME,
73
- MultiCrossFilterModuleImpl.NAME,
74
- false, false, true, false, isEnableNewArch
75
- ),
76
- VersionsModule.NAME to ReactModuleInfo(
77
- VersionsModule.NAME,
78
- VersionsModule.NAME,
79
- false, false, true, false, isEnableNewArch
80
- ),
81
- ImageEditorViewModuleImpl.NAME to ReactModuleInfo(
82
- ImageEditorViewModuleImpl.NAME,
83
- ImageEditorViewModuleImpl.NAME,
84
- false, false, true, false, isEnableNewArch
85
- ),
86
- ImageManagerModuleImpl.NAME to ReactModuleInfo(
87
- ImageManagerModuleImpl.NAME,
88
- ImageManagerModuleImpl.NAME,
89
- false, false, true, false, isEnableNewArch
90
- ),
91
- BarcodeScannerModuleImpl.NAME to ReactModuleInfo(
92
- BarcodeScannerModuleImpl.NAME,
93
- BarcodeScannerModuleImpl.NAME,
94
- false, false, true, false, isEnableNewArch
95
- ),
96
- MRZScannerModuleImpl.NAME to ReactModuleInfo(
97
- MRZScannerModuleImpl.NAME,
98
- MRZScannerModuleImpl.NAME,
99
- false, false, true, false, isEnableNewArch
100
- )
101
- )
102
- }
20
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
21
+ return mutableListOf(
22
+ CVRModule(reactContext),
23
+ DCEModule(reactContext),
24
+ ISAModule(reactContext),
25
+ LicenseModule(reactContext),
26
+ MultiCrossFilterModule(reactContext),
27
+ VersionsModule(reactContext),
28
+ ImageEditorViewModule(reactContext),
29
+ ImageManagerModule(reactContext),
30
+ )
103
31
  }
104
32
  }
@@ -5,7 +5,7 @@ import com.dynamsoft.cvr.CaptureVisionRouterModule
5
5
  import com.dynamsoft.dbr.BarcodeReaderModule
6
6
  import com.dynamsoft.dce.CameraEnhancerModule
7
7
  import com.dynamsoft.dcp.CodeParserModule
8
- import com.dynamsoft.dcp.dedicator.CodePaserDedicatorModule
8
+ import com.dynamsoft.dcp.dedicator.CodeParserDedicatorModule
9
9
  import com.dynamsoft.ddn.DocumentNormalizerModule
10
10
  import com.dynamsoft.dip.ImageProcessingModule
11
11
  import com.dynamsoft.dlr.LabelRecognizerModule
@@ -34,7 +34,7 @@ class VersionsModule(reactContext: ReactApplicationContext) : ReactContextBaseJa
34
34
  "dnn" to NeuralNetworkModule.getVersion(),
35
35
  "utility" to UtilityModule.getVersion(),
36
36
  "dcp" to CodeParserModule.getVersion(),
37
- "dcpd" to CodePaserDedicatorModule.getVersion(),
37
+ "dcpd" to CodeParserDedicatorModule.getVersion(),
38
38
  "dip" to ImageProcessingModule.getVersion()
39
39
  )
40
40
  )
@@ -7,9 +7,9 @@ import com.dynamsoft.core.basic_structures.ImageData
7
7
  import com.dynamsoft.cvr.*
8
8
  import com.dynamsoft.dbr.DecodedBarcodesResult
9
9
  import com.dynamsoft.dcp.ParsedResult
10
- import com.dynamsoft.ddn.DetectedQuadsResult
11
- import com.dynamsoft.ddn.NormalizedImageResultItem
12
- import com.dynamsoft.ddn.NormalizedImagesResult
10
+ import com.dynamsoft.ddn.DeskewedImageResultItem
11
+ import com.dynamsoft.ddn.EnhancedImageResultItem
12
+ import com.dynamsoft.ddn.ProcessedDocumentResult
13
13
  import com.dynamsoft.dlr.RecognizedTextLinesResult
14
14
  import com.dynamsoft.reactnative.basicutils.toWritableMap
15
15
  import com.dynamsoft.reactnativelib.core.ImageSourceAdapterModuleImpl
@@ -21,23 +21,24 @@ import kotlinx.coroutines.delay
21
21
  import kotlinx.coroutines.runBlocking
22
22
 
23
23
  private const val onCapturedResultReceived_Event = "onCapturedResultReceived"
24
- private const val onDetectedQuadsReceived_Event = "onDetectedQuadsReceived"
25
24
  private const val onDecodedBarcodesReceived_Event = "onDecodedBarcodesReceived"
26
- private const val onNormalizedImagesReceived_Event = "onNormalizedImagesReceived"
25
+ private const val onProcessedDocumentResultReceived_Event = "onProcessedDocumentResultReceived"
27
26
  private const val onRecognizedTextLinesReceived_Event = "onRecognizedTextLinesReceived"
28
27
  private const val onParsedResultsReceived_Event = "onParsedResultsReceived"
29
28
  private const val TAG = "CvrModule"
30
29
 
31
30
 
32
31
  val filterMap = hashMapOf<String, CapturedResultFilter>()
32
+
33
33
  class CaptureVisionRouterModuleImpl(private val reactContext: ReactApplicationContext) {
34
34
  companion object {
35
35
  const val NAME = "DynamsoftCaptureVisionRouterModule"
36
36
  }
37
37
 
38
38
  private var ifStopCapturing = false
39
- private var currentNormalizedImages: Array<ImageData>? = null
40
- private val cvr by lazy { CaptureVisionRouter(reactContext) }
39
+ private var currentDeskewedImages: Array<ImageData>? = null
40
+ private var currentEnhancedImages: Array<ImageData>? = null
41
+ private val cvr = CaptureVisionRouter()
41
42
  private val emitter by lazy { reactContext.getJSModule(RCTDeviceEventEmitter::class.java) }
42
43
 
43
44
  private var continueCRR = false
@@ -46,9 +47,12 @@ class CaptureVisionRouterModuleImpl(private val reactContext: ReactApplicationCo
46
47
  mapOf(
47
48
  onCapturedResultReceived_Event to object : CapturedResultReceiver {
48
49
  override fun onCapturedResultReceived(result: CapturedResult) {
49
- currentNormalizedImages =
50
- result.items.filter { it.type == EnumCapturedResultItemType.CRIT_NORMALIZED_IMAGE }
51
- .map { (it as NormalizedImageResultItem).imageData }.toTypedArray()
50
+ currentDeskewedImages =
51
+ result.items.filter { it.type == EnumCapturedResultItemType.CRIT_DESKEWED_IMAGE }
52
+ .map { (it as DeskewedImageResultItem).imageData }.toTypedArray()
53
+ currentEnhancedImages =
54
+ result.items.filter { it.type == EnumCapturedResultItemType.CRIT_ENHANCED_IMAGE }
55
+ .map { (it as EnhancedImageResultItem).imageData }.toTypedArray()
52
56
  emitResultAndWaitForResponse(onCapturedResultReceived_Event, result.toWritableMap())
53
57
  }
54
58
  },
@@ -57,15 +61,9 @@ class CaptureVisionRouterModuleImpl(private val reactContext: ReactApplicationCo
57
61
  emitResultAndWaitForResponse(onDecodedBarcodesReceived_Event, result.toWritableMap())
58
62
  }
59
63
  },
60
- onDetectedQuadsReceived_Event to object : CapturedResultReceiver {
61
- override fun onDetectedQuadsReceived(result: DetectedQuadsResult) {
62
- emitResultAndWaitForResponse(onDetectedQuadsReceived_Event, result.toWritableMap())
63
- }
64
- },
65
- onNormalizedImagesReceived_Event to object : CapturedResultReceiver {
66
- override fun onNormalizedImagesReceived(result: NormalizedImagesResult) {
67
- currentNormalizedImages = result.items.map { it.imageData }.toTypedArray()
68
- emitResultAndWaitForResponse(onNormalizedImagesReceived_Event, result.toWritableMap())
64
+ onProcessedDocumentResultReceived_Event to object : CapturedResultReceiver {
65
+ override fun onProcessedDocumentResultReceived(result: ProcessedDocumentResult) {
66
+ emitResultAndWaitForResponse(onProcessedDocumentResultReceived_Event, result.toWritableMap())
69
67
  }
70
68
  },
71
69
  onRecognizedTextLinesReceived_Event to object : CapturedResultReceiver {
@@ -136,7 +134,7 @@ class CaptureVisionRouterModuleImpl(private val reactContext: ReactApplicationCo
136
134
  @ReactMethod
137
135
  fun startCapturing(template: String, promise: Promise) {
138
136
  ifStopCapturing = false
139
- cvr.startCapturing(template, object : CompletionListener{
137
+ cvr.startCapturing(template, object : CompletionListener {
140
138
  override fun onSuccess() {
141
139
  Log.i(TAG, "onSuccess: startCapturing($template)")
142
140
  promise.resolve(null)
@@ -214,9 +212,9 @@ class CaptureVisionRouterModuleImpl(private val reactContext: ReactApplicationCo
214
212
  }
215
213
 
216
214
  @ReactMethod
217
- fun outputSettingsToFile(template: String, path: String, promise: Promise) {
215
+ fun outputSettingsToFile(template: String, path: String, includeDefaultValues: Boolean, promise: Promise) {
218
216
  try {
219
- cvr.outputSettingsToFile(template, path)
217
+ cvr.outputSettingsToFile(template, path, includeDefaultValues)
220
218
  promise.resolve(null)
221
219
  } catch (e: CaptureVisionRouterException) {
222
220
  promise.reject(e.errorCode.toString(), e.message)
@@ -224,9 +222,9 @@ class CaptureVisionRouterModuleImpl(private val reactContext: ReactApplicationCo
224
222
  }
225
223
 
226
224
  @ReactMethod
227
- fun outputSettings(template: String, promise: Promise) {
225
+ fun outputSettings(template: String, includeDefaultValues: Boolean, promise: Promise) {
228
226
  try {
229
- promise.resolve(cvr.outputSettings(template))
227
+ promise.resolve(cvr.outputSettings(template, includeDefaultValues))
230
228
  } catch (e: CaptureVisionRouterException) {
231
229
  promise.reject(e.errorCode.toString(), e.message)
232
230
  }
@@ -258,7 +256,7 @@ class CaptureVisionRouterModuleImpl(private val reactContext: ReactApplicationCo
258
256
  //@Native
259
257
  private fun getOriginalImageCalledInJSI(imageHashId: String): ImageData {
260
258
  var originalImage = cvr.intermediateResultManager.getOriginalImage(imageHashId)
261
- if(originalImage == null) {
259
+ if (originalImage == null) {
262
260
  originalImage = ImageData()
263
261
  originalImage.bytes = ByteArray(0)
264
262
  }
@@ -160,12 +160,12 @@ class CameraEnhancerModuleImpl(private val reactContext: ReactApplicationContext
160
160
 
161
161
  @ReactMethod
162
162
  fun beep() {
163
- Feedback.beep(reactContext)
163
+ Feedback.beep()
164
164
  }
165
165
 
166
166
  @ReactMethod
167
167
  fun vibrate() {
168
- Feedback.vibrate(reactContext)
168
+ Feedback.vibrate()
169
169
  }
170
170
 
171
171
  private fun findAndSetCameraView(viewTag: Int, afterSetCameraView: () -> Unit = {}) {
@@ -18,7 +18,7 @@ class LicenseModuleImpl(private val reactContext: ReactApplicationContext) {
18
18
  fun initLicense(license: String?, promise: Promise) {
19
19
  @SuppressLint("RestrictedApi")
20
20
  InnerData.remark.edition = "android-react-native"
21
- LicenseManager.initLicense(license, reactContext) { isSuccessful, error ->
21
+ LicenseManager.initLicense(license) { isSuccessful, error ->
22
22
  if (isSuccessful) {
23
23
  promise.resolve(true)
24
24
  } else {
@@ -2,7 +2,10 @@ package com.dynamsoft.reactnativelib.utility
2
2
 
3
3
  import com.dynamsoft.core.basic_structures.ImageData
4
4
  import com.dynamsoft.core.basic_structures.Quadrilateral
5
- import com.dynamsoft.utility.ImageManager
5
+ import com.dynamsoft.utility.ImageDrawer
6
+ import com.dynamsoft.utility.ImageIO
7
+ import com.dynamsoft.utility.ImageProcessor
8
+ import com.dynamsoft.utility.UtilityException
6
9
  import com.facebook.react.bridge.ReactApplicationContext
7
10
 
8
11
  class ImageManagerModuleImpl(private val reactContext: ReactApplicationContext) {
@@ -10,6 +13,10 @@ class ImageManagerModuleImpl(private val reactContext: ReactApplicationContext)
10
13
  const val NAME = "DynamsoftImageManagerModule"
11
14
  }
12
15
 
16
+ private val imageIo by lazy { ImageIO() }
17
+ private val imageProcessor by lazy { ImageProcessor() }
18
+ private val imageDrawer by lazy { ImageDrawer() }
19
+
13
20
  fun getName() = NAME
14
21
 
15
22
  fun install(): Boolean {
@@ -20,14 +27,22 @@ class ImageManagerModuleImpl(private val reactContext: ReactApplicationContext)
20
27
  }
21
28
 
22
29
  fun saveToFileCalledInJsi(imageData: ImageData, filePath: String, overWrite: Boolean) {
23
- ImageManager().saveToFile(imageData, filePath, overWrite)
30
+ imageIo.saveToFile(imageData, filePath, overWrite)
24
31
  }
25
32
 
26
33
  fun drawOnImageCalledInJsi(imageData: ImageData, quads: Array<Quadrilateral>, color: Int, thickness: Int): ImageData {
27
- return ImageManager().drawOnImage(imageData, quads, color, thickness)
34
+ return imageDrawer.drawOnImage(imageData, quads, color, thickness)
35
+ }
36
+
37
+ fun cropImageCalledInJsi(imageData: ImageData, quad: Quadrilateral): ImageData? {
38
+ try {
39
+ return imageProcessor.cropImage(imageData, quad)
40
+ } catch (e: UtilityException) {
41
+ return null;
42
+ }
28
43
  }
29
44
 
30
45
 
31
46
  private external fun nativeInstall(jsiPtr: Long)
32
47
 
33
- }
48
+ }
@@ -1,8 +1,10 @@
1
1
  package com.dynamsoft.reactnative.basicutils
2
2
 
3
3
  import android.graphics.Point
4
+ import com.dynamsoft.core.basic_structures.CapturedResultBase
4
5
  import com.dynamsoft.core.basic_structures.CapturedResultItem
5
6
  import com.dynamsoft.core.basic_structures.Quadrilateral
7
+ import com.dynamsoft.reactnativelib.utils.toWritableArray
6
8
  import com.facebook.react.bridge.Arguments
7
9
  import com.facebook.react.bridge.ReadableMap
8
10
  import com.facebook.react.bridge.WritableArray
@@ -35,4 +37,16 @@ fun ReadableMap.toQuad(): Quadrilateral {
35
37
 
36
38
  fun CapturedResultItem.toSharedWritableMap() : WritableMap = Arguments.createMap().apply {
37
39
  putInt("type",type)
40
+ putString("taskName", taskName)
41
+ putString("targetROIDefName", targetROIDefName)
42
+ }
43
+
44
+ fun CapturedResultBase.toSharedWritableMap(): WritableMap = Arguments.createMap().apply {
45
+ putString("originalImageHashId", originalImageHashId)
46
+ putInt("errorCode", errorCode)
47
+ putString("errorMessage", errorMessage)
48
+ putArray(
49
+ "rotationTransformMatrix",
50
+ FloatArray(9).apply { rotationTransformMatrix.getValues(this) }.toWritableArray()
51
+ )
38
52
  }
@@ -8,8 +8,10 @@ import com.dynamsoft.cvr.CaptureVisionRouter
8
8
  import com.dynamsoft.cvr.CapturedResult
9
9
  import com.dynamsoft.cvr.SimplifiedCaptureVisionSettings
10
10
  import com.dynamsoft.dbr.BarcodeResultItem
11
+ import com.dynamsoft.dcp.ParsedResultItem
12
+ import com.dynamsoft.ddn.DeskewedImageResultItem
11
13
  import com.dynamsoft.ddn.DetectedQuadResultItem
12
- import com.dynamsoft.ddn.NormalizedImageResultItem
14
+ import com.dynamsoft.ddn.EnhancedImageResultItem
13
15
  import com.dynamsoft.dlr.TextLineResultItem
14
16
  import com.dynamsoft.reactnative.basicutils.toQuad
15
17
  import com.dynamsoft.reactnative.basicutils.toWritableArray
@@ -32,7 +34,7 @@ fun CaptureVisionRouter.startCapturingWithCallback(template: String, logTag: Str
32
34
  })
33
35
  }
34
36
 
35
- fun Array<out CapturedResultItem>.toWritableArray(): WritableArray = Arguments.createArray().apply {
37
+ private fun Array<out CapturedResultItem>.toWritableArray(): WritableArray = Arguments.createArray().apply {
36
38
  forEach {
37
39
  when (it.type) {
38
40
  EnumCapturedResultItemType.CRIT_BARCODE -> {
@@ -44,8 +46,14 @@ fun Array<out CapturedResultItem>.toWritableArray(): WritableArray = Arguments.c
44
46
  EnumCapturedResultItemType.CRIT_DETECTED_QUAD -> {
45
47
  pushMap((it as DetectedQuadResultItem).toWritableMap())
46
48
  }
47
- EnumCapturedResultItemType.CRIT_NORMALIZED_IMAGE -> {
48
- pushMap((it as NormalizedImageResultItem).toWritableMap())
49
+ EnumCapturedResultItemType.CRIT_DESKEWED_IMAGE -> {
50
+ pushMap((it as DeskewedImageResultItem).toWritableMap())
51
+ }
52
+ EnumCapturedResultItemType.CRIT_ENHANCED_IMAGE -> {
53
+ pushMap((it as EnhancedImageResultItem).toWritableMap())
54
+ }
55
+ EnumCapturedResultItemType.CRIT_PARSED_RESULT -> {
56
+ pushMap((it as ParsedResultItem).toWritableMap())
49
57
  }
50
58
  }
51
59
  }
@@ -60,7 +68,6 @@ fun CapturedResult.toWritableMap(): WritableMap = Arguments.createMap().apply {
60
68
  }
61
69
 
62
70
  fun SimplifiedCaptureVisionSettings.toWritableMap() = Arguments.createMap().apply {
63
- putInt("capturedResultItemTypes", capturedResultItemTypes)
64
71
  putMap("roi", roi.toWritableMap())
65
72
  putBoolean("roiMeasuredInPercentage", roiMeasuredInPercentage)
66
73
  putInt("maxParallelTasks", maxParallelTasks)
@@ -89,8 +96,6 @@ fun SimplifiedCaptureVisionSettings.toWritableMap() = Arguments.createMap().appl
89
96
  }
90
97
 
91
98
  fun SimplifiedCaptureVisionSettings.updateFromReadableMap(newSettings: ReadableMap) {
92
- capturedResultItemTypes =
93
- if (newSettings.hasKey("capturedResultItemTypes")) newSettings.getInt("capturedResultItemTypes") else capturedResultItemTypes
94
99
  roi = if (newSettings.hasKey("roi")) newSettings.getMap("roi")!!.toQuad() else roi
95
100
  roiMeasuredInPercentage =
96
101
  if (newSettings.hasKey("roiMeasuredInPercentage")) newSettings.getBoolean("roiMeasuredInPercentage") else roiMeasuredInPercentage
@@ -32,14 +32,8 @@ fun Array<out BarcodeResultItem>.toWritableArray(): WritableArray = Arguments.cr
32
32
  }
33
33
 
34
34
  fun DecodedBarcodesResult.toWritableMap(): WritableMap = Arguments.createMap().apply {
35
- putInt("errorCode", errorCode)
36
- putString("originalImageHashId", originalImageHashId)
37
- putString("errorMessage", errorMessage)
35
+ merge(this@toWritableMap.toSharedWritableMap())
38
36
  putArray("items", items.toWritableArray())
39
- putArray(
40
- "rotationTransformMatrix",
41
- FloatArray(9).apply { rotationTransformMatrix.getValues(this) }.toWritableArray()
42
- )
43
37
  }
44
38
 
45
39
  fun SimplifiedBarcodeReaderSettings.toWritableMap(): WritableMap = Arguments.createMap().apply {
@@ -73,14 +73,14 @@ class TorchButtonState(
73
73
  fun getTouchOnDrawable(context: Context): Drawable {
74
74
  return base64ToDrawable(touchOnBase64, context.resources!!) ?: AppCompatResources.getDrawable(
75
75
  context,
76
- com.dynamsoft.dce.R.drawable.flash_on
76
+ com.dynamsoft.R.drawable.flash_on
77
77
  )!!
78
78
  }
79
79
 
80
80
  fun getTouchOffDrawable(context: Context): Drawable {
81
81
  return base64ToDrawable(touchOffBase64, context.resources!!) ?: AppCompatResources.getDrawable(
82
82
  context,
83
- com.dynamsoft.dce.R.drawable.flash_off
83
+ com.dynamsoft.R.drawable.flash_off
84
84
  )!!
85
85
  }
86
86