dynamsoft-capture-vision-react-native 2.6.1016 → 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.
- package/LICENSE +2 -2
- package/README.md +7 -9
- package/android/build.gradle +29 -42
- package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CVRModule.kt +4 -4
- package/android/src/main/java/com/dynamsoft/reactnativelib/ReactNativeDcvPackage.kt +13 -85
- package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/VersionsModule.kt +2 -2
- package/android/src/main/java/com/dynamsoft/reactnativelib/cvr/CaptureVisionRouterModuleImpl.kt +23 -25
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +2 -2
- package/android/src/main/java/com/dynamsoft/reactnativelib/license/LicenseModuleImpl.kt +1 -1
- package/android/src/main/java/com/dynamsoft/reactnativelib/utility/ImageManagerModuleImpl.kt +19 -4
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCore.kt +14 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCvr.kt +12 -7
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDBR.kt +1 -7
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDCE.kt +2 -2
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDDN.kt +27 -19
- package/android/src/main/jniLibs/debug/arm64-v8a/librn_dys.so +0 -0
- package/android/src/main/jniLibs/debug/armeabi-v7a/librn_dys.so +0 -0
- package/android/src/main/jniLibs/debug/x86/librn_dys.so +0 -0
- package/android/src/main/jniLibs/debug/x86_64/librn_dys.so +0 -0
- package/android/src/main/jniLibs/release/arm64-v8a/librn_dys.so +0 -0
- package/android/src/main/jniLibs/release/armeabi-v7a/librn_dys.so +0 -0
- package/android/src/main/jniLibs/release/x86/librn_dys.so +0 -0
- package/android/src/main/jniLibs/release/x86_64/librn_dys.so +0 -0
- package/dynamsoft-capture-vision-react-native.podspec +9 -7
- package/ios/CPP/DSImageData+HostObject.h +1 -1
- package/ios/CPP/RNDynamsoft+JSI.h +2 -2
- package/ios/CPP/RNDynamsoft+JSI.mm +18 -10
- package/ios/CPP/RNDynamsoft+Json.h +2 -13
- package/ios/CPP/RNDynamsoft+Json.m +48 -39
- package/ios/CPP/YeetJSIUtils.h +3 -1
- package/ios/CPP/YeetJSIUtils.mm +5 -0
- package/ios/RNDynamsoftCameraView.m +1 -1
- package/ios/RNDynamsoftCameraViewManager.m +18 -6
- package/ios/RNDynamsoftCaptureVisionRouter.mm +76 -45
- package/ios/RNDynamsoftImageEditorView.m +1 -1
- package/ios/RNDynamsoftImageEditorViewManager.mm +36 -13
- package/ios/RNDynamsoftImageManager.mm +33 -4
- package/ios/RNDynamsoftImageSourceAdapter.mm +1 -1
- package/ios/RNDynamsoftLicense.m +1 -1
- package/ios/RNDynamsoftMultiCrossFilter.m +9 -9
- package/ios/RNDynamsoftVersions.m +1 -13
- package/package.json +3 -11
- package/src/core/CapturedResultBase.tsx +18 -0
- package/src/core/EnumCaptureResultItemType.tsx +12 -6
- package/src/core/EnumCrossVerificationStatus.tsx +6 -6
- package/src/core/ImageData.tsx +1 -1
- package/src/core/index.tsx +1 -0
- package/src/cvr/CaptureVisionRouter.tsx +47 -51
- package/src/cvr/CapturedResult.tsx +24 -46
- package/src/cvr/CapturedResultReceiver.tsx +12 -19
- package/src/cvr/NativeDynamsoftCaptureVisionRouterModule.tsx +2 -2
- package/src/cvr/SimplifiedCaptureVisionSettings.tsx +4 -4
- package/src/dbr/DecodedBarcodesResult.tsx +3 -17
- package/src/dce/DynamsoftCameraViewNativeComponent.ts +2 -2
- package/src/dcp/ParsedResult.tsx +3 -14
- package/src/ddn/DeskewedImageResultItem.tsx +40 -0
- package/src/ddn/DetectedQuadResultItem.tsx +3 -1
- package/src/ddn/EnhancedImageResultItem.tsx +20 -0
- package/src/ddn/ProcessedDocumentResult.tsx +27 -0
- package/src/ddn/SimplifiedDocumentNormalizerSettings.tsx +18 -3
- package/src/ddn/index.tsx +3 -3
- package/src/dlr/RecognizedTextLinesResult.tsx +2 -16
- package/src/index.tsx +0 -1
- package/src/utility/ImageManager.tsx +66 -45
- package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/BarcodeScannerModuleImpl.kt +0 -80
- package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/MRZScannerModuleImpl.kt +0 -77
- package/android/src/main/java/com/dynamsoft/reactnativelib/rtu/ScannerInterface.kt +0 -47
- package/android/src/main/jniLibs/arm64-v8a/librn_dys.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/librn_dys.so +0 -0
- package/android/src/main/jniLibs/x86/librn_dys.so +0 -0
- package/android/src/main/jniLibs/x86_64/librn_dys.so +0 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -22
- package/android/src/newarch/com/dynamsoft/reactnativelib/CVRModule.kt +0 -91
- package/android/src/newarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -52
- package/android/src/newarch/com/dynamsoft/reactnativelib/DCEModule.kt +0 -91
- package/android/src/newarch/com/dynamsoft/reactnativelib/ISAModule.kt +0 -60
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -16
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -24
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -12
- package/android/src/newarch/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -14
- package/android/src/newarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -22
- package/android/src/newarch/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -58
- package/android/src/newarch/com/dynamsoft/reactnativelib/VersionsModule.kt +0 -41
- package/android/src/oldarch/com/dynamsoft/reactnativelib/BarcodeScannerModule.kt +0 -24
- package/android/src/oldarch/com/dynamsoft/reactnativelib/MRZScannerModule.kt +0 -24
- package/ios/RNDynamsoftBarcodeScanner.h +0 -14
- package/ios/RNDynamsoftBarcodeScanner.m +0 -169
- package/ios/RNDynamsoftMRZScanner.h +0 -14
- package/ios/RNDynamsoftMRZScanner.m +0 -140
- package/src/ddn/DetectedQuadsResult.tsx +0 -31
- package/src/ddn/NormalizedImageResultItem.tsx +0 -32
- package/src/ddn/NormalizedImagesResult.tsx +0 -27
- package/src/rtu/BarcodeScanConfig.tsx +0 -104
- package/src/rtu/BarcodeScanResult.tsx +0 -31
- package/src/rtu/BarcodeScanner.tsx +0 -112
- package/src/rtu/EnumResultState.tsx +0 -21
- package/src/rtu/MRZScanConfig.tsx +0 -67
- package/src/rtu/MRZScanResult.tsx +0 -84
- package/src/rtu/MRZScanner.tsx +0 -90
- package/src/rtu/NativeDynamsoftBarcodeScannerModule.tsx +0 -6
- package/src/rtu/NativeDynamsoftMRZScannerModule.tsx +0 -6
- package/src/rtu/index.tsx +0 -7
- /package/android/src/main/{withNamespace/AndroidManifest.xml → AndroidManifest.xml} +0 -0
- /package/android/src/main/{withoutNamespace/AndroidManifest.xml → AndroidManifest_noPackage.xml} +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CameraViewManager.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/DCEModule.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ISAModule.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageManagerModule.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/LicenseModule.kt +0 -0
- /package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +0 -0
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type {ImageData, CapturedResultItem, Quadrilateral, EnumCrossVerificationStatus, EnumCapturedResultItemType} from "../core";
|
|
2
|
-
import {CaptureVisionRouter} from "../cvr";
|
|
3
|
-
import {MultiFrameResultCrossFilter} from "../utility";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The NormalizedImageResultItem interface extends the CapturedResultItem interface and represents a normalized image result item.
|
|
7
|
-
* @see {@link NormalizedImagesResult}
|
|
8
|
-
* @see {@link EnumCapturedResultItemType.CRIT_NORMALIZED_IMAGE}
|
|
9
|
-
* */
|
|
10
|
-
export interface NormalizedImageResultItem extends CapturedResultItem {
|
|
11
|
-
/**
|
|
12
|
-
* The location where the normalized image was extracted from within the original image, represented as a quadrilateral.
|
|
13
|
-
* @see {@link Quadrilateral}
|
|
14
|
-
* */
|
|
15
|
-
location: Quadrilateral;
|
|
16
|
-
|
|
17
|
-
/**The image data for the normalized image result.
|
|
18
|
-
* @see {@link ImageData}*/
|
|
19
|
-
imageData: ImageData;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The cross verification status of type {@link EnumCrossVerificationStatus}.
|
|
23
|
-
*
|
|
24
|
-
* @remarks If {@link CaptureVisionRouter} doesn't add {@link MultiFrameResultCrossFilter} via {@link CaptureVisionRouter.addFilter}
|
|
25
|
-
* or added {@link MultiFrameResultCrossFilter} doesn't enable verification for the corresponding type,
|
|
26
|
-
* the crossVerificationStatus property of the item for that type will always remain {@link EnumCrossVerificationStatus.CVS_NOT_VERIFIED}.
|
|
27
|
-
*
|
|
28
|
-
* @see {@link EnumCrossVerificationStatus}
|
|
29
|
-
* @see {@link MultiFrameResultCrossFilter.enableResultCrossVerification}
|
|
30
|
-
* */
|
|
31
|
-
crossVerificationStatus: EnumCrossVerificationStatus | number
|
|
32
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type {NormalizedImageResultItem} from "./NormalizedImageResultItem";
|
|
2
|
-
import {type CapturedResultReceiver, IntermediateResultManager} from "../cvr";
|
|
3
|
-
|
|
4
|
-
/**{@link IntermediateResultManager}*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The NormalizedImagesResult interface holds information on normalized images, of type NormalizedImageResultItem, derived from an original image.
|
|
8
|
-
* @see {@link CapturedResultReceiver.onNormalizedImagesReceived}
|
|
9
|
-
* */
|
|
10
|
-
export interface NormalizedImagesResult {
|
|
11
|
-
/**
|
|
12
|
-
* The hash ID of the original image.
|
|
13
|
-
* @see IntermediateResultManager.getOriginalImage
|
|
14
|
-
* */
|
|
15
|
-
originalImageHashId: string;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* An array of {@link NormalizedImageResultItem} objects, each representing a piece of the original image after normalization.
|
|
19
|
-
* */
|
|
20
|
-
items?: Array<NormalizedImageResultItem>;
|
|
21
|
-
|
|
22
|
-
/**The error code of the barcode reading result, if an error occurred.*/
|
|
23
|
-
errorCode: number;
|
|
24
|
-
|
|
25
|
-
/**The error message of the barcode reading result, if an error occurred.*/
|
|
26
|
-
errorMessage?: string;
|
|
27
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type {EnumBarcodeFormat} from "../dbr";
|
|
2
|
-
import type {DSRect} from "../core";
|
|
3
|
-
|
|
4
|
-
export interface BarcodeScanConfig {
|
|
5
|
-
/**
|
|
6
|
-
* Sets the barcode format(s) to read.
|
|
7
|
-
* This value is a combination of EnumBarcodeFormat flags that determine which barcode types to read.
|
|
8
|
-
* For example, to scan QR codes and OneD codes,
|
|
9
|
-
* set the value to `EnumBarcodeFormat.BF_QR_CODE | EnumBarcodeFormat.BF_ONED`.
|
|
10
|
-
*
|
|
11
|
-
* @see {@link EnumBarcodeFormat}
|
|
12
|
-
* */
|
|
13
|
-
barcodeFormats?: EnumBarcodeFormat,
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* internal field, don't set it.
|
|
17
|
-
* */
|
|
18
|
-
_barcodeFormatNumberString?: string,
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The license key required to initialize the barcode reader.
|
|
22
|
-
*/
|
|
23
|
-
license?: string,
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Defines the scanning area as a DSRect object where barcodes will be detected.
|
|
27
|
-
* Only the barcodes located within this defined region will be processed.
|
|
28
|
-
*
|
|
29
|
-
* @see {@link DSRect}
|
|
30
|
-
*/
|
|
31
|
-
scanRegion?: DSRect,
|
|
32
|
-
/**
|
|
33
|
-
* Determines whether the torch (flashlight) button is visible in the scanning UI.
|
|
34
|
-
* Set to true to display the torch button, enabling users to turn the flashlight on/off.
|
|
35
|
-
*/
|
|
36
|
-
isTorchButtonVisible?: boolean,
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Specifies if a beep sound should be played when a barcode is successfully detected.
|
|
40
|
-
* Set to true to enable the beep sound, or false to disable it.
|
|
41
|
-
*/
|
|
42
|
-
isBeepEnabled?: boolean,
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Enables or disables the auto-zoom feature during scanning.
|
|
46
|
-
* When enabled (true), the scanner will automatically zoom in to improve barcode detection.
|
|
47
|
-
*/
|
|
48
|
-
isAutoZoomEnabled?: boolean,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Determines whether the close button is visible on the scanner UI.
|
|
52
|
-
* This button allows users to exit the scanning interface.
|
|
53
|
-
*/
|
|
54
|
-
isCloseButtonVisible?: boolean,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Specifies whether the camera toggle button is displayed.
|
|
58
|
-
* This button lets users switch between available cameras (e.g., front and rear).
|
|
59
|
-
*/
|
|
60
|
-
isCameraToggleButtonVisible?: boolean,
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Determines if a scanning laser overlay is shown on the scanning screen.
|
|
64
|
-
* This visual aid (scan laser) helps indicate the scanning line during barcode detection.
|
|
65
|
-
*/
|
|
66
|
-
isScanLaserVisible?: boolean,
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Sets the scanning mode for the barcode reader.
|
|
70
|
-
* The mode is defined by the EnumScanningMode and affects the scanning behavior.
|
|
71
|
-
*
|
|
72
|
-
* @see {@link EnumScanningMode}
|
|
73
|
-
*/
|
|
74
|
-
scanningMode?: EnumScanningMode,
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Defines the expected number of barcodes to be scanned.
|
|
78
|
-
* The scanning process will automatically stop when the number of detected barcodes reaches this count.
|
|
79
|
-
*/
|
|
80
|
-
expectedBarcodesCount?: number,
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Specifies the maximum number of consecutive stable frames to process before exiting scanning.
|
|
84
|
-
* A "stable frame" is one where no new barcode is detected; the default value is typically 10.
|
|
85
|
-
*/
|
|
86
|
-
maxConsecutiveStableFramesToExit?: number,
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Specifies the template configuration for the barcode scanner.
|
|
90
|
-
* This can be either a file path or a JSON string that defines various scanning parameters.
|
|
91
|
-
*/
|
|
92
|
-
templateFile?: string,
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Provides a Node.js 'require' function to load the template file when running in a Node environment.
|
|
96
|
-
* This facilitates importing external template configuration files.
|
|
97
|
-
*/
|
|
98
|
-
templateNodeRequire?: NodeRequire,
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export enum EnumScanningMode {
|
|
102
|
-
SM_SINGLE,
|
|
103
|
-
SM_MULTIPLE
|
|
104
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type {BarcodeResultItem} from "../dbr";
|
|
2
|
-
import type {EnumResultStatus} from "./EnumResultState";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* BarcodeScanResult contains all decoded barcodes and their associated info.
|
|
6
|
-
* */
|
|
7
|
-
export interface BarcodeScanResult {
|
|
8
|
-
/**
|
|
9
|
-
* The status of the barcode scan result.
|
|
10
|
-
* - {@link EnumResultStatus.RS_FINISHED}: The barcode scanning is finished.
|
|
11
|
-
* - {@link EnumResultStatus.RS_CANCELED}: The barcode scanning activity is closed before the process is finished.
|
|
12
|
-
* - {@link EnumResultStatus.RS_EXCEPTION}: Failed to start barcode scanning or an error occurs when scanning the barcodes.
|
|
13
|
-
* */
|
|
14
|
-
resultStatus: EnumResultStatus,
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Returns the error code when the resultStatus is {@link EnumResultStatus.RS_EXCEPTION}.
|
|
18
|
-
* */
|
|
19
|
-
errorCode?: number,
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Returns the errorString when the resultStatus is {@link EnumResultStatus.RS_EXCEPTION}.
|
|
23
|
-
* */
|
|
24
|
-
errorString?: string,
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The decoded barcodes when the resultStatus is {@link EnumResultStatus.RS_FINISHED}.
|
|
28
|
-
* @see {@link BarcodeResultItem}
|
|
29
|
-
* */
|
|
30
|
-
barcodes?: BarcodeResultItem[]
|
|
31
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import {NativeModules, Platform} from "react-native";
|
|
2
|
-
import {type BarcodeScanConfig, EnumScanningMode} from "./BarcodeScanConfig";
|
|
3
|
-
import type {BarcodeScanResult} from "./BarcodeScanResult";
|
|
4
|
-
import {EnumBarcodeFormat} from "../dbr";
|
|
5
|
-
import type {DSRect} from "../core";
|
|
6
|
-
|
|
7
|
-
// @ts-ignore Check whether __turboModuleProxy exists, it may not
|
|
8
|
-
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
9
|
-
const DynamsoftBarcodeScannerModule = !isTurboModuleEnabled?
|
|
10
|
-
NativeModules.DynamsoftBarcodeScannerModule :
|
|
11
|
-
require("./NativeDynamsoftBarcodeScannerModule").default;
|
|
12
|
-
|
|
13
|
-
const DefaultConfig: BarcodeScanConfig = {
|
|
14
|
-
_barcodeFormatNumberString: EnumBarcodeFormat.BF_DEFAULT.toString(),
|
|
15
|
-
isTorchButtonVisible: true,
|
|
16
|
-
isBeepEnabled: false,
|
|
17
|
-
isAutoZoomEnabled: false,
|
|
18
|
-
isCloseButtonVisible: true,
|
|
19
|
-
isScanLaserVisible: false,
|
|
20
|
-
isCameraToggleButtonVisible: false,
|
|
21
|
-
scanningMode: EnumScanningMode.SM_SINGLE,
|
|
22
|
-
expectedBarcodesCount: 999,
|
|
23
|
-
maxConsecutiveStableFramesToExit: 5,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const isIOS: boolean = Platform.OS === 'ios';
|
|
27
|
-
|
|
28
|
-
export class BarcodeScanner {
|
|
29
|
-
private constructor() {
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Starts the barcode scanner by launching a new page (Activity on Android or ViewController on iOS).
|
|
34
|
-
*
|
|
35
|
-
* This function initiates the barcode scanning process by launching a new page dedicated to scanning.
|
|
36
|
-
* It accepts an optional configuration object to customize the scanning behavior. If no configuration
|
|
37
|
-
* is provided, it uses a default configuration. The function returns a Promise that resolves with the
|
|
38
|
-
* scan result or rejects with an error if the scanning process fails.
|
|
39
|
-
*
|
|
40
|
-
* For Android, this function starts an Activity that handles the barcode scanning. For iOS, it presents
|
|
41
|
-
* a ViewController for the same purpose. After scanning, the function handles the result and closes
|
|
42
|
-
* the scanning page if necessary.
|
|
43
|
-
*
|
|
44
|
-
* @param config (optional) Configuration parameters for the barcode scanner, including:
|
|
45
|
-
* - `license` (string): Dynamsoft license key. If empty, the license is not set.
|
|
46
|
-
* - `barcodeFormats` ({@link EnumBarcodeFormat}): Numeric representation of barcode formats, default is `EnumBarcodeFormat.BF_DEFAULT`.
|
|
47
|
-
* Note that if templateContent or templateNodeRequire is set, barcodeFormats will not take effect.
|
|
48
|
-
* - `templateFile` - The content of the template as a json string.
|
|
49
|
-
* - `templateNodeRequire` - The template node require object.
|
|
50
|
-
* - `scanRegion` ({@link DSRect}): Configuration for the scan region. Optional.
|
|
51
|
-
* - `isTorchButtonVisible` (boolean): Whether to display the torch button, default is `true`.
|
|
52
|
-
* - `isBeepEnabled` (boolean): Whether to enable the beep sound on successful scan, default is `false`.
|
|
53
|
-
* - `isAutoZoomEnabled` (boolean): Whether to enable auto-zoom, default is `false`.
|
|
54
|
-
* - `isCloseButtonVisible` (boolean): Whether to display the close button, default is `true`.
|
|
55
|
-
* - `isScanLaserVisible` (boolean): Whether to display the scan laser line, default is `false`.
|
|
56
|
-
* - `scanningMode` ({@link EnumScanningMode}): Scanning mode, default is {@link EnumScanningMode.SM_SINGLE}. When set to {@link EnumScanningMode.SM_MULTIPLE}, `expectedBarcodesCount` and `maxConsecutiveStableFramesToExit` are effective.
|
|
57
|
-
* - `expectedBarcodesCount` (number): Expected number of barcodes to be scanned. Effective only when `scanningMode` is set to {@link EnumScanningMode.SM_MULTIPLE}.
|
|
58
|
-
* When the number of scanned barcodes is greater than or equal to this value, the scanning process will exit immediately and return the results, default is `999`.
|
|
59
|
-
* - `maxConsecutiveStableFramesToExit` (number): Number of consecutive stable frames with the same number of barcode results to exit scanning. Effective only when `scanningMode` is set to {@link EnumScanningMode.SM_MULTIPLE}, default is `5`.
|
|
60
|
-
*
|
|
61
|
-
* @returns A Promise that resolves with the scan result as a `BarcodeScanResult` object.
|
|
62
|
-
* - If the scan is successful, the Promise resolves with the scan result.
|
|
63
|
-
* - If an error occurs during the scan, the Promise rejects with an error message.
|
|
64
|
-
* - If the user manually exits the scanner, the Promise resolves with `null`.
|
|
65
|
-
*/
|
|
66
|
-
static async launch(config?: BarcodeScanConfig): Promise<BarcodeScanResult> {
|
|
67
|
-
let result: BarcodeScanResult;
|
|
68
|
-
|
|
69
|
-
// Prepare the configuration for the native module
|
|
70
|
-
if (config) {
|
|
71
|
-
let barcodeFormatId = config.barcodeFormats;
|
|
72
|
-
config.barcodeFormats = undefined; // Set BigNumber to undefined for JSON.parse()
|
|
73
|
-
let configTemp: BarcodeScanConfig = JSON.parse(JSON.stringify(config));
|
|
74
|
-
config.barcodeFormats = barcodeFormatId; // Reset to original value
|
|
75
|
-
|
|
76
|
-
// Clear invalid configuration items
|
|
77
|
-
if (config.license && config.license.length === 0) {
|
|
78
|
-
configTemp.license = undefined;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if((!config.templateFile || config.templateFile.replace(/[\s]/g,'').length === 0)) {
|
|
82
|
-
if(config.templateNodeRequire) {
|
|
83
|
-
try {
|
|
84
|
-
configTemp.templateFile = JSON.stringify(config.templateNodeRequire);
|
|
85
|
-
} catch (error) {
|
|
86
|
-
console.error("Failed to stringify templateNodeRequire:", error);
|
|
87
|
-
configTemp.templateFile = undefined;
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
configTemp.templateFile = undefined;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if(configTemp.templateFile && configTemp.templateFile.replace(/[\s]/g,'') === '{}') {
|
|
94
|
-
configTemp.templateFile = undefined;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (barcodeFormatId) {
|
|
98
|
-
configTemp.barcodeFormats = undefined;
|
|
99
|
-
configTemp._barcodeFormatNumberString = barcodeFormatId.toString();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
result = await DynamsoftBarcodeScannerModule.startBarcodeScanner(configTemp);
|
|
103
|
-
} else {
|
|
104
|
-
// Use default configuration to start the barcode scanner activity/view controller
|
|
105
|
-
result = await DynamsoftBarcodeScannerModule.startBarcodeScanner(DefaultConfig);
|
|
106
|
-
}
|
|
107
|
-
if(isIOS) {
|
|
108
|
-
await DynamsoftBarcodeScannerModule.closeBarcodeScanner();
|
|
109
|
-
}
|
|
110
|
-
return result;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EnumResultStatus is an enumeration that defines the result status of the {@link BarcodeScanResult}/{@link MRZScanResult}.
|
|
3
|
-
*
|
|
4
|
-
* If the status is finished, that indicates that the result has been captured and is available.
|
|
5
|
-
* If the status is canceled, that indicates that the operation has been halted.
|
|
6
|
-
* If the result status is exception, then that means that an error has occurred during the scanning process.
|
|
7
|
-
* */
|
|
8
|
-
export enum EnumResultStatus {
|
|
9
|
-
/**
|
|
10
|
-
* The scanning is finished. You can get at least one result from the BarcodeScanResult/MRZScanResult.
|
|
11
|
-
* */
|
|
12
|
-
RS_FINISHED,
|
|
13
|
-
/**
|
|
14
|
-
* The scanning page is closed before the process is finished. No results are available.
|
|
15
|
-
* */
|
|
16
|
-
RS_CANCELED,
|
|
17
|
-
/**
|
|
18
|
-
* Failed to start scanning or an error occurs during the scanning process. No results are available.
|
|
19
|
-
* */
|
|
20
|
-
RS_EXCEPTION
|
|
21
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
export interface MRZScanConfig {
|
|
2
|
-
/**
|
|
3
|
-
* The license key required to initialize the MRZ scanenr.
|
|
4
|
-
*/
|
|
5
|
-
license?: string,
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Determines whether the torch (flashlight) toggle button is visible on the scanning interface.
|
|
9
|
-
* Set to true to allow users to switch the device's flashlight on or off during MRZ scanning.
|
|
10
|
-
*/
|
|
11
|
-
isTorchButtonVisible?: boolean,
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Indicates whether a beep sound is triggered upon a successful MRZ scan.
|
|
15
|
-
* When enabled (true), the scanner will play a sound to provide audible feedback.
|
|
16
|
-
*/
|
|
17
|
-
isBeepEnabled?: boolean,
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Controls the visibility of the close button on the scanner's UI.
|
|
21
|
-
* If true, a close button will be displayed allowing users to exit the MRZ scanning interface.
|
|
22
|
-
*/
|
|
23
|
-
isCloseButtonVisible?: boolean,
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Specifies the type of document to be scanned for MRZ.
|
|
27
|
-
* This property accepts values defined in the EnumDocumentType, such as {@link EnumDocumentType.DT_ALL}, {@link EnumDocumentType.DT_ID}, or {@link EnumDocumentType.DT_PASSPORT}.
|
|
28
|
-
* It helps the scanner to optimize its processing based on the expected document type.
|
|
29
|
-
*
|
|
30
|
-
* @see {@link EnumDocumentType}
|
|
31
|
-
*/
|
|
32
|
-
documentType?: EnumDocumentType,
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Determines whether a guide frame is visible during scanning.
|
|
36
|
-
* The guide frame assists users in properly aligning the document for optimal MRZ detection.
|
|
37
|
-
* When set to true, a visual overlay is displayed on the scanning interface.
|
|
38
|
-
*/
|
|
39
|
-
isGuideFrameVisible?: boolean
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Specifies the template configuration for the MRZ scanner.
|
|
43
|
-
* This can be either a file path or a JSON string that defines various scanning parameters.
|
|
44
|
-
*/
|
|
45
|
-
templateFile?: string,
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Provides a Node.js 'require' function to load the template file when running in a Node environment.
|
|
49
|
-
* This facilitates importing external template configuration files.
|
|
50
|
-
*/
|
|
51
|
-
templateNodeRequire?: NodeRequire,
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export enum EnumDocumentType {
|
|
55
|
-
/**
|
|
56
|
-
* Indicates that all types of documents are acceptable for MRZ scanning.
|
|
57
|
-
*/
|
|
58
|
-
DT_ALL,
|
|
59
|
-
/**
|
|
60
|
-
* Specifies that the document to be scanned is an ID card.
|
|
61
|
-
*/
|
|
62
|
-
DT_ID,
|
|
63
|
-
/**
|
|
64
|
-
* Specifies that the document to be scanned is a passport.
|
|
65
|
-
*/
|
|
66
|
-
DT_PASSPORT,
|
|
67
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import {EnumResultStatus} from "./EnumResultState";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* MRZScanResult contains the parsed MRZ information and the corresponding additional information.
|
|
5
|
-
* */
|
|
6
|
-
export interface MRZScanResult {
|
|
7
|
-
/**
|
|
8
|
-
* The status of the mrz scan result.
|
|
9
|
-
* - {@link EnumResultStatus.RS_FINISHED}: The barcode scanning is finished.
|
|
10
|
-
* - {@link EnumResultStatus.RS_CANCELED}: The barcode scanning activity is closed before the process is finished.
|
|
11
|
-
* - {@link EnumResultStatus.RS_EXCEPTION}: Failed to start barcode scanning or an error occurs when scanning the barcodes.
|
|
12
|
-
* */
|
|
13
|
-
resultStatus: EnumResultStatus,
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Returns the error code when the resultStatus is {@link EnumResultStatus.RS_EXCEPTION}.
|
|
17
|
-
* */
|
|
18
|
-
errorCode?: number,
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Returns the errorString when the resultStatus is {@link EnumResultStatus.RS_EXCEPTION}.
|
|
22
|
-
* */
|
|
23
|
-
errorString?: string,
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The parsed MRZ data.
|
|
27
|
-
* @see MRZDara
|
|
28
|
-
* */
|
|
29
|
-
data?: MRZData
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface MRZData {
|
|
33
|
-
/**
|
|
34
|
-
* The type of document, such as ID cards or passports.
|
|
35
|
-
* */
|
|
36
|
-
documentType?: string,
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The first name and last name of the user of the MRZ document.
|
|
40
|
-
* */
|
|
41
|
-
firstName?: string,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The last name of the user of the MRZ document.
|
|
45
|
-
* */
|
|
46
|
-
lastName?: string,
|
|
47
|
-
/**
|
|
48
|
-
* The sex of the user of the MRZ document.
|
|
49
|
-
* */
|
|
50
|
-
sex?: string,
|
|
51
|
-
/**
|
|
52
|
-
* The issuing state of the MRZ document.
|
|
53
|
-
* */
|
|
54
|
-
issuingState?: string,
|
|
55
|
-
/**
|
|
56
|
-
* The nationality of the user of the MRZ document.
|
|
57
|
-
* */
|
|
58
|
-
nationality?: string,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* The date of birth of the user of the MRZ document.
|
|
62
|
-
* */
|
|
63
|
-
dateOfBirth?: string,
|
|
64
|
-
/**
|
|
65
|
-
* The expiry date of the MRZ document.
|
|
66
|
-
* */
|
|
67
|
-
dateOfExpire?: string,
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* The MRZ document number.
|
|
71
|
-
* */
|
|
72
|
-
documentNumber?: string,
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* The age of the user of the MRZ document.*/
|
|
76
|
-
age?: number,
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* The raw text of the MRZ.
|
|
80
|
-
* */
|
|
81
|
-
mrzText?: string,
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
package/src/rtu/MRZScanner.tsx
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import {NativeModules, Platform} from "react-native";
|
|
2
|
-
import {type MRZScanConfig, EnumDocumentType} from "./MRZScanConfig";
|
|
3
|
-
import type {MRZScanResult} from "./MRZScanResult";
|
|
4
|
-
|
|
5
|
-
// @ts-ignore Check whether __turboModuleProxy exists, it may not
|
|
6
|
-
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
7
|
-
const DynamsoftMRZScannerModule = !isTurboModuleEnabled?
|
|
8
|
-
NativeModules.DynamsoftMRZScannerModule :
|
|
9
|
-
require("./NativeDynamsoftMRZScannerModule").default;
|
|
10
|
-
|
|
11
|
-
const DefaultConfig: MRZScanConfig = {
|
|
12
|
-
isTorchButtonVisible: true,
|
|
13
|
-
isBeepEnabled: false,
|
|
14
|
-
isCloseButtonVisible: true,
|
|
15
|
-
documentType: EnumDocumentType.DT_ALL,
|
|
16
|
-
isGuideFrameVisible: true,
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const isIOS: boolean = Platform.OS === 'ios';
|
|
20
|
-
|
|
21
|
-
export class MRZScanner {
|
|
22
|
-
private constructor() {
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Starts the MRZ (Machine Readable Zone) scanner by launching a new page (Activity on Android or ViewController on iOS).
|
|
27
|
-
*
|
|
28
|
-
* This function initiates the MRZ scanning process by launching a new page dedicated to scanning.
|
|
29
|
-
* It accepts an optional configuration object to customize the scanning behavior. If no configuration
|
|
30
|
-
* is provided, it uses a default configuration. The function returns a Promise that resolves with the
|
|
31
|
-
* scan result or rejects with an error if the scanning process fails.
|
|
32
|
-
*
|
|
33
|
-
* For Android, this function starts an Activity that handles the MRZ scanning. For iOS, it presents
|
|
34
|
-
* a ViewController for the same purpose. After scanning, the function handles the result and closes
|
|
35
|
-
* the scanning page if necessary.
|
|
36
|
-
*
|
|
37
|
-
* @param config (optional) Configuration parameters for the MRZ scanner, including:
|
|
38
|
-
* - `license` (string): Dynamsoft license key. If empty, the license is not set.
|
|
39
|
-
* - `isTorchButtonVisible` (boolean): Whether to display the torch button, default is `true`.
|
|
40
|
-
* - `isBeepEnabled` (boolean): Whether to enable the beep sound on successful scan, default is `false`.
|
|
41
|
-
* - `isCloseButtonVisible` (boolean): Whether to display the close button, default is `true`.
|
|
42
|
-
* - `documentType` ({@link EnumDocumentType}): The type of document to be scanned, default is {@link EnumDocumentType.DT_ALL}.
|
|
43
|
-
* This can be set to specific document types like {@link EnumDocumentType.DT_ID} or {@link EnumDocumentType.DT_PASSPORT} to optimize scanning.
|
|
44
|
-
* - `isGuideFrameVisible` (boolean): Whether to display the guide frame to assist with scanning, default is `true`.
|
|
45
|
-
* - `templateFile` - The content of the template as a json string.
|
|
46
|
-
* - `templateNodeRequire` - The template node require object.
|
|
47
|
-
*
|
|
48
|
-
* @returns A Promise that resolves with the scan result as an `MRZScanResult` object.
|
|
49
|
-
* - If the scan is successful, the Promise resolves with the scan result.
|
|
50
|
-
* - If an error occurs during the scan, the Promise rejects with an error message.
|
|
51
|
-
* - If the user manually exits the scanner, the Promise resolves with `null`.
|
|
52
|
-
*/
|
|
53
|
-
static async launch(config?: MRZScanConfig): Promise<MRZScanResult> {
|
|
54
|
-
let result: MRZScanResult;
|
|
55
|
-
|
|
56
|
-
// Prepare the configuration for the native module
|
|
57
|
-
if (config) {
|
|
58
|
-
let configTemp: MRZScanConfig = JSON.parse(JSON.stringify(config));
|
|
59
|
-
|
|
60
|
-
// Clear invalid configuration items
|
|
61
|
-
if (config.license && config.license.length === 0) {
|
|
62
|
-
configTemp.license = undefined;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if((!config.templateFile || config.templateFile.replace(/[\s]/g,'').length === 0)) {
|
|
66
|
-
if(config.templateNodeRequire) {
|
|
67
|
-
try {
|
|
68
|
-
configTemp.templateFile = JSON.stringify(config.templateNodeRequire);
|
|
69
|
-
} catch (error) {
|
|
70
|
-
console.error("Failed to stringify templateNodeRequire:", error);
|
|
71
|
-
configTemp.templateFile = undefined;
|
|
72
|
-
}
|
|
73
|
-
} else {
|
|
74
|
-
configTemp.templateFile = undefined;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if(configTemp.templateFile && configTemp.templateFile.replace(/[\s]/g,'') === '{}') {
|
|
78
|
-
configTemp.templateFile = undefined;
|
|
79
|
-
}
|
|
80
|
-
result = await DynamsoftMRZScannerModule.startMRZScanner(configTemp);
|
|
81
|
-
} else {
|
|
82
|
-
// Use default configuration to start the MRZ scanner activity/view controller
|
|
83
|
-
result = await DynamsoftMRZScannerModule.startMRZScanner(DefaultConfig);
|
|
84
|
-
}
|
|
85
|
-
if(isIOS) {
|
|
86
|
-
await DynamsoftMRZScannerModule.closeMRZScanner();
|
|
87
|
-
}
|
|
88
|
-
return result;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import {type TurboModule, TurboModuleRegistry } from "react-native";
|
|
2
|
-
export interface Spec extends TurboModule {
|
|
3
|
-
startBarcodeScanner(config:unknown) : Promise<unknown>;
|
|
4
|
-
closeBarcodeScanner() : Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export default TurboModuleRegistry.get<Spec>("DynamsoftBarcodeScannerModule") as Spec | null;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import {type TurboModule, TurboModuleRegistry } from "react-native";
|
|
2
|
-
export interface Spec extends TurboModule {
|
|
3
|
-
startMRZScanner(config:unknown) : Promise<unknown>;
|
|
4
|
-
closeMRZScanner() : Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export default TurboModuleRegistry.get<Spec>("DynamsoftMRZScannerModule") as Spec | null;
|
package/src/rtu/index.tsx
DELETED
|
File without changes
|
/package/android/src/main/{withoutNamespace/AndroidManifest.xml → AndroidManifest_noPackage.xml}
RENAMED
|
File without changes
|
/package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/CameraViewManager.kt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt
RENAMED
|
File without changes
|
/package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt
RENAMED
|
File without changes
|
/package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/ImageManagerModule.kt
RENAMED
|
File without changes
|
|
File without changes
|
/package/android/src/{oldarch → main/java}/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt
RENAMED
|
File without changes
|