dynamsoft-capture-vision-react-native 1.1.15 → 2.4.2000-alpha.1
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/README.md +17 -22
- package/android/.gitignore +4 -0
- package/android/CMakeLists.txt +14 -0
- package/android/README.md +14 -0
- package/android/build.gradle +95 -15
- package/android/gradle.properties +21 -0
- package/android/settings.gradle +6 -0
- package/android/src/main/cpp/MutableRawBuffer.cpp +24 -0
- package/android/src/main/cpp/MutableRawBuffer.h +24 -0
- package/android/src/main/cpp/android_log.h +14 -0
- package/android/src/main/cpp/core/ImageDataHostObject.cpp +95 -0
- package/android/src/main/cpp/core/ImageDataHostObject.h +34 -0
- package/android/src/main/cpp/core/JsiCore.cpp +284 -0
- package/android/src/main/cpp/core/JsiCore.h +51 -0
- package/android/src/main/cpp/cvr/JsiCvr.cpp +263 -0
- package/android/src/main/cpp/cvr/JsiCvr.h +51 -0
- package/android/src/main/cpp/dbr/JsiDbr.cpp +38 -0
- package/android/src/main/cpp/dbr/JsiDbr.h +26 -0
- package/android/src/main/cpp/dce/JsiDce.cpp +59 -0
- package/android/src/main/cpp/dce/JsiDce.h +17 -0
- package/android/src/main/cpp/dcp/JsiDcp.cpp +51 -0
- package/android/src/main/cpp/dcp/JsiDcp.h +31 -0
- package/android/src/main/cpp/ddn/JsiDdn.cpp +34 -0
- package/android/src/main/cpp/ddn/JsiDdn.h +27 -0
- package/android/src/main/cpp/dlr/JsiDlr.cpp +51 -0
- package/android/src/main/cpp/dlr/JsiDlr.h +26 -0
- package/android/src/main/cpp/utility/JsiUtility.cpp +151 -0
- package/android/src/main/cpp/utility/JsiUtility.h +15 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/DynamsoftBaseModule.kt +9 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/ReactNativeDcvPackage.kt +90 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/core/ImageSourceAdapterModuleImpl.kt +120 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/cvr/CaptureVisionRouterModuleImpl.kt +269 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +196 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraLifeCycleOwner.kt +9 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraViewManagerImpl.kt +65 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/ImageEditorViewManagerImpl.kt +35 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/ImageEditorViewModuleImpl.kt +113 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/RNCameraView.kt +21 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/license/LicenseModuleImpl.kt +29 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utility/ImageManagerModuleImpl.kt +33 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utility/MultiCrossFilterModuleImpl.kt +85 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/Basic.kt +45 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCore.kt +38 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCvr.kt +128 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDBR.kt +77 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDCE.kt +90 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDCP.kt +50 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDDN.kt +78 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDLR.kt +69 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ImageUtil.kt +58 -0
- package/android/src/main/withNamespace/AndroidManifest.xml +6 -0
- package/android/src/main/{AndroidManifest.xml → withoutNamespace/AndroidManifest.xml} +2 -3
- package/android/src/newarch/com/dynamsoft/reactnativelib/CVRModule.kt +91 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +46 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/DCEModule.kt +91 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/ISAModule.kt +60 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +16 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +24 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageManagerModule.kt +12 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/LicenseModule.kt +14 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +58 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/VersionsModule.kt +41 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/CVRModule.kt +114 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +50 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/DCEModule.kt +112 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/ISAModule.kt +73 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +14 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +36 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/ImageManagerModule.kt +16 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/LicenseModule.kt +18 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +72 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/VersionsModule.kt +41 -0
- package/ios/RNDynamsoftCaptureVision/CPP/DSImageData+HostObject.h +18 -0
- package/ios/RNDynamsoftCaptureVision/CPP/DSImageData+HostObject.mm +33 -0
- package/ios/RNDynamsoftCaptureVision/CPP/ImageDataHostObject.cpp +75 -0
- package/ios/RNDynamsoftCaptureVision/CPP/ImageDataHostObject.hpp +35 -0
- package/ios/RNDynamsoftCaptureVision/CPP/MutableRawBuffer.cpp +23 -0
- package/ios/RNDynamsoftCaptureVision/CPP/MutableRawBuffer.hpp +23 -0
- package/ios/RNDynamsoftCaptureVision/CPP/RNDynamsoft+Json.h +95 -0
- package/ios/RNDynamsoftCaptureVision/CPP/RNDynamsoft+Json.mm +708 -0
- package/ios/RNDynamsoftCaptureVision/CPP/YeetJSIUtils.h +52 -0
- package/ios/RNDynamsoftCaptureVision/CPP/YeetJSIUtils.mm +188 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCameraView.h +27 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCameraView.m +83 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCameraViewManager.h +14 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCameraViewManager.m +167 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCaptureVisionRouter.h +18 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCaptureVisionRouter.mm +420 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageEditorView.h +17 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageEditorView.m +25 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageEditorViewManager.h +14 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageEditorViewManager.mm +119 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageManager.h +13 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageManager.mm +116 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageSourceAdapter.h +18 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageSourceAdapter.mm +214 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftLicense.h +14 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftLicense.m +50 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftMultiCrossFilter.h +14 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftMultiCrossFilter.m +106 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftVersions.h +13 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftVersions.m +39 -0
- package/ios/ReactNativeDcv.xcodeproj/project.pbxproj +390 -0
- package/package.json +47 -22
- package/react-native-dcv.podspec +22 -0
- package/src/NativeDynamsoftVersionsModule.tsx +20 -0
- package/src/VersionsModule.tsx +7 -0
- package/src/core/CapturedResultItem.tsx +7 -0
- package/src/core/CompletionListener.tsx +4 -0
- package/src/core/CoreModule.tsx +8 -0
- package/src/core/DSRect.tsx +23 -0
- package/src/core/EnumCaptureResultItemType.tsx +8 -0
- package/src/core/EnumColourChannelUsageType.tsx +8 -0
- package/src/core/EnumGrayscaleEnhancementMode.tsx +8 -0
- package/src/core/EnumGrayscaleTransformationMode.tsx +6 -0
- package/src/core/EnumPixelFormat.tsx +48 -0
- package/src/core/ImageData.tsx +36 -0
- package/src/core/ImageSourceAdapter.tsx +91 -0
- package/src/core/NativeDynamsoftImageSourceAdapterModule.tsx +18 -0
- package/src/core/Point.tsx +10 -0
- package/src/core/Quadrilateral.tsx +8 -0
- package/src/core/Rect.tsx +18 -0
- package/src/core/index.tsx +17 -0
- package/src/cvr/CaptureVisionRouter.tsx +338 -0
- package/src/cvr/CaptureVisionRouterModule.tsx +8 -0
- package/src/cvr/CapturedResult.tsx +104 -0
- package/src/cvr/CapturedResultFilter.tsx +4 -0
- package/src/cvr/CapturedResultReceiver.tsx +22 -0
- package/src/cvr/EnumPresetTemplate.tsx +16 -0
- package/src/cvr/NativeDynamsoftCaptureVisionRouterModule.tsx +25 -0
- package/src/cvr/SimplifiedCaptureVisionSettings.tsx +16 -0
- package/src/cvr/index.tsx +11 -0
- package/src/dbr/BarcodeReaderModule.tsx +8 -0
- package/src/dbr/BarcodeResultItem.tsx +16 -0
- package/src/dbr/DecodedBarcodesResult.tsx +9 -0
- package/src/dbr/EnumBarcodeFormat.tsx +98 -0
- package/src/dbr/EnumDeblurMode.tsx +12 -0
- package/src/dbr/EnumLocalizationMode.tsx +12 -0
- package/src/dbr/SimplifiedBarcodeReaderSettings.tsx +20 -0
- package/src/dbr/index.tsx +7 -0
- package/src/dce/CameraEnhancer.tsx +104 -0
- package/src/dce/CameraEnhancerModule.tsx +8 -0
- package/src/dce/CameraView.tsx +75 -0
- package/src/dce/DynamsoftCameraViewNativeComponent.ts +25 -0
- package/src/dce/DynamsoftImageEditorViewNativeComponent.ts +9 -0
- package/src/dce/EnumCameraPosition.tsx +10 -0
- package/src/dce/EnumDrawingLayerId.tsx +6 -0
- package/src/dce/EnumEnhancedFeatures.tsx +9 -0
- package/src/dce/EnumFocusMode.tsx +4 -0
- package/src/dce/EnumTorchState.tsx +10 -0
- package/src/dce/FeedBack.tsx +18 -0
- package/src/dce/ImageEditorView.tsx +94 -0
- package/src/dce/NativeDynamsoftCameraViewModule.tsx +43 -0
- package/src/dce/NativeDynamsoftImageEditorViewModule.ts +9 -0
- package/src/dce/TorchButton.tsx +23 -0
- package/src/dce/index.tsx +11 -0
- package/src/dcp/CodeParserDedicatorModule.tsx +8 -0
- package/src/dcp/CodeParserModule.tsx +8 -0
- package/src/dcp/EnumMappingStatus.tsx +5 -0
- package/src/dcp/EnumValidationStatus.tsx +5 -0
- package/src/dcp/ParsedResult.tsx +8 -0
- package/src/dcp/ParsedResultItem.tsx +15 -0
- package/src/dcp/index.tsx +8 -0
- package/src/ddn/DetectedQuadResultItem.tsx +7 -0
- package/src/ddn/DetectedQuadsResult.tsx +9 -0
- package/src/ddn/DocumentNormalizerModule.tsx +8 -0
- package/src/ddn/EnumImageColourMode.tsx +5 -0
- package/src/ddn/NormalizedImageResultItem.tsx +8 -0
- package/src/ddn/NormalizedImagesResult.tsx +8 -0
- package/src/ddn/SimplifiedDocumentNormalizerSettings.tsx +14 -0
- package/src/ddn/index.tsx +11 -0
- package/src/dip/ImageProcessingModule.tsx +8 -0
- package/src/dip/index.tsx +1 -0
- package/src/dlr/CharacterResult.tsx +8 -0
- package/src/dlr/LabelRecognizerModule.tsx +8 -0
- package/src/dlr/RecognizedTextLinesResult.tsx +9 -0
- package/src/dlr/SimplifiedLabelRecognizerSettings.tsx +11 -0
- package/src/dlr/TextLineResultItem.tsx +11 -0
- package/src/dlr/index.tsx +8 -0
- package/src/index.tsx +13 -0
- package/src/license/LicenseManager.tsx +13 -0
- package/src/license/LicenseModule.tsx +8 -0
- package/src/license/NativeDynamsoftLicenseModule.tsx +7 -0
- package/src/license/index.tsx +7 -0
- package/src/utility/ImageManager.tsx +47 -0
- package/src/utility/MultiFrameResultCrossFilter.tsx +67 -0
- package/src/utility/NativeDynamsoftImageManagerModule.tsx +7 -0
- package/src/utility/NativeDynamsoftMultiCrossFilterModule.tsx +18 -0
- package/src/utility/UtilityModule.tsx +8 -0
- package/src/utility/index.tsx +3 -0
- package/.gitattributes +0 -1
- package/LICENSE +0 -5
- package/Legal.txt +0 -551
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/src/main/java/com/dynamsoft/reactlibrary/Constants.java +0 -23
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDCECameraView.java +0 -131
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDCECameraViewManager.java +0 -246
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftBarcodeReaderModule.java +0 -299
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftCaptrueVisionPackage.java +0 -33
- package/dynamsoft-capture-vision-react-native.podspec +0 -22
- package/ios/RNDynamsoftCaptureVision/DYSCameraView.h +0 -34
- package/ios/RNDynamsoftCaptureVision/DYSCameraView.m +0 -148
- package/ios/RNDynamsoftCaptureVision/DYSCameraViewManager.h +0 -17
- package/ios/RNDynamsoftCaptureVision/DYSCameraViewManager.m +0 -78
- package/ios/RNDynamsoftCaptureVision/RCTDynamsoftBarcodeReader.h +0 -14
- package/ios/RNDynamsoftCaptureVision/RCTDynamsoftBarcodeReader.m +0 -303
- package/ios/RNDynamsoftCaptureVision/StaticClass.h +0 -26
- package/ios/RNDynamsoftCaptureVision/StaticClass.m +0 -21
- package/ios/RNDynamsoftCaptureVision.xcodeproj/project.pbxproj +0 -343
- package/js/BarcodeResult.d.ts +0 -29
- package/js/BarcodeResult.js +0 -3
- package/js/BarcodeResult.js.map +0 -1
- package/js/BarcodeResult.tsx +0 -36
- package/js/BarcodeSettings.d.ts +0 -103
- package/js/BarcodeSettings.js +0 -92
- package/js/BarcodeSettings.js.map +0 -1
- package/js/BarcodeSettings.tsx +0 -106
- package/js/BasicStructures.d.ts +0 -57
- package/js/BasicStructures.js +0 -3
- package/js/BasicStructures.js.map +0 -1
- package/js/BasicStructures.tsx +0 -60
- package/js/CameraSettings.d.ts +0 -53
- package/js/CameraSettings.js +0 -38
- package/js/CameraSettings.js.map +0 -1
- package/js/CameraSettings.tsx +0 -58
- package/js/DynamsoftBarcodeReader.d.ts +0 -61
- package/js/DynamsoftBarcodeReader.js +0 -126
- package/js/DynamsoftBarcodeReader.js.map +0 -1
- package/js/DynamsoftBarcodeReader.tsx +0 -130
- package/js/DynamsoftCameraView.d.ts +0 -64
- package/js/DynamsoftCameraView.js +0 -124
- package/js/DynamsoftCameraView.js.map +0 -1
- package/js/DynamsoftCameraView.tsx +0 -163
- package/js/index.d.ts +0 -7
- package/js/index.js +0 -24
- package/js/index.js.map +0 -1
- package/js/index.tsx +0 -7
- package/tsconfig.json +0 -112
package/README.md
CHANGED
|
@@ -1,39 +1,34 @@
|
|
|
1
1
|
# Dynamsoft Capture Vision React-Native Edition
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-

|
|
5
|
-

|
|
6
|
-

|
|
3
|
+
Dynamsoft Capture Vision (DCV) is an aggregating SDK of a series of specific functional products, which cover image capturing, content understanding, result parsing, and interactive workflow.
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
1. With the implementation of the Image Source Adapter (ISA) interface, a seamless integration with DCV is possible, allowing easy access to various image sources.
|
|
6
|
+
2. Dynamsoft Barcode Reader (DBR), Dynamsoft Document Normalizer (DDN), and Dynamsoft Label Recognizer (DLR) play crucial roles in reading barcodes, structures, and texts from images.
|
|
7
|
+
3. Dynamsoft Code Parser (DCP) is utilized to extract meaningful fields from text/bytes results, ensuring optimal data parsing capabilities.
|
|
8
|
+
4. To seamlessly access intermediate and final results within the DCV SDK, the Capture Result Receiver (CRR) and Intermediate Result Receiver (IRR) interfaces are provided. After users implement these interfaces and register with DCV, they can obtain the results efficiently and conveniently.
|
|
9
|
+
5. To view and edit the output results, Dynamsoft Camera Enhancer (DCE) provide a suite of robust viewing and editing functions.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
- Dynamsoft Barcode Reader (DBR) which provides barcode decoding algorithm and APIs.
|
|
12
|
-
- Dynamsoft Label Recognizer (DLR) which provides label content recognizing algorithm and APIs.
|
|
13
|
-
- Dynamsoft Document Normalizer (DDN) which provides document scanning algorithms and APIs.
|
|
11
|
+
DCV powers your software development through the following aspects:
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
1. Simplicity with Packable Scenarios
|
|
14
|
+
2. Scalability with Pluggable Components
|
|
15
|
+
3. Flexibility With Customizable Workflows
|
|
16
|
+
4. High Performance With Shared Computations
|
|
17
|
+
5. Bidirectional Interactivity with Intermediate Results
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
DCV enables you to develop highly customizable applications for barcode reading, label recognition, document board detection, and result parsing. These applications offer enterprise-grade performance and can be tailored to meet your specific business needs.
|
|
18
20
|
|
|
19
|
-
In <a href="https://www.dynamsoft.com/capture-vision/docs/programming/react-native/user-guide/barcode-reader.html" target="_blank">this guide</a>, you will learn step by step how to integrate the barcode reading capabilities of Dynamsoft Capture Vision React-Native SDK into your App.
|
|
20
21
|
## Samples
|
|
21
22
|
|
|
22
23
|
You can view all the DCV React Native samples via the following links:
|
|
23
24
|
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
View the API reference of DCV React Native Edition to explore the full feature of DCV:
|
|
29
|
-
|
|
30
|
-
- <a href = "https://www.dynamsoft.com/capture-vision/docs/programming/react-native/api-reference/?ver=latest" target = "_blank" >DCV API Reference - React Native Edition</a>
|
|
31
|
-
- <a href = "https://www.dynamsoft.com/capture-vision/docs/programming/react-native/api-reference/barcode-reader.html?ver=latest" target = "_blank" >DCVBarcodeReader Class</a>
|
|
32
|
-
- <a href = "https://www.dynamsoft.com/capture-vision/docs/programming/react-native/api-reference/camera-view.html?ver=latest" target = "_blank" >DCVCameraView Class</a>
|
|
25
|
+
- [Barcode reader simple sample](https://github.com/Dynamsoft/capture-vision-react-native-samples/tree/v2.x-alpha/BarcodeReaderSimpleSample)
|
|
26
|
+
- [Document Scanner](https://github.com/Dynamsoft/capture-vision-react-native-samples/tree/v2.x-alpha/DocumentNormalizerSimpleSample)
|
|
27
|
+
- [MRZ Scanner](https://github.com/Dynamsoft/capture-vision-react-native-samples/tree/v2.x-alpha/MRZScanner)
|
|
33
28
|
|
|
34
29
|
## License
|
|
35
30
|
|
|
36
|
-
- You can also request an extension for your trial license in the [customer portal](https://www.dynamsoft.com/customer/license/trialLicense?product=
|
|
31
|
+
- You can also request an extension for your trial license in the [customer portal](https://www.dynamsoft.com/customer/license/trialLicense?product=dcv&utm_source=github)
|
|
37
32
|
|
|
38
33
|
## Contact
|
|
39
34
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.18.1)
|
|
2
|
+
project("react-native-dcv-android")
|
|
3
|
+
|
|
4
|
+
file(GLOB SRC_FILES "../cpp/*.cpp" "src/main/cpp/**.cpp" "src/main/cpp/*/*.cpp")
|
|
5
|
+
|
|
6
|
+
add_library(${CMAKE_PROJECT_NAME} SHARED
|
|
7
|
+
${SRC_FILES})
|
|
8
|
+
|
|
9
|
+
find_package(ReactAndroid REQUIRED CONFIG)
|
|
10
|
+
|
|
11
|
+
target_link_libraries(${CMAKE_PROJECT_NAME}
|
|
12
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
13
|
+
android
|
|
14
|
+
log)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
README
|
|
2
|
+
======
|
|
3
|
+
|
|
4
|
+
If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm:
|
|
5
|
+
|
|
6
|
+
1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed
|
|
7
|
+
2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK
|
|
8
|
+
```
|
|
9
|
+
ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
|
|
10
|
+
sdk.dir=/Users/{username}/Library/Android/sdk
|
|
11
|
+
```
|
|
12
|
+
3. Delete the `maven` folder
|
|
13
|
+
4. Run `./gradlew installArchives`
|
|
14
|
+
5. Verify that latest set of generated files is in the maven folder with the correct version number
|
package/android/build.gradle
CHANGED
|
@@ -1,53 +1,133 @@
|
|
|
1
|
+
def DEFAULT_COMPILE_SDK_VERSION = 34
|
|
2
|
+
def DEFAULT_MIN_SDK_VERSION = 21
|
|
3
|
+
def DEFAULT_TARGET_SDK_VERSION = 34
|
|
1
4
|
|
|
5
|
+
def safeExtGet(prop, fallback) {
|
|
6
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
apply plugin: 'com.android.library'
|
|
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
|
+
}
|
|
2
15
|
buildscript {
|
|
16
|
+
def kotlinVersion = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["kotlinVersion"]
|
|
3
17
|
repositories {
|
|
4
18
|
google()
|
|
5
19
|
mavenCentral()
|
|
6
20
|
}
|
|
7
|
-
|
|
8
21
|
dependencies {
|
|
9
|
-
classpath 'com.android.tools.build:gradle:
|
|
22
|
+
classpath 'com.android.tools.build:gradle:8.5.1'
|
|
23
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
10
24
|
}
|
|
11
25
|
}
|
|
12
26
|
|
|
13
|
-
|
|
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() {
|
|
35
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
36
|
+
def major = parsed[0].toInteger()
|
|
37
|
+
def minor = parsed[1].toInteger()
|
|
38
|
+
|
|
39
|
+
// Namespace support was added in 7.3.0
|
|
40
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
41
|
+
}
|
|
14
42
|
|
|
15
43
|
android {
|
|
16
|
-
|
|
17
|
-
|
|
44
|
+
if (supportsNamespace()) {
|
|
45
|
+
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"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
18
55
|
|
|
56
|
+
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
|
|
19
57
|
defaultConfig {
|
|
20
|
-
minSdkVersion
|
|
21
|
-
targetSdkVersion
|
|
58
|
+
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
|
|
59
|
+
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
|
|
22
60
|
versionCode 1
|
|
23
61
|
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())
|
|
24
69
|
}
|
|
25
70
|
lintOptions {
|
|
26
71
|
abortOnError false
|
|
27
72
|
}
|
|
73
|
+
externalNativeBuild {
|
|
74
|
+
cmake {
|
|
75
|
+
path file('CMakeLists.txt')
|
|
76
|
+
version '3.18.1'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
buildFeatures {
|
|
81
|
+
prefab true
|
|
82
|
+
}
|
|
83
|
+
packagingOptions {
|
|
84
|
+
// doNotStrip resolveBuildType() == 'debug' ? "**/**/*.so" : ''
|
|
85
|
+
excludes = [
|
|
86
|
+
"META-INF",
|
|
87
|
+
"META-INF/**",
|
|
88
|
+
"**/libjsi.so",
|
|
89
|
+
"**/libc++_shared.so"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
28
92
|
}
|
|
29
93
|
|
|
30
94
|
repositories {
|
|
95
|
+
// ref: https://www.baeldung.com/maven-local-repository
|
|
31
96
|
google()
|
|
32
97
|
mavenCentral()
|
|
33
98
|
maven {
|
|
34
99
|
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
35
100
|
url "$rootDir/../node_modules/react-native/android"
|
|
36
101
|
}
|
|
102
|
+
maven {
|
|
103
|
+
// Android JSC is installed from npm
|
|
104
|
+
url "$rootDir/../node_modules/jsc-android/dist"
|
|
105
|
+
}
|
|
37
106
|
}
|
|
38
107
|
|
|
39
108
|
rootProject.allprojects {
|
|
40
109
|
repositories {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
110
|
+
maven {
|
|
111
|
+
url "https://download2.dynamsoft.com/maven/aar"
|
|
112
|
+
}
|
|
113
|
+
maven {
|
|
114
|
+
url "http://192.168.8.101:8081/repository/maven-dynamsoft-public/"
|
|
115
|
+
allowInsecureProtocol true
|
|
116
|
+
}
|
|
117
|
+
}
|
|
45
118
|
}
|
|
46
119
|
|
|
47
120
|
dependencies {
|
|
48
|
-
|
|
49
|
-
implementation 'com.dynamsoft:dynamsoftbarcodereader:9.6.20@aar'
|
|
121
|
+
def kotlinVersion = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["kotlinVersion"]
|
|
50
122
|
|
|
51
|
-
|
|
52
|
-
|
|
123
|
+
//noinspection GradleDynamicVersion
|
|
124
|
+
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
125
|
+
// compileOnly "com.facebook.react:react-android:0.75.2"
|
|
53
126
|
|
|
127
|
+
//noinspection GradleDependency
|
|
128
|
+
|
|
129
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
|
130
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
|
|
131
|
+
|
|
132
|
+
implementation "com.dynamsoft:dynamsoftcapturevisionbundle:2.4.2000"
|
|
133
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Project-wide Gradle settings.
|
|
2
|
+
# IDE (e.g. Android Studio) users:
|
|
3
|
+
# Gradle settings configured through the IDE *will override*
|
|
4
|
+
# any settings specified in this file.
|
|
5
|
+
# For more details on how to configure your build environment visit
|
|
6
|
+
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
|
7
|
+
# Specifies the JVM arguments used for the daemon process.
|
|
8
|
+
# The setting is particularly useful for tweaking memory settings.
|
|
9
|
+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
|
10
|
+
# When configured, Gradle will run in incubating parallel mode.
|
|
11
|
+
# This option should only be used with decoupled projects. More details, visit
|
|
12
|
+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
|
13
|
+
# org.gradle.parallel=true
|
|
14
|
+
android.useAndroidX=true
|
|
15
|
+
android.enableJetifier=true
|
|
16
|
+
|
|
17
|
+
kotlinVersion=1.7.21
|
|
18
|
+
minSdk=21
|
|
19
|
+
targetSdk=34
|
|
20
|
+
compileSdk=34
|
|
21
|
+
ndkversion=21.4.7075529
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
rootProject.name = "react-native-dcv-android"
|
|
2
|
+
|
|
3
|
+
if(file("$rootDir/../node_modules/@react-native-community/cli-platform-android/native_modules.gradle").exists()) {
|
|
4
|
+
apply from: file("$rootDir/../node_modules/@react-native-community/cli-platform-android/native_modules.gradle")
|
|
5
|
+
applyNativeModulesSettingsGradle(settings)
|
|
6
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Allen on 24/08/26.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
#include "MutableRawBuffer.h"
|
|
7
|
+
|
|
8
|
+
MutableRawBuffer::MutableRawBuffer(uint8_t* data, size_t size, bool freeOnDealloc)
|
|
9
|
+
: _data(data), _size(size), _freeOnDealloc(freeOnDealloc) {}
|
|
10
|
+
|
|
11
|
+
MutableRawBuffer::~MutableRawBuffer() {
|
|
12
|
+
if (_freeOnDealloc && _data != nullptr) {
|
|
13
|
+
free(_data);
|
|
14
|
+
_data = nullptr;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
size_t MutableRawBuffer::size() const {
|
|
19
|
+
return _size;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
uint8_t* MutableRawBuffer::data() {
|
|
23
|
+
return _data;
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Allen on 24/08/26.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef REACT_NATIVE_DCV_ANDROID_SRC_MAIN_CPP_MUTABLERAWBUFFER_H_
|
|
6
|
+
#define REACT_NATIVE_DCV_ANDROID_SRC_MAIN_CPP_MUTABLERAWBUFFER_H_
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
#include <jsi/jsi.h>
|
|
10
|
+
using namespace facebook::jsi;
|
|
11
|
+
|
|
12
|
+
class MutableRawBuffer : public MutableBuffer {
|
|
13
|
+
public:
|
|
14
|
+
MutableRawBuffer(uint8_t* data, size_t size, bool freeOnDealloc);
|
|
15
|
+
~MutableRawBuffer() override;
|
|
16
|
+
|
|
17
|
+
uint8_t* data() override;
|
|
18
|
+
[[nodiscard]] size_t size() const override;
|
|
19
|
+
uint8_t* _data;
|
|
20
|
+
size_t _size;
|
|
21
|
+
bool _freeOnDealloc;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
#endif //REACT_NATIVE_DCV_ANDROID_SRC_MAIN_CPP_MUTABLERAWBUFFER_H_
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Allen on 24/05/15.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef DYNAMSOFT_CORE_REACT_NATIVE_ANDROID_SRC_MAIN_CPP_ANDROID_LOG_H_
|
|
6
|
+
#define DYNAMSOFT_CORE_REACT_NATIVE_ANDROID_SRC_MAIN_CPP_ANDROID_LOG_H_
|
|
7
|
+
|
|
8
|
+
#include "android/log.h"
|
|
9
|
+
#define LOG_TAG "Dynamsoft RN JNI"
|
|
10
|
+
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
|
11
|
+
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
|
|
12
|
+
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
|
13
|
+
|
|
14
|
+
#endif //DYNAMSOFT_CORE_REACT_NATIVE_ANDROID_SRC_MAIN_CPP_ANDROID_LOG_H_
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Allen on 24/08/26.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#include "ImageDataHostObject.h"
|
|
6
|
+
#include "../MutableRawBuffer.h"
|
|
7
|
+
#include "../android_log.h"
|
|
8
|
+
|
|
9
|
+
#define JSI_FUNC [=](Runtime & runtime, const Value& thisValue, const Value* arguments, size_t count) -> Value
|
|
10
|
+
#define GET_VALUE(X) if(name==#X){return this->X;}
|
|
11
|
+
#define SET_INT_VALUE(X) if(name==#X){this->X = (int) value.asNumber();}
|
|
12
|
+
|
|
13
|
+
ImageDataHostObject::ImageDataHostObject(int width, int height, int stride, int format, int orientation, uint8_t *buffer, int bufferSize)
|
|
14
|
+
: width(width), height(height), stride(stride), format(format), orientation(orientation), buffer(buffer), bufferSize(bufferSize) {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ImageDataHostObject ImageDataHostObject::getHOFromObject(Runtime &runtime, Object jsObj) {
|
|
18
|
+
if (jsObj.isHostObject(runtime)) {
|
|
19
|
+
return *((ImageDataHostObject *) (jsObj.asHostObject(runtime).get()));
|
|
20
|
+
}
|
|
21
|
+
ImageDataHostObject imageHO;
|
|
22
|
+
int width = jsObj.hasProperty(runtime, "width") ? (int) jsObj.getProperty(runtime, "width").asNumber() : 0;
|
|
23
|
+
int height = jsObj.hasProperty(runtime, "height") ? (int) jsObj.getProperty(runtime, "height").asNumber() : 0;
|
|
24
|
+
int stride = jsObj.hasProperty(runtime, "stride") ? (int) jsObj.getProperty(runtime, "stride").asNumber() : 0;
|
|
25
|
+
int format = jsObj.hasProperty(runtime, "format") ? (int) jsObj.getProperty(runtime, "format").asNumber() : 0;
|
|
26
|
+
int orientation = jsObj.hasProperty(runtime, "orientation") ? (int) jsObj.getProperty(runtime, "orientation").asNumber() : 0;
|
|
27
|
+
uint8_t *buffer = nullptr;
|
|
28
|
+
int bufferSize = 0;
|
|
29
|
+
if (jsObj.hasProperty(runtime, "buffer")) {
|
|
30
|
+
ArrayBuffer array_buffer = jsObj.getProperty(runtime, "buffer").asObject(runtime).getArrayBuffer(runtime);
|
|
31
|
+
buffer = array_buffer.data(runtime);
|
|
32
|
+
bufferSize = (int) array_buffer.length(runtime);
|
|
33
|
+
}
|
|
34
|
+
return ImageDataHostObject(width, height, stride, format, orientation, buffer, bufferSize);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
Value ImageDataHostObject::get(Runtime &runtime, const PropNameID &propName) {
|
|
38
|
+
auto name = propName.utf8(runtime);
|
|
39
|
+
GET_VALUE(width)
|
|
40
|
+
GET_VALUE(height)
|
|
41
|
+
GET_VALUE(stride)
|
|
42
|
+
GET_VALUE(format)
|
|
43
|
+
GET_VALUE(orientation)
|
|
44
|
+
GET_VALUE(bufferSize)
|
|
45
|
+
//todo
|
|
46
|
+
if (name == "buffer") {
|
|
47
|
+
auto mutableBuffer = std::make_shared<MutableRawBuffer>(buffer, bufferSize, false);
|
|
48
|
+
return ArrayBuffer(runtime, mutableBuffer);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (name == "release") {
|
|
52
|
+
auto release = JSI_FUNC {
|
|
53
|
+
if(buffer != nullptr) {
|
|
54
|
+
delete[] buffer;
|
|
55
|
+
buffer = nullptr;
|
|
56
|
+
bufferSize = 0;
|
|
57
|
+
}
|
|
58
|
+
return {};
|
|
59
|
+
};
|
|
60
|
+
return Function::createFromHostFunction(runtime, PropNameID::forUtf8(runtime, "release"), 0, release);
|
|
61
|
+
}
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
void ImageDataHostObject::set(Runtime &runtime, const PropNameID &propName, const Value &value) {
|
|
66
|
+
auto name = propName.utf8(runtime);
|
|
67
|
+
SET_INT_VALUE(width)
|
|
68
|
+
SET_INT_VALUE(height)
|
|
69
|
+
SET_INT_VALUE(stride)
|
|
70
|
+
SET_INT_VALUE(format)
|
|
71
|
+
SET_INT_VALUE(orientation)
|
|
72
|
+
//todo
|
|
73
|
+
if (name == "buffer") {
|
|
74
|
+
auto arrayBuffer = value.asObject(runtime).getArrayBuffer(runtime);
|
|
75
|
+
this->buffer = arrayBuffer.data(runtime);
|
|
76
|
+
this->bufferSize = (int) arrayBuffer.length(runtime);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
std::vector<PropNameID> ImageDataHostObject::getPropertyNames(Runtime &rt) {
|
|
81
|
+
std::vector<PropNameID> result;
|
|
82
|
+
result.push_back(PropNameID::forUtf8(rt, std::string("width")));
|
|
83
|
+
result.push_back(PropNameID::forUtf8(rt, std::string("height")));
|
|
84
|
+
result.push_back(PropNameID::forUtf8(rt, std::string("stride")));
|
|
85
|
+
result.push_back(PropNameID::forUtf8(rt, std::string("format")));
|
|
86
|
+
result.push_back(PropNameID::forUtf8(rt, std::string("orientation")));
|
|
87
|
+
result.push_back(PropNameID::forUtf8(rt, std::string("buffer")));
|
|
88
|
+
result.push_back(PropNameID::forUtf8(rt, std::string("release")));
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void ImageDataHostObject::logString(const char *preStr) const {
|
|
93
|
+
LOGI("%s wid:%d, hgt:%d, stride:%d, format:%d, orientation:%d, bufferSize:%d, buffer:%p, this:%p",
|
|
94
|
+
preStr, width, height, stride, format, orientation, bufferSize, buffer, this);
|
|
95
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Created by Allen on 24/08/26.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
#ifndef REACT_NATIVE_DCV_ANDROID_SRC_MAIN_CPP_CORE_IMAGEDATAHOSTOBJECT_H_
|
|
6
|
+
#define REACT_NATIVE_DCV_ANDROID_SRC_MAIN_CPP_CORE_IMAGEDATAHOSTOBJECT_H_
|
|
7
|
+
|
|
8
|
+
#include "jsi/jsi.h"
|
|
9
|
+
|
|
10
|
+
using namespace facebook::jsi;
|
|
11
|
+
|
|
12
|
+
class ImageDataHostObject : public HostObject {
|
|
13
|
+
public:
|
|
14
|
+
int width = 0;
|
|
15
|
+
int height = 0;
|
|
16
|
+
int stride = 0;
|
|
17
|
+
int format = 0;
|
|
18
|
+
int orientation = 0;
|
|
19
|
+
|
|
20
|
+
uint8_t *buffer = nullptr;
|
|
21
|
+
int bufferSize = 0;
|
|
22
|
+
|
|
23
|
+
explicit ImageDataHostObject() = default;
|
|
24
|
+
explicit ImageDataHostObject(int width, int height, int stride, int format, int orientation, uint8_t *buffer, int bufferSize);
|
|
25
|
+
|
|
26
|
+
Value get(Runtime &, const PropNameID &name) override;
|
|
27
|
+
void set(Runtime &, const PropNameID &name, const Value &value) override;
|
|
28
|
+
std::vector<PropNameID> getPropertyNames(Runtime &rt) override;
|
|
29
|
+
|
|
30
|
+
static ImageDataHostObject getHOFromObject(Runtime &runtime, Object jsObj);
|
|
31
|
+
void logString(const char *preStr = "ImageDataHostObject") const;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
#endif //REACT_NATIVE_DCV_ANDROID_SRC_MAIN_CPP_CORE_IMAGEDATAHOSTOBJECT_H_
|