react-native-rectangle-doc-scanner 6.0.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +17 -13
- package/android/src/main/kotlin/com/reactnativerectangledocscanner/DocumentScannerPackage.kt +12 -4
- package/package.json +1 -1
- /package/android/src/{main → camera2}/kotlin/com/reactnativerectangledocscanner/CameraController.kt +0 -0
- /package/android/src/{main → camera2}/kotlin/com/reactnativerectangledocscanner/CameraView.kt +0 -0
- /package/android/src/{main → camera2}/kotlin/com/reactnativerectangledocscanner/CameraViewManager.kt +0 -0
- /package/android/src/{main → camera2}/kotlin/com/reactnativerectangledocscanner/DocumentScannerView.kt +0 -0
- /package/android/src/{main → camera2}/kotlin/com/reactnativerectangledocscanner/DocumentScannerViewManager.kt +0 -0
- /package/android/src/{main → camera2}/kotlin/com/reactnativerectangledocscanner/ImageProxyExt.kt +0 -0
- /package/android/src/{main → common}/kotlin/com/reactnativerectangledocscanner/DocumentDetector.kt +0 -0
- /package/android/src/{main → common}/kotlin/com/reactnativerectangledocscanner/ImageProcessor.kt +0 -0
package/android/build.gradle
CHANGED
|
@@ -47,8 +47,11 @@ android {
|
|
|
47
47
|
sourceSets {
|
|
48
48
|
main {
|
|
49
49
|
java.srcDirs += 'src/main/kotlin'
|
|
50
|
+
java.srcDirs += 'src/common/kotlin'
|
|
50
51
|
if (hasVisionCamera) {
|
|
51
52
|
java.srcDirs += 'src/visioncamera/kotlin'
|
|
53
|
+
} else {
|
|
54
|
+
java.srcDirs += 'src/camera2/kotlin'
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
}
|
|
@@ -63,28 +66,29 @@ dependencies {
|
|
|
63
66
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
64
67
|
implementation "com.facebook.react:react-native:+"
|
|
65
68
|
|
|
66
|
-
//
|
|
67
|
-
def camerax_version = "1.3.0"
|
|
68
|
-
implementation "androidx.camera:camera-core:${camerax_version}"
|
|
69
|
-
implementation "androidx.camera:camera-camera2:${camerax_version}"
|
|
70
|
-
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
|
|
71
|
-
implementation "androidx.camera:camera-view:${camerax_version}"
|
|
72
|
-
|
|
73
|
-
// OpenCV for document detection
|
|
69
|
+
// OpenCV for document detection (common)
|
|
74
70
|
implementation 'org.opencv:opencv:4.9.0'
|
|
75
71
|
|
|
76
|
-
//
|
|
77
|
-
implementation 'com.google.mlkit:object-detection:17.0.1'
|
|
78
|
-
|
|
79
|
-
// Coroutines for async operations
|
|
72
|
+
// Coroutines for async operations (common)
|
|
80
73
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
|
|
81
74
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
|
|
82
75
|
|
|
83
|
-
// AndroidX
|
|
76
|
+
// AndroidX (common)
|
|
84
77
|
implementation 'androidx.core:core-ktx:1.10.1'
|
|
85
78
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
86
79
|
|
|
87
80
|
if (hasVisionCamera) {
|
|
81
|
+
// VisionCamera mode - only include VisionCamera dependency
|
|
88
82
|
implementation project(':react-native-vision-camera')
|
|
83
|
+
} else {
|
|
84
|
+
// Camera2 mode - include CameraX and ML Kit dependencies
|
|
85
|
+
def camerax_version = "1.3.0"
|
|
86
|
+
implementation "androidx.camera:camera-core:${camerax_version}"
|
|
87
|
+
implementation "androidx.camera:camera-camera2:${camerax_version}"
|
|
88
|
+
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
|
|
89
|
+
implementation "androidx.camera:camera-view:${camerax_version}"
|
|
90
|
+
|
|
91
|
+
// ML Kit object detection for live rectangle hints
|
|
92
|
+
implementation 'com.google.mlkit:object-detection:17.0.1'
|
|
89
93
|
}
|
|
90
94
|
}
|
package/android/src/main/kotlin/com/reactnativerectangledocscanner/DocumentScannerPackage.kt
CHANGED
|
@@ -19,10 +19,18 @@ class DocumentScannerPackage : ReactPackage {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
// Only register Camera2-based view managers if VisionCamera is not available
|
|
23
|
+
return try {
|
|
24
|
+
Class.forName(VISION_CAMERA_REGISTRY)
|
|
25
|
+
// VisionCamera is available, no need to register Camera2 view managers
|
|
26
|
+
emptyList()
|
|
27
|
+
} catch (e: ClassNotFoundException) {
|
|
28
|
+
// VisionCamera not available, register Camera2 view managers
|
|
29
|
+
listOf(
|
|
30
|
+
DocumentScannerViewManager(),
|
|
31
|
+
CameraViewManager()
|
|
32
|
+
)
|
|
33
|
+
}
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
private fun registerVisionCameraPlugin() {
|
package/package.json
CHANGED
/package/android/src/{main → camera2}/kotlin/com/reactnativerectangledocscanner/CameraController.kt
RENAMED
|
File without changes
|
/package/android/src/{main → camera2}/kotlin/com/reactnativerectangledocscanner/CameraView.kt
RENAMED
|
File without changes
|
/package/android/src/{main → camera2}/kotlin/com/reactnativerectangledocscanner/CameraViewManager.kt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/android/src/{main → camera2}/kotlin/com/reactnativerectangledocscanner/ImageProxyExt.kt
RENAMED
|
File without changes
|
/package/android/src/{main → common}/kotlin/com/reactnativerectangledocscanner/DocumentDetector.kt
RENAMED
|
File without changes
|
/package/android/src/{main → common}/kotlin/com/reactnativerectangledocscanner/ImageProcessor.kt
RENAMED
|
File without changes
|