@trustchex/react-native-sdk 1.374.0 → 1.409.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/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraView.kt +1 -21
- package/android/src/main/java/com/trustchex/reactnativesdk/mlkit/MLKitModule.kt +1 -1
- package/android/src/main/java/com/trustchex/reactnativesdk/opencv/OpenCVModule.kt +636 -301
- package/ios/Camera/TrustchexCameraView.swift +9 -20
- package/ios/MLKit/MLKitModule.swift +1 -1
- package/ios/OpenCV/OpenCVHelper.h +0 -7
- package/ios/OpenCV/OpenCVHelper.mm +0 -60
- package/ios/OpenCV/OpenCVModule.h +0 -4
- package/ios/OpenCV/OpenCVModule.mm +440 -358
- package/lib/module/Screens/Debug/BarcodeTestScreen.js +308 -0
- package/lib/module/Screens/Debug/MRZTestScreen.js +105 -13
- package/lib/module/Screens/Dynamic/ContractAcceptanceScreen.js +49 -29
- package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +5 -0
- package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +5 -0
- package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +26 -6
- package/lib/module/Screens/Dynamic/VideoCallScreen.js +676 -0
- package/lib/module/Screens/Static/OTPVerificationScreen.js +6 -0
- package/lib/module/Screens/Static/QrCodeScanningScreen.js +7 -1
- package/lib/module/Screens/Static/ResultScreen.js +27 -13
- package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +51 -51
- package/lib/module/Shared/Animations/video-call.json +1 -0
- package/lib/module/Shared/Components/DebugNavigationPanel.js +180 -14
- package/lib/module/Shared/Components/DebugOverlay.js +541 -0
- package/lib/module/Shared/Components/EIDScanner.js +1 -4
- package/lib/module/Shared/Components/IdentityDocumentCamera.constants.js +44 -0
- package/lib/module/Shared/Components/IdentityDocumentCamera.flows.js +270 -0
- package/lib/module/Shared/Components/IdentityDocumentCamera.js +702 -1703
- package/lib/module/Shared/Components/IdentityDocumentCamera.types.js +3 -0
- package/lib/module/Shared/Components/IdentityDocumentCamera.utils.js +273 -0
- package/lib/module/Shared/Components/NavigationManager.js +15 -3
- package/lib/module/Shared/Contexts/AppContext.js +1 -0
- package/lib/module/Shared/Libs/SignalingClient.js +128 -0
- package/lib/module/Shared/Libs/analytics.utils.js +4 -0
- package/lib/module/Shared/Libs/deeplink.utils.js +9 -1
- package/lib/module/Shared/Libs/http-client.js +9 -0
- package/lib/module/Shared/Libs/promise.utils.js +16 -2
- package/lib/module/Shared/Libs/status-bar.utils.js +21 -0
- package/lib/module/Shared/Services/DataUploadService.js +294 -0
- package/lib/module/Shared/Services/VideoSessionService.js +156 -0
- package/lib/module/Shared/Services/WebRTCService.js +510 -0
- package/lib/module/Shared/Types/analytics.types.js +2 -0
- package/lib/module/Translation/Resources/en.js +20 -0
- package/lib/module/Translation/Resources/tr.js +20 -0
- package/lib/module/Trustchex.js +10 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/Screens/Debug/BarcodeTestScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Debug/BarcodeTestScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Debug/MRZTestScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/ContractAcceptanceScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/VideoCallScreen.d.ts +3 -0
- package/lib/typescript/src/Screens/Dynamic/VideoCallScreen.d.ts.map +1 -0
- package/lib/typescript/src/Screens/Static/OTPVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/QrCodeScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/DebugNavigationPanel.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/DebugOverlay.d.ts +30 -0
- package/lib/typescript/src/Shared/Components/DebugOverlay.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.constants.d.ts +35 -0
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.constants.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts +3 -56
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.flows.d.ts +88 -0
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.flows.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.types.d.ts +116 -0
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.types.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.utils.d.ts +93 -0
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Components/NavigationManager.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Contexts/AppContext.d.ts +1 -0
- package/lib/typescript/src/Shared/Contexts/AppContext.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/SignalingClient.d.ts +24 -0
- package/lib/typescript/src/Shared/Libs/SignalingClient.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/analytics.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/deeplink.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/promise.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/status-bar.utils.d.ts +9 -0
- package/lib/typescript/src/Shared/Libs/status-bar.utils.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Services/DataUploadService.d.ts +25 -0
- package/lib/typescript/src/Shared/Services/DataUploadService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Services/VideoSessionService.d.ts +33 -0
- package/lib/typescript/src/Shared/Services/VideoSessionService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Services/WebRTCService.d.ts +58 -0
- package/lib/typescript/src/Shared/Services/WebRTCService.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Types/analytics.types.d.ts +2 -0
- package/lib/typescript/src/Shared/Types/analytics.types.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts +4 -1
- package/lib/typescript/src/Shared/Types/identificationInfo.d.ts.map +1 -1
- package/lib/typescript/src/Translation/Resources/en.d.ts +20 -0
- package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
- package/lib/typescript/src/Translation/Resources/tr.d.ts +20 -0
- package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
- package/lib/typescript/src/Trustchex.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +29 -2
- package/src/Screens/Debug/BarcodeTestScreen.tsx +317 -0
- package/src/Screens/Debug/MRZTestScreen.tsx +107 -13
- package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +59 -33
- package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +6 -0
- package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +6 -0
- package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +34 -6
- package/src/Screens/Dynamic/VideoCallScreen.tsx +764 -0
- package/src/Screens/Static/OTPVerificationScreen.tsx +6 -0
- package/src/Screens/Static/QrCodeScanningScreen.tsx +7 -1
- package/src/Screens/Static/ResultScreen.tsx +58 -23
- package/src/Screens/Static/VerificationSessionCheckScreen.tsx +58 -72
- package/src/Shared/Animations/video-call.json +1 -0
- package/src/Shared/Components/DebugNavigationPanel.tsx +185 -9
- package/src/Shared/Components/DebugOverlay.tsx +656 -0
- package/src/Shared/Components/EIDScanner.tsx +1 -5
- package/src/Shared/Components/IdentityDocumentCamera.constants.ts +44 -0
- package/src/Shared/Components/IdentityDocumentCamera.flows.ts +342 -0
- package/src/Shared/Components/IdentityDocumentCamera.tsx +1089 -2465
- package/src/Shared/Components/IdentityDocumentCamera.types.ts +136 -0
- package/src/Shared/Components/IdentityDocumentCamera.utils.ts +364 -0
- package/src/Shared/Components/NavigationManager.tsx +14 -1
- package/src/Shared/Contexts/AppContext.ts +2 -0
- package/src/Shared/Libs/SignalingClient.ts +189 -0
- package/src/Shared/Libs/analytics.utils.ts +4 -0
- package/src/Shared/Libs/deeplink.utils.ts +12 -1
- package/src/Shared/Libs/http-client.ts +10 -0
- package/src/Shared/Libs/promise.utils.ts +16 -2
- package/src/Shared/Libs/status-bar.utils.ts +19 -0
- package/src/Shared/Services/DataUploadService.ts +395 -0
- package/src/Shared/Services/VideoSessionService.ts +190 -0
- package/src/Shared/Services/WebRTCService.ts +636 -0
- package/src/Shared/Types/analytics.types.ts +2 -0
- package/src/Shared/Types/identificationInfo.ts +5 -1
- package/src/Translation/Resources/en.ts +25 -0
- package/src/Translation/Resources/tr.ts +27 -0
- package/src/Trustchex.tsx +12 -2
- package/src/version.ts +1 -1
|
@@ -33,7 +33,7 @@ class TrustchexCameraView: UIView {
|
|
|
33
33
|
@objc var resolution: String = "fullhd" {
|
|
34
34
|
didSet {
|
|
35
35
|
if resolution != oldValue {
|
|
36
|
-
//
|
|
36
|
+
// "hd" or "fullhd" - reinitialize camera with new resolution
|
|
37
37
|
setupCamera()
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -123,10 +123,10 @@ class TrustchexCameraView: UIView {
|
|
|
123
123
|
let cameraPosition: AVCaptureDevice.Position = (_cameraType == "front") ? .front : .back
|
|
124
124
|
|
|
125
125
|
// Set quality based on resolution setting
|
|
126
|
-
//
|
|
127
|
-
//
|
|
126
|
+
// "hd": 720x1280 (HD) - lower bandwidth, faster processing
|
|
127
|
+
// "fullhd": 1920x1080 (Full HD, default) - sharp text/document capture
|
|
128
128
|
let sessionPreset: AVCaptureSession.Preset
|
|
129
|
-
if resolution.lowercased() ==
|
|
129
|
+
if resolution.lowercased() == "hd" {
|
|
130
130
|
sessionPreset = .hd1280x720
|
|
131
131
|
} else {
|
|
132
132
|
sessionPreset = .hd1920x1080 // Full HD (default)
|
|
@@ -196,19 +196,8 @@ class TrustchexCameraView: UIView {
|
|
|
196
196
|
let supportedTypes = metadataOutput.availableMetadataObjectTypes
|
|
197
197
|
var typesToEnable: [AVMetadataObject.ObjectType] = []
|
|
198
198
|
|
|
199
|
-
if supportedTypes.contains(.pdf417) { typesToEnable.append(.pdf417) }
|
|
200
|
-
if supportedTypes.contains(.qr) { typesToEnable.append(.qr) }
|
|
201
199
|
if supportedTypes.contains(.code128) { typesToEnable.append(.code128) }
|
|
202
|
-
if supportedTypes.contains(.
|
|
203
|
-
if supportedTypes.contains(.code39Mod43) { typesToEnable.append(.code39Mod43) }
|
|
204
|
-
if supportedTypes.contains(.code93) { typesToEnable.append(.code93) }
|
|
205
|
-
if supportedTypes.contains(.ean13) { typesToEnable.append(.ean13) }
|
|
206
|
-
if supportedTypes.contains(.ean8) { typesToEnable.append(.ean8) }
|
|
207
|
-
if supportedTypes.contains(.upce) { typesToEnable.append(.upce) }
|
|
208
|
-
if supportedTypes.contains(.interleaved2of5) { typesToEnable.append(.interleaved2of5) }
|
|
209
|
-
if supportedTypes.contains(.itf14) { typesToEnable.append(.itf14) }
|
|
210
|
-
if supportedTypes.contains(.aztec) { typesToEnable.append(.aztec) }
|
|
211
|
-
if supportedTypes.contains(.dataMatrix) { typesToEnable.append(.dataMatrix) }
|
|
200
|
+
if supportedTypes.contains(.qr) { typesToEnable.append(.qr) }
|
|
212
201
|
|
|
213
202
|
metadataOutput.metadataObjectTypes = typesToEnable
|
|
214
203
|
}
|
|
@@ -422,10 +411,10 @@ class TrustchexCameraView: UIView {
|
|
|
422
411
|
targetFps = fps
|
|
423
412
|
}
|
|
424
413
|
|
|
425
|
-
@objc(
|
|
426
|
-
func
|
|
427
|
-
//
|
|
428
|
-
resolution = res.lowercased() ==
|
|
414
|
+
@objc(changeResolution:)
|
|
415
|
+
func changeResolution(_ res: String) {
|
|
416
|
+
// "hd" (720x1280) or "fullhd" (1920x1080, default)
|
|
417
|
+
resolution = res.lowercased() == "hd" ? "hd" : "fullhd"
|
|
429
418
|
}
|
|
430
419
|
|
|
431
420
|
@objc func setFocusPoint(_ x: NSNumber, _ y: NSNumber) {
|
|
@@ -19,7 +19,7 @@ class MLKitModule: NSObject {
|
|
|
19
19
|
return FaceDetector.faceDetector(options: options)
|
|
20
20
|
}()
|
|
21
21
|
private lazy var barcodeScanner: BarcodeScanner = {
|
|
22
|
-
let formats: BarcodeFormat = [.
|
|
22
|
+
let formats: BarcodeFormat = [.code128, .qrCode]
|
|
23
23
|
let options = BarcodeScannerOptions(formats: formats)
|
|
24
24
|
return BarcodeScanner.barcodeScanner(options: options)
|
|
25
25
|
}()
|
|
@@ -5,13 +5,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
5
5
|
|
|
6
6
|
@interface OpenCVHelper : NSObject
|
|
7
7
|
|
|
8
|
-
/// Preprocesses an image for better OCR text recognition
|
|
9
|
-
/// Applies bilateral filtering, CLAHE, and sharpening to enhance text clarity
|
|
10
|
-
/// @param image The input UIImage to preprocess
|
|
11
|
-
/// @param applyThresholding Whether to apply adaptive thresholding (for binary output)
|
|
12
|
-
/// @return A preprocessed UIImage optimized for text recognition, or nil if preprocessing fails
|
|
13
|
-
+ (UIImage * _Nullable)preprocessImageForOCR:(UIImage *)image applyThresholding:(BOOL)applyThresholding;
|
|
14
|
-
|
|
15
8
|
@end
|
|
16
9
|
|
|
17
10
|
NS_ASSUME_NONNULL_END
|
|
@@ -65,64 +65,4 @@
|
|
|
65
65
|
return image;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
+ (UIImage *)preprocessImageForOCR:(UIImage *)image applyThresholding:(BOOL)applyThresholding {
|
|
69
|
-
@try {
|
|
70
|
-
if (!image) return nil;
|
|
71
|
-
|
|
72
|
-
cv::Mat mat = [self imageToMat:image];
|
|
73
|
-
if (mat.empty()) return nil;
|
|
74
|
-
|
|
75
|
-
// Step 1: Convert to grayscale
|
|
76
|
-
cv::Mat gray;
|
|
77
|
-
cv::cvtColor(mat, gray, cv::COLOR_RGB2GRAY);
|
|
78
|
-
mat.release();
|
|
79
|
-
|
|
80
|
-
// Step 2: Suppress background using blackhat morphology
|
|
81
|
-
cv::Mat blackhat;
|
|
82
|
-
cv::Mat kernel = cv::getStructuringElement(cv::MORPH_RECT, cv::Size(15, 5));
|
|
83
|
-
cv::morphologyEx(gray, blackhat, cv::MORPH_BLACKHAT, kernel);
|
|
84
|
-
gray.release();
|
|
85
|
-
|
|
86
|
-
// Step 3: Advanced denoising - removes artifacts while keeping character details
|
|
87
|
-
cv::Mat denoised;
|
|
88
|
-
cv::fastNlMeansDenoising(blackhat, denoised, 6.0, 7, 21);
|
|
89
|
-
blackhat.release();
|
|
90
|
-
|
|
91
|
-
// Step 4: CLAHE for local contrast without over-amplifying noise
|
|
92
|
-
cv::Ptr<cv::CLAHE> clahe = cv::createCLAHE(2.0, cv::Size(8, 8));
|
|
93
|
-
cv::Mat enhanced;
|
|
94
|
-
clahe->apply(denoised, enhanced);
|
|
95
|
-
denoised.release();
|
|
96
|
-
|
|
97
|
-
// Step 5: Unsharp masking for clearer edges without halos
|
|
98
|
-
cv::Mat blurred;
|
|
99
|
-
cv::GaussianBlur(enhanced, blurred, cv::Size(0, 0), 1.2);
|
|
100
|
-
cv::Mat sharpened;
|
|
101
|
-
cv::addWeighted(enhanced, 1.8, blurred, -0.8, 0, sharpened);
|
|
102
|
-
blurred.release();
|
|
103
|
-
enhanced.release();
|
|
104
|
-
|
|
105
|
-
// Step 6: Normalize to full 0-255 range
|
|
106
|
-
// Ensures maximum contrast for ML Kit
|
|
107
|
-
cv::Mat result;
|
|
108
|
-
cv::normalize(sharpened, result, 0, 255, cv::NORM_MINMAX);
|
|
109
|
-
sharpened.release();
|
|
110
|
-
|
|
111
|
-
if (applyThresholding) {
|
|
112
|
-
cv::Mat thresholded;
|
|
113
|
-
cv::adaptiveThreshold(result, thresholded, 255, cv::ADAPTIVE_THRESH_GAUSSIAN_C, cv::THRESH_BINARY, 31, 10);
|
|
114
|
-
result.release();
|
|
115
|
-
result = thresholded;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
UIImage *resultImage = [self matToImage:result];
|
|
119
|
-
result.release();
|
|
120
|
-
|
|
121
|
-
return resultImage;
|
|
122
|
-
} @catch (NSException *exception) {
|
|
123
|
-
NSLog(@"OpenCV preprocessing error: %@", exception.reason);
|
|
124
|
-
return nil;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
68
|
@end
|
|
@@ -3,8 +3,4 @@
|
|
|
3
3
|
|
|
4
4
|
@interface OpenCVModule : NSObject <RCTBridgeModule>
|
|
5
5
|
|
|
6
|
-
// Synchronous method for preprocessingimage for OCR
|
|
7
|
-
// This is called directly from Swift camera code for better performance
|
|
8
|
-
- (UIImage * _Nullable)preprocessImageForOCRSync:(UIImage * _Nonnull)image applyThresholding:(BOOL)applyThresholding;
|
|
9
|
-
|
|
10
6
|
@end
|