@getyoti/react-native-yoti-face-capture 1.0.0 → 2.0.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/CHANGELOG.md +21 -0
- package/README.md +14 -1
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCaptureView.java +6 -0
- package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCaptureViewManager.java +5 -0
- package/ios/RNYotiFaceCaptureView.m +16 -4
- package/ios/RNYotiFaceCaptureViewManager.m +1 -0
- package/lib/commonjs/RNYotiCapture.android.js +3 -0
- package/lib/commonjs/RNYotiCapture.android.js.map +1 -1
- package/lib/commonjs/RNYotiCapture.ios.js +2 -0
- package/lib/commonjs/RNYotiCapture.ios.js.map +1 -1
- package/lib/commonjs/RNYotiCaptureTypes.js.map +1 -1
- package/lib/module/RNYotiCapture.android.js +3 -0
- package/lib/module/RNYotiCapture.android.js.map +1 -1
- package/lib/module/RNYotiCapture.ios.js +2 -0
- package/lib/module/RNYotiCapture.ios.js.map +1 -1
- package/lib/module/RNYotiCaptureTypes.js.map +1 -1
- package/lib/typescript/RNYotiCapture.android.d.ts +1 -1
- package/lib/typescript/RNYotiCaptureTypes.d.ts +2 -1
- package/package.json +1 -1
- package/react-native-yoti-face-capture.podspec +2 -2
- package/src/RNYotiCapture.android.tsx +5 -0
- package/src/RNYotiCapture.ios.tsx +3 -0
- package/src/RNYotiCaptureTypes.tsx +2 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# ChangeLog
|
|
2
|
+
## Version 2.0.1
|
|
3
|
+
|
|
4
|
+
Contains a couple of bug fixes on the iOS side of the SDK:
|
|
5
|
+
- Solves the discrepancy between the required screen units that needs to be used for Android and iOS. Now, both platforms will be expecting pixels when defining the scanning area.
|
|
6
|
+
- Fixes a crash when the component was used inside of a react-navigation react-stack screen.
|
|
7
|
+
|
|
8
|
+
## Version 2.0.0
|
|
9
|
+
|
|
10
|
+
BREAKING CHANGE: Low light detection
|
|
11
|
+
|
|
12
|
+
New configurable property `requireBrightEnvironment` has been added to the SDK entry point. If it is activated, the SDK will require a bright environment to take the selfie. To migrate from previous versions, it is needed to include this paremeter on the SDK setup.
|
|
13
|
+
Please, check [README.md](https://github.com/getyoti/react-native-yoti-face-capture/blob/main/README.md) for more details.
|
|
14
|
+
|
|
15
|
+
## Version 1.1.0
|
|
16
|
+
|
|
17
|
+
Fix: README.md
|
|
18
|
+
|
|
19
|
+
## Version 1.0.0
|
|
20
|
+
|
|
21
|
+
Face capture first release
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ The library leverages [Google ML Kit](https://firebase.google.com/docs/ml-kit/de
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```sh
|
|
15
|
-
yarn add react-native-yoti-face-capture
|
|
15
|
+
yarn add @getyoti/react-native-yoti-face-capture
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Navigate to your iOS folder and install pods with:
|
|
@@ -106,6 +106,7 @@ function App(){
|
|
|
106
106
|
requireEyesOpen={false}
|
|
107
107
|
requiredStableFrames={3}
|
|
108
108
|
requireValidAngle
|
|
109
|
+
requireBrightEnvironment
|
|
109
110
|
scanningArea={[
|
|
110
111
|
0,
|
|
111
112
|
0,
|
|
@@ -140,6 +141,7 @@ function App(){
|
|
|
140
141
|
* [requireEyesOpen](#requireEyesOpen)
|
|
141
142
|
* [requiredStableFrames](#requiredStableFrame)
|
|
142
143
|
* [requireValidAngle](#requireValidAngle)
|
|
144
|
+
* [requireBrightEnvironment](#requireBrightEnvironment)
|
|
143
145
|
* [scanningArea](#scanningArea)
|
|
144
146
|
* [onFaceCaptureStateChanged](#onFaceCaptureStateChanged)
|
|
145
147
|
* [onFaceCaptureStateFailed](#onFaceCaptureStateFailed)
|
|
@@ -172,6 +174,12 @@ This optional boolean, if true, will require the picture to be taken with a tilt
|
|
|
172
174
|
* **true (default)** - require face to be straight
|
|
173
175
|
* **false** - allow face to not be straight
|
|
174
176
|
|
|
177
|
+
#### requireBrightEnvironment
|
|
178
|
+
This optional boolean, if true, will require the picture to be taken in a bright environment. When this requirement is not met, error `FaceCaptureAnalysisErrorEnvironmentTooDark` is returned.
|
|
179
|
+
* **true (default)** - require bright environment, picture is not taken til the luminosity is good enough
|
|
180
|
+
* **false** - allow the picture to be taken regardless of luminosity
|
|
181
|
+
|
|
182
|
+
|
|
175
183
|
#### scanningArea
|
|
176
184
|
The scanning area is a Rect representing the region in which the face can only be detected. If the face is outside of this region it, will not be considered a valid face.
|
|
177
185
|
The value must be an array of four values to determine the region: `[x, y, width, height]`.
|
|
@@ -217,6 +225,7 @@ A single string value parameter will be supplied to the callback. The value will
|
|
|
217
225
|
- `FaceCaptureAnalysisErrorFaceNotStraight` (depending on configuration)
|
|
218
226
|
- `FaceCaptureAnalysisErrorFaceAnalysisFailed`
|
|
219
227
|
- `FaceCaptureAnalysisErrorMultipleFaces`
|
|
228
|
+
- `FaceCaptureAnalysisErrorEnvironmentTooDark` (depending on configuration)
|
|
220
229
|
|
|
221
230
|
# Troubleshooting
|
|
222
231
|
|
|
@@ -283,3 +292,7 @@ protected List<ReactPackage> getPackages() {
|
|
|
283
292
|
## License
|
|
284
293
|
|
|
285
294
|
MIT
|
|
295
|
+
|
|
296
|
+
## Support
|
|
297
|
+
If you have any other questions please do not hesitate to contact clientsupport@yoti.com.
|
|
298
|
+
Once we have answered your question we may contact you again to discuss Yoti products and services. If you'd prefer us not to do this, please let us know when you e-mail.
|
package/android/build.gradle
CHANGED
|
@@ -12,8 +12,8 @@ android {
|
|
|
12
12
|
defaultConfig {
|
|
13
13
|
minSdkVersion safeExtGet('minSdkVersion', 16)
|
|
14
14
|
targetSdkVersion safeExtGet('targetSdkVersion', 28)
|
|
15
|
-
versionCode
|
|
16
|
-
versionName "
|
|
15
|
+
versionCode 200
|
|
16
|
+
versionName "2.0.0"
|
|
17
17
|
}
|
|
18
18
|
buildTypes {
|
|
19
19
|
release {
|
|
@@ -54,7 +54,7 @@ dependencies {
|
|
|
54
54
|
//noinspection GradleDynamicVersion
|
|
55
55
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
56
56
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:${project.ext.kotlinVersion}"
|
|
57
|
-
implementation 'com.yoti.mobile.android:face-capture-bundled:
|
|
57
|
+
implementation 'com.yoti.mobile.android:face-capture-bundled:3.0.0'
|
|
58
58
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
|
|
59
59
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
|
60
60
|
implementation 'com.google.android.material:material:1.2.1'
|
|
@@ -32,6 +32,7 @@ public class YotiFaceCaptureView extends LinearLayout {
|
|
|
32
32
|
private ImageQuality mImageQuality;
|
|
33
33
|
private boolean mRequireValidAngle;
|
|
34
34
|
private boolean mRequireEyesOpen;
|
|
35
|
+
private boolean mRequireBrightEnvironment = true;
|
|
35
36
|
private int mRequiredStableFrames;
|
|
36
37
|
private ReadableArray mScanningArea;
|
|
37
38
|
private final CameraStateListener mCameraStateListener = new CameraStateListener() {
|
|
@@ -152,6 +153,10 @@ public class YotiFaceCaptureView extends LinearLayout {
|
|
|
152
153
|
mRequiredStableFrames = requiredStableFrames;
|
|
153
154
|
}
|
|
154
155
|
|
|
156
|
+
public void setRequireBrightEnvironment(Boolean requireBrightEnvironment) {
|
|
157
|
+
mRequireBrightEnvironment = requireBrightEnvironment;
|
|
158
|
+
}
|
|
159
|
+
|
|
155
160
|
public void startCamera() {
|
|
156
161
|
mFaceCapture.startCamera((LifecycleOwner) this.context.getCurrentActivity(), mCameraStateListener);
|
|
157
162
|
}
|
|
@@ -173,6 +178,7 @@ public class YotiFaceCaptureView extends LinearLayout {
|
|
|
173
178
|
mImageQuality,
|
|
174
179
|
mRequireValidAngle,
|
|
175
180
|
mRequireEyesOpen,
|
|
181
|
+
mRequireBrightEnvironment,
|
|
176
182
|
mRequiredStableFrames
|
|
177
183
|
);
|
|
178
184
|
mFaceCapture.startAnalysing(configuration, mFaceCaptureListener);
|
package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCaptureViewManager.java
CHANGED
|
@@ -72,4 +72,9 @@ public class YotiFaceCaptureViewManager extends SimpleViewManager<YotiFaceCaptur
|
|
|
72
72
|
public void setRequiredStableFrames(YotiFaceCaptureView view, int requireStableFrames) {
|
|
73
73
|
view.setRequiredStableFrames(requireStableFrames);
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
@ReactProp(name = "requireBrightEnvironment", defaultBoolean = true)
|
|
77
|
+
public void setRequireBrightEnvironment(YotiFaceCaptureView view, boolean requireBrightEnvironment) {
|
|
78
|
+
view.setRequireBrightEnvironment(requireBrightEnvironment);
|
|
79
|
+
}
|
|
75
80
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
7
7
|
{
|
|
8
8
|
self = [super initWithFrame:frame];
|
|
9
|
-
self.rootViewController =
|
|
9
|
+
self.rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
|
|
10
10
|
self.faceCaptureViewController = [FaceCapture faceCaptureViewController];
|
|
11
11
|
self.faceCaptureViewController.delegate = self;
|
|
12
12
|
self.faceCaptureViewController.view.backgroundColor = [UIColor clearColor];
|
|
@@ -53,12 +53,20 @@
|
|
|
53
53
|
[self.faceCaptureConfiguration disableFaceNotStraightValidationOption];
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
-(void)setRequireBrightEnvironment:(BOOL *)requireBrightEnvironment {
|
|
57
|
+
if (requireBrightEnvironment) {
|
|
58
|
+
[self.faceCaptureConfiguration enableEnvironmentLuminosityValidationOption];
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
[self.faceCaptureConfiguration disableEnvironmentLuminosityValidationOption];
|
|
62
|
+
}
|
|
63
|
+
|
|
56
64
|
-(void)setScanningArea:(NSArray *)scanningArea {
|
|
57
65
|
CGRect area = CGRectMake(
|
|
58
66
|
[(NSNumber *)[scanningArea objectAtIndex:0] floatValue],
|
|
59
67
|
[(NSNumber *)[scanningArea objectAtIndex:1] floatValue],
|
|
60
|
-
[(NSNumber *)[scanningArea objectAtIndex:2] floatValue],
|
|
61
|
-
[(NSNumber *)[scanningArea objectAtIndex:3] floatValue]
|
|
68
|
+
[(NSNumber *)[scanningArea objectAtIndex:2] floatValue] / [UIScreen mainScreen].scale,
|
|
69
|
+
[(NSNumber *)[scanningArea objectAtIndex:3] floatValue] / [UIScreen mainScreen].scale
|
|
62
70
|
);
|
|
63
71
|
[self.faceCaptureConfiguration setScanningArea:area];
|
|
64
72
|
}
|
|
@@ -162,7 +170,11 @@
|
|
|
162
170
|
@"originalImage": originalImageBase64,
|
|
163
171
|
@"cause": @"FaceCaptureAnalysisErrorMultipleFaces" });
|
|
164
172
|
break;
|
|
165
|
-
|
|
173
|
+
case FaceCaptureAnalysisErrorEnvironmentTooDark:
|
|
174
|
+
self.onFaceCaptureImageAnalysisFailed(@{
|
|
175
|
+
@"originalImage": originalImageBase64,
|
|
176
|
+
@"cause": @"FaceCaptureAnalysisErrorEnvironmentTooDark" });
|
|
177
|
+
break;
|
|
166
178
|
default:
|
|
167
179
|
self.onFaceCaptureImageAnalysisFailed(@{
|
|
168
180
|
@"originalImage": originalImageBase64,
|
|
@@ -18,6 +18,7 @@ RCT_EXPORT_VIEW_PROPERTY(onFaceCaptureAnalyzedImage, RCTDirectEventBlock)
|
|
|
18
18
|
RCT_EXPORT_VIEW_PROPERTY(onFaceCaptureImageAnalysisFailed, RCTDirectEventBlock)
|
|
19
19
|
RCT_EXPORT_VIEW_PROPERTY(requireEyesOpen, BOOL)
|
|
20
20
|
RCT_EXPORT_VIEW_PROPERTY(requireValidAngle, BOOL)
|
|
21
|
+
RCT_EXPORT_VIEW_PROPERTY(requireBrightEnvironment, BOOL)
|
|
21
22
|
RCT_EXPORT_VIEW_PROPERTY(imageQuality, NSInteger)
|
|
22
23
|
RCT_EXPORT_VIEW_PROPERTY(requiredStableFrames, NSNumber)
|
|
23
24
|
RCT_EXPORT_VIEW_PROPERTY(scanningArea, NSArray)
|
|
@@ -27,6 +27,7 @@ const FACE_CAPTURE_FAILURE_RENAMING = {
|
|
|
27
27
|
NoFaceDetected: 'FaceCaptureAnalysisErrorNoFaceDetected',
|
|
28
28
|
FaceNotCentered: 'FaceCaptureAnalysisErrorFaceNotCentered',
|
|
29
29
|
FaceNotStraight: 'FaceCaptureAnalysisErrorFaceNotStraight',
|
|
30
|
+
EnvironmentTooDark: 'FaceCaptureAnalysisErrorEnvironmentTooDark',
|
|
30
31
|
AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',
|
|
31
32
|
MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces'
|
|
32
33
|
};
|
|
@@ -129,6 +130,7 @@ class RNYotiCapture extends _react.default.Component {
|
|
|
129
130
|
render() {
|
|
130
131
|
const {
|
|
131
132
|
requireEyesOpen = false,
|
|
133
|
+
requireBrightEnvironment = true,
|
|
132
134
|
requireValidAngle = false,
|
|
133
135
|
requiredStableFrames = 3,
|
|
134
136
|
imageQuality = _RNYotiCaptureTypes.IMAGE_QUALITY_MEDIUM,
|
|
@@ -138,6 +140,7 @@ class RNYotiCapture extends _react.default.Component {
|
|
|
138
140
|
requireEyesOpen: requireEyesOpen,
|
|
139
141
|
requireValidAngle: requireValidAngle,
|
|
140
142
|
requiredStableFrames: requiredStableFrames,
|
|
143
|
+
requireBrightEnvironment: requireBrightEnvironment,
|
|
141
144
|
imageQuality: imageQuality,
|
|
142
145
|
scanningArea: scanningArea,
|
|
143
146
|
ref: this._setReference,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RNYotiCapture.android.tsx"],"names":["YotiFaceCaptureView","YotiFaceCaptureModule","NativeModules","FACE_CAPTURE_FAILURE_RENAMING","FaceTooBig","EyesClosed","FaceTooSmall","FaceNotStable","NoFaceDetected","FaceNotCentered","FaceNotStraight","AnalysisError","MultipleFacesDetected","RNYotiCapture","React","Component","constructor","props","ref","_faceCaptureHandle","startAnalyzing","stopAnalyzing","startCamera","stopCamera","onCameraStateChange","cameraState","state","nativeEvent","onFaceCaptureStateChanged","onFaceCaptureStateFailed","onFaceCaptureResult","faceCaptureResult","cause","nativeCause","croppedImage","croppedFaceBoundingBox","faceBoundingBox","originalImage","onFaceCaptureAnalyzedImage","undefined","onFaceCaptureImageAnalysisFailed","render","requireEyesOpen","requireValidAngle","requiredStableFrames","imageQuality","IMAGE_QUALITY_MEDIUM","scanningArea","PixelRatio","getPixelSizeForLayoutSize","_setReference","bind"],"mappings":";;;;;;;AAAA;;AACA;;AAaA;;;;;;;;AAEA,MAAMA,mBAAmB,GACvB,yCAAqD,qBAArD,CADF;AAEA,MAAMC,qBAAqB,GAAGC,2BAAcD,qBAA5C;AAyEA,MAAME,6BAA8C,GAAG;AACrDC,EAAAA,UAAU,EAAE,oCADyC;AAErDC,EAAAA,UAAU,EAAE,qCAFyC;AAGrDC,EAAAA,YAAY,EAAE,sCAHuC;AAIrDC,EAAAA,aAAa,EAAE,uCAJsC;AAKrDC,EAAAA,cAAc,EAAE,wCALqC;AAMrDC,EAAAA,eAAe,EAAE,yCANoC;AAOrDC,EAAAA,eAAe,EAAE,yCAPoC;AAQrDC,EAAAA,aAAa,EAAE,4CARsC;AASrDC,EAAAA,qBAAqB,EAAE;AAT8B,CAAvD;;AAYe,MAAMC,aAAN,SAA4BC,eAAMC,SAAlC,CAA4D;AAGzEC,EAAAA,WAAW,CAACC,KAAD,EAAwB;AACjC,UAAMA,KAAN;;AADiC;;AAAA,2CAKlBC,GAAD,IAAc;AAC5B,UAAIA,GAAJ,EAAS;AACP,aAAKC,kBAAL,GAA0B,iCAAeD,GAAf,CAA1B;AACD,OAFD,MAEO;AACL,aAAKC,kBAAL,GAA0B,IAA1B;AACD;AACF,KAXkC;;AAEjC,SAAKA,kBAAL,GAA0B,IAA1B;AACD;;AAUDC,EAAAA,c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odeHandle,\n PixelRatio,\n requireNativeComponent,\n NativeModules,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\nconst YotiFaceCaptureView =\n requireNativeComponent<NativeFaceCaptureViewAndroid>('YotiFaceCaptureView');\nconst YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n\ntype NativeCaptureResultState = 'ValidFace' | 'InvalidFace';\n\ntype NATIVE_ANALYSIS_FAILURE_CAUSE =\n | 'FaceTooBig'\n | 'EyesClosed'\n | 'FaceTooSmall'\n | 'FaceNotStable'\n | 'NoFaceDetected'\n | 'FaceNotCentered'\n | 'FaceNotStraight'\n | 'AnalysisError'\n | 'MultipleFacesDetected';\n\ntype NativeCaptureResult = {\n nativeEvent: {\n cause?: NATIVE_ANALYSIS_FAILURE_CAUSE;\n croppedImage?: string;\n croppedFaceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage?: string;\n state: NativeCaptureResultState;\n };\n};\n\ntype NativeFaceCaptureSuccessState =\n | 'Analyzing'\n | 'CameraReady'\n | 'CameraStopped';\n\ntype NativeFaceCaptureFailureState =\n | 'CameraInitializationError'\n | 'MissingPermissions';\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: NativeFaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: NativeFaceCaptureFailureState;\n };\n};\n\ninterface NativeFaceCaptureViewAndroid {\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n imageQuality: IMAGE_QUALITY;\n scanningArea: Array<number>;\n onCameraStateChange: (\n faceCaptureState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) => void;\n onFaceCaptureResult: (faceCaptureResult: NativeCaptureResult) => void;\n}\n\ntype FailureRenaming = {\n [Property in NATIVE_ANALYSIS_FAILURE_CAUSE]: ANALYSIS_FAILURE_CAUSE;\n};\n\nconst FACE_CAPTURE_FAILURE_RENAMING: FailureRenaming = {\n FaceTooBig: 'FaceCaptureAnalysisErrorFaceTooBig',\n EyesClosed: 'FaceCaptureAnalysisErrorEyesNotOpen',\n FaceTooSmall: 'FaceCaptureAnalysisErrorFaceTooSmall',\n FaceNotStable: 'FaceCaptureAnalysisErrorFaceNotStable',\n NoFaceDetected: 'FaceCaptureAnalysisErrorNoFaceDetected',\n FaceNotCentered: 'FaceCaptureAnalysisErrorFaceNotCentered',\n FaceNotStraight: 'FaceCaptureAnalysisErrorFaceNotStraight',\n AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',\n MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces',\n};\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n YotiFaceCaptureModule.startAnalyzing(this._faceCaptureHandle);\n }\n\n stopAnalyzing() {\n YotiFaceCaptureModule.stopAnalyzing(this._faceCaptureHandle);\n }\n\n startCamera() {\n YotiFaceCaptureModule.startCamera(this._faceCaptureHandle);\n }\n\n stopCamera() {\n YotiFaceCaptureModule.stopCamera(this._faceCaptureHandle);\n }\n\n onCameraStateChange(\n cameraState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) {\n let state = cameraState.nativeEvent.state;\n\n switch (state) {\n case 'Analyzing':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');\n break;\n\n case 'CameraReady':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraReady');\n break;\n\n case 'CameraStopped':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');\n break;\n\n case 'CameraInitializationError':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraInitializingError'\n );\n break;\n\n case 'MissingPermissions':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraNotAccessible'\n );\n break;\n }\n }\n\n onFaceCaptureResult(faceCaptureResult: NativeCaptureResult) {\n const {\n cause: nativeCause,\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n state,\n } = faceCaptureResult.nativeEvent;\n\n if (\n state === 'ValidFace' &&\n croppedImage != null &&\n croppedFaceBoundingBox != null &&\n faceBoundingBox != null &&\n originalImage != null\n ) {\n this.props.onFaceCaptureAnalyzedImage({\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n });\n return;\n }\n if (nativeCause === undefined || originalImage === undefined) {\n return;\n }\n\n let cause = FACE_CAPTURE_FAILURE_RENAMING[nativeCause];\n if (cause === undefined) {\n cause = 'FaceCaptureAnalysisErrorFaceAnalysisFailed';\n }\n\n this.props.onFaceCaptureImageAnalysisFailed({\n cause,\n originalImage,\n });\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireValidAngle = false,\n requiredStableFrames = 3,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n scanningArea = [\n 0,\n 0,\n PixelRatio.getPixelSizeForLayoutSize(720),\n PixelRatio.getPixelSizeForLayoutSize(1280),\n ],\n } = this.props;\n\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n imageQuality={imageQuality}\n scanningArea={scanningArea}\n ref={this._setReference}\n onCameraStateChange={this.onCameraStateChange.bind(this)}\n onFaceCaptureResult={this.onFaceCaptureResult.bind(this)}\n />\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["RNYotiCapture.android.tsx"],"names":["YotiFaceCaptureView","YotiFaceCaptureModule","NativeModules","FACE_CAPTURE_FAILURE_RENAMING","FaceTooBig","EyesClosed","FaceTooSmall","FaceNotStable","NoFaceDetected","FaceNotCentered","FaceNotStraight","EnvironmentTooDark","AnalysisError","MultipleFacesDetected","RNYotiCapture","React","Component","constructor","props","ref","_faceCaptureHandle","startAnalyzing","stopAnalyzing","startCamera","stopCamera","onCameraStateChange","cameraState","state","nativeEvent","onFaceCaptureStateChanged","onFaceCaptureStateFailed","onFaceCaptureResult","faceCaptureResult","cause","nativeCause","croppedImage","croppedFaceBoundingBox","faceBoundingBox","originalImage","onFaceCaptureAnalyzedImage","undefined","onFaceCaptureImageAnalysisFailed","render","requireEyesOpen","requireBrightEnvironment","requireValidAngle","requiredStableFrames","imageQuality","IMAGE_QUALITY_MEDIUM","scanningArea","PixelRatio","getPixelSizeForLayoutSize","_setReference","bind"],"mappings":";;;;;;;AAAA;;AACA;;AAaA;;;;;;;;AAEA,MAAMA,mBAAmB,GACvB,yCAAqD,qBAArD,CADF;AAEA,MAAMC,qBAAqB,GAAGC,2BAAcD,qBAA5C;AA2EA,MAAME,6BAA8C,GAAG;AACrDC,EAAAA,UAAU,EAAE,oCADyC;AAErDC,EAAAA,UAAU,EAAE,qCAFyC;AAGrDC,EAAAA,YAAY,EAAE,sCAHuC;AAIrDC,EAAAA,aAAa,EAAE,uCAJsC;AAKrDC,EAAAA,cAAc,EAAE,wCALqC;AAMrDC,EAAAA,eAAe,EAAE,yCANoC;AAOrDC,EAAAA,eAAe,EAAE,yCAPoC;AAQrDC,EAAAA,kBAAkB,EAAE,4CARiC;AASrDC,EAAAA,aAAa,EAAE,4CATsC;AAUrDC,EAAAA,qBAAqB,EAAE;AAV8B,CAAvD;;AAae,MAAMC,aAAN,SAA4BC,eAAMC,SAAlC,CAA4D;AAGzEC,EAAAA,WAAW,CAACC,KAAD,EAAwB;AACjC,UAAMA,KAAN;;AADiC;;AAAA,2CAKlBC,GAAD,IAAc;AAC5B,UAAIA,GAAJ,EAAS;AACP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QE,MAAA,GAAG,EAAE,KAAKG,aARZ;AASE,MAAA,mBAAmB,EAAE,KAAK3B,mBAAL,CAAyB4B,IAAzB,CAA8B,IAA9B,CATvB;AAUE,MAAA,mBAAmB,EAAE,KAAKtB,mBAAL,CAAyBsB,IAAzB,CAA8B,IAA9B;AAVvB,OADF;AAcD;;AArIwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n PixelRatio,\n requireNativeComponent,\n NativeModules,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\nconst YotiFaceCaptureView =\n requireNativeComponent<NativeFaceCaptureViewAndroid>('YotiFaceCaptureView');\nconst YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n\ntype NativeCaptureResultState = 'ValidFace' | 'InvalidFace';\n\ntype NATIVE_ANALYSIS_FAILURE_CAUSE =\n | 'FaceTooBig'\n | 'EyesClosed'\n | 'FaceTooSmall'\n | 'FaceNotStable'\n | 'NoFaceDetected'\n | 'FaceNotCentered'\n | 'FaceNotStraight'\n | 'EnvironmentTooDark'\n | 'AnalysisError'\n | 'MultipleFacesDetected';\n\ntype NativeCaptureResult = {\n nativeEvent: {\n cause?: NATIVE_ANALYSIS_FAILURE_CAUSE;\n croppedImage?: string;\n croppedFaceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage?: string;\n state: NativeCaptureResultState;\n };\n};\n\ntype NativeFaceCaptureSuccessState =\n | 'Analyzing'\n | 'CameraReady'\n | 'CameraStopped';\n\ntype NativeFaceCaptureFailureState =\n | 'CameraInitializationError'\n | 'MissingPermissions';\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: NativeFaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: NativeFaceCaptureFailureState;\n };\n};\n\ninterface NativeFaceCaptureViewAndroid {\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: Boolean;\n imageQuality: IMAGE_QUALITY;\n scanningArea: Array<number>;\n onCameraStateChange: (\n faceCaptureState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) => void;\n onFaceCaptureResult: (faceCaptureResult: NativeCaptureResult) => void;\n}\n\ntype FailureRenaming = {\n [Property in NATIVE_ANALYSIS_FAILURE_CAUSE]: ANALYSIS_FAILURE_CAUSE;\n};\n\nconst FACE_CAPTURE_FAILURE_RENAMING: FailureRenaming = {\n FaceTooBig: 'FaceCaptureAnalysisErrorFaceTooBig',\n EyesClosed: 'FaceCaptureAnalysisErrorEyesNotOpen',\n FaceTooSmall: 'FaceCaptureAnalysisErrorFaceTooSmall',\n FaceNotStable: 'FaceCaptureAnalysisErrorFaceNotStable',\n NoFaceDetected: 'FaceCaptureAnalysisErrorNoFaceDetected',\n FaceNotCentered: 'FaceCaptureAnalysisErrorFaceNotCentered',\n FaceNotStraight: 'FaceCaptureAnalysisErrorFaceNotStraight',\n EnvironmentTooDark: 'FaceCaptureAnalysisErrorEnvironmentTooDark',\n AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',\n MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces',\n};\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n YotiFaceCaptureModule.startAnalyzing(this._faceCaptureHandle);\n }\n\n stopAnalyzing() {\n YotiFaceCaptureModule.stopAnalyzing(this._faceCaptureHandle);\n }\n\n startCamera() {\n YotiFaceCaptureModule.startCamera(this._faceCaptureHandle);\n }\n\n stopCamera() {\n YotiFaceCaptureModule.stopCamera(this._faceCaptureHandle);\n }\n\n onCameraStateChange(\n cameraState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) {\n let state = cameraState.nativeEvent.state;\n\n switch (state) {\n case 'Analyzing':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');\n break;\n\n case 'CameraReady':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraReady');\n break;\n\n case 'CameraStopped':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');\n break;\n\n case 'CameraInitializationError':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraInitializingError'\n );\n break;\n\n case 'MissingPermissions':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraNotAccessible'\n );\n break;\n }\n }\n\n onFaceCaptureResult(faceCaptureResult: NativeCaptureResult) {\n const {\n cause: nativeCause,\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n state,\n } = faceCaptureResult.nativeEvent;\n\n if (\n state === 'ValidFace' &&\n croppedImage != null &&\n croppedFaceBoundingBox != null &&\n faceBoundingBox != null &&\n originalImage != null\n ) {\n this.props.onFaceCaptureAnalyzedImage({\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n });\n return;\n }\n if (nativeCause === undefined || originalImage === undefined) {\n return;\n }\n\n let cause = FACE_CAPTURE_FAILURE_RENAMING[nativeCause];\n if (cause === undefined) {\n cause = 'FaceCaptureAnalysisErrorFaceAnalysisFailed';\n }\n\n this.props.onFaceCaptureImageAnalysisFailed({\n cause,\n originalImage,\n });\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireBrightEnvironment = true,\n requireValidAngle = false,\n requiredStableFrames = 3,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n scanningArea = [\n 0,\n 0,\n PixelRatio.getPixelSizeForLayoutSize(720),\n PixelRatio.getPixelSizeForLayoutSize(1280),\n ],\n } = this.props;\n\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n scanningArea={scanningArea}\n ref={this._setReference}\n onCameraStateChange={this.onCameraStateChange.bind(this)}\n onFaceCaptureResult={this.onFaceCaptureResult.bind(this)}\n />\n );\n }\n}\n"]}
|
|
@@ -57,6 +57,7 @@ class RNYotiCapture extends _react.default.Component {
|
|
|
57
57
|
requireEyesOpen = false,
|
|
58
58
|
requireValidAngle = false,
|
|
59
59
|
requiredStableFrames = 3,
|
|
60
|
+
requireBrightEnvironment = true,
|
|
60
61
|
imageQuality = _RNYotiCaptureTypes.IMAGE_QUALITY_MEDIUM,
|
|
61
62
|
scanningArea = [0, 0, _reactNative.PixelRatio.getPixelSizeForLayoutSize(720), _reactNative.PixelRatio.getPixelSizeForLayoutSize(1280)]
|
|
62
63
|
} = this.props;
|
|
@@ -64,6 +65,7 @@ class RNYotiCapture extends _react.default.Component {
|
|
|
64
65
|
requireEyesOpen: requireEyesOpen,
|
|
65
66
|
requireValidAngle: requireValidAngle,
|
|
66
67
|
requiredStableFrames: requiredStableFrames,
|
|
68
|
+
requireBrightEnvironment: requireBrightEnvironment,
|
|
67
69
|
imageQuality: imageQuality,
|
|
68
70
|
scanningArea: scanningArea,
|
|
69
71
|
onFaceCaptureAnalyzedImage: ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RNYotiCapture.ios.tsx"],"names":["YotiFaceCaptureView","RNYotiCapture","React","Component","constructor","props","ref","_faceCaptureHandle","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","startCamera","startAnalyzing","stopAnalyzing","stopCamera","render","requireEyesOpen","requireValidAngle","requiredStableFrames","imageQuality","IMAGE_QUALITY_MEDIUM","scanningArea","PixelRatio","getPixelSizeForLayoutSize","nativeEvent","faceCaptureResult","onFaceCaptureAnalyzedImage","faceCaptureAnalysisFailure","onFaceCaptureImageAnalysisFailed","state","faceCaptureState","onFaceCaptureStateChanged","faceCaptureStateFailure","onFaceCaptureStateFailed","_setReference"],"mappings":";;;;;;;AAAA;;AACA;;AAgBA;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["RNYotiCapture.ios.tsx"],"names":["YotiFaceCaptureView","RNYotiCapture","React","Component","constructor","props","ref","_faceCaptureHandle","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","startCamera","startAnalyzing","stopAnalyzing","stopCamera","render","requireEyesOpen","requireValidAngle","requiredStableFrames","requireBrightEnvironment","imageQuality","IMAGE_QUALITY_MEDIUM","scanningArea","PixelRatio","getPixelSizeForLayoutSize","nativeEvent","faceCaptureResult","onFaceCaptureAnalyzedImage","faceCaptureAnalysisFailure","onFaceCaptureImageAnalysisFailed","state","faceCaptureState","onFaceCaptureStateChanged","faceCaptureStateFailure","onFaceCaptureStateFailed","_setReference"],"mappings":";;;;;;;AAAA;;AACA;;AAgBA;;;;;;;;AA4CA,MAAMA,mBAAmB,GAAG,yCAC1B,qBAD0B,CAA5B;;AAIe,MAAMC,aAAN,SAA4BC,eAAMC,SAAlC,CAA4D;AAGzEC,EAAAA,WAAW,CAACC,KAAD,EAAwB;AACjC,UAAMA,KAAN;;AADiC;;AAAA,2CAKlBC,GAAD,IAAc;AAC5B,UAAIA,GAAJ,EAAS;AACP,aAAKC,kBAAL,GAA0B,iCAAeD,GAAf,CAA1B;AACD,OAFD,MAEO;AACL,aAAKC,kBAAL,GAA0B,IAA1B;AACD;AACF,KAXkC;;AAAA,yCA+Bd,MAAM;AACzBC,6BAAUC,0BAAV,CACE,iCAAe,KAAKF,kBAApB,CADF,EAEEC,uBAAUE,oBAAV,CAA+B,qBAA/B,EAAsDC,QAAtD,CACGC,WAHL,EAIE,EAJF;AAMD,KAtCkC;;AAEjC,SAAKL,kBAAL,GAA0B,IAA1B;AACD;;AAUD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,gCAAgC,EAAE,CAAC;AACjCD,QAAAA,WAAW,EAAEG;AADoB,OAAD,KAGhC,KAAKxB,KAAL,CAAWyB,gCAAX,CACED,0BADF,CAhBJ;AAoBE,MAAA,yBAAyB,EAAE,CAAC;AAC1BH,QAAAA,WAAW,EAAE;AAAEK,UAAAA,KAAK,EAAEC;AAAT;AADa,OAAD,KAGzB,KAAK3B,KAAL,CAAW4B,yBAAX,CAAqCD,gBAArC,CAvBJ;AAyBE,MAAA,wBAAwB,EAAE,CAAC;AACzBN,QAAAA,WAAW,EAAE;AAAEK,UAAAA,KAAK,EAAEG;AAAT;AADY,OAAD,KAGxB,KAAK7B,KAAL,CAAW8B,wBAAX,CAAoCD,uBAApC,CA5BJ;AA8BE,MAAA,GAAG,EAAE,KAAKE;AA9BZ,OADF;AAkCD;;AAnGwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n PixelRatio,\n requireNativeComponent,\n UIManager,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n FaceCaptureResult,\n FaceCaptureSuccessState,\n FaceCaptureFailureState,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\ntype NativeFaceCaptureResult = {\n nativeEvent: FaceCaptureResult;\n};\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: FaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: FaceCaptureFailureState;\n };\n};\n\ntype NativeFaceCaptureAnalysisFailure = {\n nativeEvent: {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n };\n};\n\ninterface NativeFaceCaptureViewIOS {\n imageQuality: IMAGE_QUALITY;\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: boolean;\n scanningArea: Array<number>;\n onFaceCaptureAnalyzedImage: (\n faceCaptureResult: NativeFaceCaptureResult\n ) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: NativeFaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (faceCaptureState: NativeFaceCaptureState) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: NativeFaceCaptureStateFailure\n ) => void;\n}\n\nconst YotiFaceCaptureView = requireNativeComponent<NativeFaceCaptureViewIOS>(\n 'YotiFaceCaptureView'\n);\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startAnalyzing,\n []\n );\n }\n\n stopAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .stopAnalyzing,\n []\n );\n }\n\n public startCamera = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startCamera,\n []\n );\n };\n\n stopCamera() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.stopCamera,\n []\n );\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireValidAngle = false,\n requiredStableFrames = 3,\n requireBrightEnvironment = true,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n scanningArea = [\n 0,\n 0,\n PixelRatio.getPixelSizeForLayoutSize(720),\n PixelRatio.getPixelSizeForLayoutSize(1280),\n ],\n } = this.props;\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n scanningArea={scanningArea}\n onFaceCaptureAnalyzedImage={({\n nativeEvent: faceCaptureResult,\n }: NativeFaceCaptureResult) =>\n this.props.onFaceCaptureAnalyzedImage(faceCaptureResult)\n }\n onFaceCaptureImageAnalysisFailed={({\n nativeEvent: faceCaptureAnalysisFailure,\n }: NativeFaceCaptureAnalysisFailure) =>\n this.props.onFaceCaptureImageAnalysisFailed(\n faceCaptureAnalysisFailure\n )\n }\n onFaceCaptureStateChanged={({\n nativeEvent: { state: faceCaptureState },\n }: NativeFaceCaptureState) =>\n this.props.onFaceCaptureStateChanged(faceCaptureState)\n }\n onFaceCaptureStateFailed={({\n nativeEvent: { state: faceCaptureStateFailure },\n }: NativeFaceCaptureStateFailure) =>\n this.props.onFaceCaptureStateFailed(faceCaptureStateFailure)\n }\n ref={this._setReference}\n />\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RNYotiCaptureTypes.tsx"],"names":["qualityConstants","IMAGE_QUALITY_LOW","IMAGE_QUALITY_MEDIUM","IMAGE_QUALITY_HIGH","Platform","OS","iOSConstants","UIManager","YotiFaceCaptureView","Constants","YotiFaceCaptureModule","NativeModules","androidConstants","getConstants","IMAGE_QUALITY"],"mappings":";;;;;;;AACA;;AAcA,IAAIA,gBAAgB,GAAG;AACrBC,EAAAA,iBAAiB,EAAE,CADE;AAErBC,EAAAA,oBAAoB,EAAE,CAFD;AAGrBC,EAAAA,kBAAkB,EAAE;AAHC,CAAvB;;AAMA,IAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzB,QAAMC,YAA+B,GACnC;AACAC,yBAAUC,mBAAV,CAA8BC,SAFhC;AAGAT,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCK,YAAY,CAACL,iBAAlD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCI,YAAY,CAACJ,oBAArD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCG,YAAY,CAACH,kBAAnD;AACD,CAPD,MAOO;AACL,QAAMO,qBAAqB,GAAGC,2BAAcD,qBAA5C;AACA,QAAME,gBAAmC,GACvCF,qBAAqB,CAACG,YAAtB,EADF;AAEAb,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCW,gBAAgB,CAACX,iBAAtD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCU,gBAAgB,CAACV,oBAAzD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCS,gBAAgB,CAACT,kBAAvD;AACD;;AAEM,IAAIF,iBAAiB,GAAGD,gBAAgB,CAACC,iBAAzC;;AACA,IAAIC,oBAAoB,GAAGF,gBAAgB,CAACE,oBAA5C;;AACA,IAAIC,kBAAkB,GAAGH,gBAAgB,CAACG,kBAA1C;;IAEKW,a;;;WAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a","sourcesContent":["import type { Component } from 'react';\nimport {\n NativeModules,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\ninterface PlatformConstants {\n IMAGE_QUALITY_LOW: number;\n IMAGE_QUALITY_MEDIUM: number;\n IMAGE_QUALITY_HIGH: number;\n}\n\nlet qualityConstants = {\n IMAGE_QUALITY_LOW: 0,\n IMAGE_QUALITY_MEDIUM: 0,\n IMAGE_QUALITY_HIGH: 0,\n};\n\nif (Platform.OS === 'ios') {\n const iOSConstants: PlatformConstants =\n // @ts-ignore UIManagerStatic\n UIManager.YotiFaceCaptureView.Constants;\n qualityConstants.IMAGE_QUALITY_LOW = iOSConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = iOSConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = iOSConstants.IMAGE_QUALITY_HIGH;\n} else {\n const YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n const androidConstants: PlatformConstants =\n YotiFaceCaptureModule.getConstants();\n qualityConstants.IMAGE_QUALITY_LOW = androidConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = androidConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = androidConstants.IMAGE_QUALITY_HIGH;\n}\n\nexport let IMAGE_QUALITY_LOW = qualityConstants.IMAGE_QUALITY_LOW;\nexport let IMAGE_QUALITY_MEDIUM = qualityConstants.IMAGE_QUALITY_MEDIUM;\nexport let IMAGE_QUALITY_HIGH = qualityConstants.IMAGE_QUALITY_HIGH;\n\nexport enum IMAGE_QUALITY {\n IMAGE_QUALITY_HIGH,\n IMAGE_QUALITY_MEDIUM,\n IMAGE_QUALITY_LOW,\n}\n\nexport type FaceCaptureResult = {\n croppedImage: string;\n croppedFaceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage: string;\n};\n\nexport type ANALYSIS_FAILURE_CAUSE =\n | 'FaceCaptureAnalysisErrorFaceTooBig'\n | 'FaceCaptureAnalysisErrorEyesNotOpen'\n | 'FaceCaptureAnalysisErrorFaceTooSmall'\n | 'FaceCaptureAnalysisErrorFaceNotStable'\n | 'FaceCaptureAnalysisErrorNoFaceDetected'\n | 'FaceCaptureAnalysisErrorFaceNotCentered'\n | 'FaceCaptureAnalysisErrorFaceNotStraight'\n | 'FaceCaptureAnalysisErrorFaceAnalysisFailed'\n | 'FaceCaptureAnalysisErrorMultipleFaces';\n\nexport type FaceCaptureAnalysisFailure = {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n};\n\nexport type FaceCaptureSuccessState =\n | 'FaceCaptureStateAnalyzing'\n | 'FaceCaptureStateCameraReady'\n | 'FaceCaptureStateCameraStopped';\n\nexport type FaceCaptureFailureState =\n | 'FaceCaptureStateErrorCameraInitializingError'\n | 'FaceCaptureStateErrorInvalidState'\n | 'FaceCaptureStateErrorCameraNotAccessible';\n\nexport type ComponentProps = {\n requireEyesOpen?: boolean;\n requireValidAngle?: boolean;\n requiredStableFrames?: number;\n imageQuality?: IMAGE_QUALITY;\n scanningArea?: Array<number>;\n onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: FaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (\n faceCaptureState: FaceCaptureSuccessState\n ) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: FaceCaptureFailureState\n ) => void;\n style?: StyleProp<ViewStyle>;\n ref: Component;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["RNYotiCaptureTypes.tsx"],"names":["qualityConstants","IMAGE_QUALITY_LOW","IMAGE_QUALITY_MEDIUM","IMAGE_QUALITY_HIGH","Platform","OS","iOSConstants","UIManager","YotiFaceCaptureView","Constants","YotiFaceCaptureModule","NativeModules","androidConstants","getConstants","IMAGE_QUALITY"],"mappings":";;;;;;;AACA;;AAcA,IAAIA,gBAAgB,GAAG;AACrBC,EAAAA,iBAAiB,EAAE,CADE;AAErBC,EAAAA,oBAAoB,EAAE,CAFD;AAGrBC,EAAAA,kBAAkB,EAAE;AAHC,CAAvB;;AAMA,IAAIC,sBAASC,EAAT,KAAgB,KAApB,EAA2B;AACzB,QAAMC,YAA+B,GACnC;AACAC,yBAAUC,mBAAV,CAA8BC,SAFhC;AAGAT,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCK,YAAY,CAACL,iBAAlD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCI,YAAY,CAACJ,oBAArD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCG,YAAY,CAACH,kBAAnD;AACD,CAPD,MAOO;AACL,QAAMO,qBAAqB,GAAGC,2BAAcD,qBAA5C;AACA,QAAME,gBAAmC,GACvCF,qBAAqB,CAACG,YAAtB,EADF;AAEAb,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCW,gBAAgB,CAACX,iBAAtD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCU,gBAAgB,CAACV,oBAAzD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCS,gBAAgB,CAACT,kBAAvD;AACD;;AAEM,IAAIF,iBAAiB,GAAGD,gBAAgB,CAACC,iBAAzC;;AACA,IAAIC,oBAAoB,GAAGF,gBAAgB,CAACE,oBAA5C;;AACA,IAAIC,kBAAkB,GAAGH,gBAAgB,CAACG,kBAA1C;;IAEKW,a;;;WAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a","sourcesContent":["import type { Component } from 'react';\nimport {\n NativeModules,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\ninterface PlatformConstants {\n IMAGE_QUALITY_LOW: number;\n IMAGE_QUALITY_MEDIUM: number;\n IMAGE_QUALITY_HIGH: number;\n}\n\nlet qualityConstants = {\n IMAGE_QUALITY_LOW: 0,\n IMAGE_QUALITY_MEDIUM: 0,\n IMAGE_QUALITY_HIGH: 0,\n};\n\nif (Platform.OS === 'ios') {\n const iOSConstants: PlatformConstants =\n // @ts-ignore UIManagerStatic\n UIManager.YotiFaceCaptureView.Constants;\n qualityConstants.IMAGE_QUALITY_LOW = iOSConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = iOSConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = iOSConstants.IMAGE_QUALITY_HIGH;\n} else {\n const YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n const androidConstants: PlatformConstants =\n YotiFaceCaptureModule.getConstants();\n qualityConstants.IMAGE_QUALITY_LOW = androidConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = androidConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = androidConstants.IMAGE_QUALITY_HIGH;\n}\n\nexport let IMAGE_QUALITY_LOW = qualityConstants.IMAGE_QUALITY_LOW;\nexport let IMAGE_QUALITY_MEDIUM = qualityConstants.IMAGE_QUALITY_MEDIUM;\nexport let IMAGE_QUALITY_HIGH = qualityConstants.IMAGE_QUALITY_HIGH;\n\nexport enum IMAGE_QUALITY {\n IMAGE_QUALITY_HIGH,\n IMAGE_QUALITY_MEDIUM,\n IMAGE_QUALITY_LOW,\n}\n\nexport type FaceCaptureResult = {\n croppedImage: string;\n croppedFaceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage: string;\n};\n\nexport type ANALYSIS_FAILURE_CAUSE =\n | 'FaceCaptureAnalysisErrorFaceTooBig'\n | 'FaceCaptureAnalysisErrorEyesNotOpen'\n | 'FaceCaptureAnalysisErrorFaceTooSmall'\n | 'FaceCaptureAnalysisErrorFaceNotStable'\n | 'FaceCaptureAnalysisErrorNoFaceDetected'\n | 'FaceCaptureAnalysisErrorFaceNotCentered'\n | 'FaceCaptureAnalysisErrorFaceNotStraight'\n | 'FaceCaptureAnalysisErrorEnvironmentTooDark'\n | 'FaceCaptureAnalysisErrorFaceAnalysisFailed'\n | 'FaceCaptureAnalysisErrorMultipleFaces';\n\nexport type FaceCaptureAnalysisFailure = {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n};\n\nexport type FaceCaptureSuccessState =\n | 'FaceCaptureStateAnalyzing'\n | 'FaceCaptureStateCameraReady'\n | 'FaceCaptureStateCameraStopped';\n\nexport type FaceCaptureFailureState =\n | 'FaceCaptureStateErrorCameraInitializingError'\n | 'FaceCaptureStateErrorInvalidState'\n | 'FaceCaptureStateErrorCameraNotAccessible';\n\nexport type ComponentProps = {\n requireEyesOpen?: boolean;\n requireValidAngle?: boolean;\n requiredStableFrames?: number;\n requireBrightEnvironment?: boolean;\n imageQuality?: IMAGE_QUALITY;\n scanningArea?: Array<number>;\n onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: FaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (\n faceCaptureState: FaceCaptureSuccessState\n ) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: FaceCaptureFailureState\n ) => void;\n style?: StyleProp<ViewStyle>;\n ref: Component;\n};\n"]}
|
|
@@ -15,6 +15,7 @@ const FACE_CAPTURE_FAILURE_RENAMING = {
|
|
|
15
15
|
NoFaceDetected: 'FaceCaptureAnalysisErrorNoFaceDetected',
|
|
16
16
|
FaceNotCentered: 'FaceCaptureAnalysisErrorFaceNotCentered',
|
|
17
17
|
FaceNotStraight: 'FaceCaptureAnalysisErrorFaceNotStraight',
|
|
18
|
+
EnvironmentTooDark: 'FaceCaptureAnalysisErrorEnvironmentTooDark',
|
|
18
19
|
AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',
|
|
19
20
|
MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces'
|
|
20
21
|
};
|
|
@@ -116,6 +117,7 @@ export default class RNYotiCapture extends React.Component {
|
|
|
116
117
|
render() {
|
|
117
118
|
const {
|
|
118
119
|
requireEyesOpen = false,
|
|
120
|
+
requireBrightEnvironment = true,
|
|
119
121
|
requireValidAngle = false,
|
|
120
122
|
requiredStableFrames = 3,
|
|
121
123
|
imageQuality = IMAGE_QUALITY_MEDIUM,
|
|
@@ -125,6 +127,7 @@ export default class RNYotiCapture extends React.Component {
|
|
|
125
127
|
requireEyesOpen: requireEyesOpen,
|
|
126
128
|
requireValidAngle: requireValidAngle,
|
|
127
129
|
requiredStableFrames: requiredStableFrames,
|
|
130
|
+
requireBrightEnvironment: requireBrightEnvironment,
|
|
128
131
|
imageQuality: imageQuality,
|
|
129
132
|
scanningArea: scanningArea,
|
|
130
133
|
ref: this._setReference,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RNYotiCapture.android.tsx"],"names":["React","findNodeHandle","PixelRatio","requireNativeComponent","NativeModules","IMAGE_QUALITY_MEDIUM","YotiFaceCaptureView","YotiFaceCaptureModule","FACE_CAPTURE_FAILURE_RENAMING","FaceTooBig","EyesClosed","FaceTooSmall","FaceNotStable","NoFaceDetected","FaceNotCentered","FaceNotStraight","AnalysisError","MultipleFacesDetected","RNYotiCapture","Component","constructor","props","ref","_faceCaptureHandle","startAnalyzing","stopAnalyzing","startCamera","stopCamera","onCameraStateChange","cameraState","state","nativeEvent","onFaceCaptureStateChanged","onFaceCaptureStateFailed","onFaceCaptureResult","faceCaptureResult","cause","nativeCause","croppedImage","croppedFaceBoundingBox","faceBoundingBox","originalImage","onFaceCaptureAnalyzedImage","undefined","onFaceCaptureImageAnalysisFailed","render","requireEyesOpen","requireValidAngle","requiredStableFrames","imageQuality","scanningArea","getPixelSizeForLayoutSize","_setReference","bind"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,cADF,EAEEC,UAFF,EAGEC,sBAHF,EAIEC,aAJF,QAKO,cALP;AAaA,SAASC,oBAAT,QAAqC,sBAArC;AAEA,MAAMC,mBAAmB,GACvBH,sBAAsB,CAA+B,qBAA/B,CADxB;AAEA,MAAMI,qBAAqB,GAAGH,aAAa,CAACG,qBAA5C;AAyEA,MAAMC,6BAA8C,GAAG;AACrDC,EAAAA,UAAU,EAAE,oCADyC;AAErDC,EAAAA,UAAU,EAAE,qCAFyC;AAGrDC,EAAAA,YAAY,EAAE,sCAHuC;AAIrDC,EAAAA,aAAa,EAAE,uCAJsC;AAKrDC,EAAAA,cAAc,EAAE,wCALqC;AAMrDC,EAAAA,eAAe,EA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,yBAAX,CAAqC,IAArC,CAJa;AALX,QAWF,KAAK9B,KAXT;AAaA,wBACE,oBAAC,mBAAD,eACM,KAAKA,KADX;AAEE,MAAA,eAAe,EAAEyB,eAFnB;AAGE,MAAA,iBAAiB,EAAEC,iBAHrB;AAIE,MAAA,oBAAoB,EAAEC,oBAJxB;AAKE,MAAA,YAAY,EAAEC,YALhB;AAME,MAAA,YAAY,EAAEC,YANhB;AAOE,MAAA,GAAG,EAAE,KAAKE,aAPZ;AAQE,MAAA,mBAAmB,EAAE,KAAKxB,mBAAL,CAAyByB,IAAzB,CAA8B,IAA9B,CARvB;AASE,MAAA,mBAAmB,EAAE,KAAKnB,mBAAL,CAAyBmB,IAAzB,CAA8B,IAA9B;AATvB,OADF;AAaD;;AAnIwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n PixelRatio,\n requireNativeComponent,\n NativeModules,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\nconst YotiFaceCaptureView =\n requireNativeComponent<NativeFaceCaptureViewAndroid>('YotiFaceCaptureView');\nconst YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n\ntype NativeCaptureResultState = 'ValidFace' | 'InvalidFace';\n\ntype NATIVE_ANALYSIS_FAILURE_CAUSE =\n | 'FaceTooBig'\n | 'EyesClosed'\n | 'FaceTooSmall'\n | 'FaceNotStable'\n | 'NoFaceDetected'\n | 'FaceNotCentered'\n | 'FaceNotStraight'\n | 'AnalysisError'\n | 'MultipleFacesDetected';\n\ntype NativeCaptureResult = {\n nativeEvent: {\n cause?: NATIVE_ANALYSIS_FAILURE_CAUSE;\n croppedImage?: string;\n croppedFaceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage?: string;\n state: NativeCaptureResultState;\n };\n};\n\ntype NativeFaceCaptureSuccessState =\n | 'Analyzing'\n | 'CameraReady'\n | 'CameraStopped';\n\ntype NativeFaceCaptureFailureState =\n | 'CameraInitializationError'\n | 'MissingPermissions';\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: NativeFaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: NativeFaceCaptureFailureState;\n };\n};\n\ninterface NativeFaceCaptureViewAndroid {\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n imageQuality: IMAGE_QUALITY;\n scanningArea: Array<number>;\n onCameraStateChange: (\n faceCaptureState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) => void;\n onFaceCaptureResult: (faceCaptureResult: NativeCaptureResult) => void;\n}\n\ntype FailureRenaming = {\n [Property in NATIVE_ANALYSIS_FAILURE_CAUSE]: ANALYSIS_FAILURE_CAUSE;\n};\n\nconst FACE_CAPTURE_FAILURE_RENAMING: FailureRenaming = {\n FaceTooBig: 'FaceCaptureAnalysisErrorFaceTooBig',\n EyesClosed: 'FaceCaptureAnalysisErrorEyesNotOpen',\n FaceTooSmall: 'FaceCaptureAnalysisErrorFaceTooSmall',\n FaceNotStable: 'FaceCaptureAnalysisErrorFaceNotStable',\n NoFaceDetected: 'FaceCaptureAnalysisErrorNoFaceDetected',\n FaceNotCentered: 'FaceCaptureAnalysisErrorFaceNotCentered',\n FaceNotStraight: 'FaceCaptureAnalysisErrorFaceNotStraight',\n AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',\n MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces',\n};\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n YotiFaceCaptureModule.startAnalyzing(this._faceCaptureHandle);\n }\n\n stopAnalyzing() {\n YotiFaceCaptureModule.stopAnalyzing(this._faceCaptureHandle);\n }\n\n startCamera() {\n YotiFaceCaptureModule.startCamera(this._faceCaptureHandle);\n }\n\n stopCamera() {\n YotiFaceCaptureModule.stopCamera(this._faceCaptureHandle);\n }\n\n onCameraStateChange(\n cameraState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) {\n let state = cameraState.nativeEvent.state;\n\n switch (state) {\n case 'Analyzing':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');\n break;\n\n case 'CameraReady':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraReady');\n break;\n\n case 'CameraStopped':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');\n break;\n\n case 'CameraInitializationError':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraInitializingError'\n );\n break;\n\n case 'MissingPermissions':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraNotAccessible'\n );\n break;\n }\n }\n\n onFaceCaptureResult(faceCaptureResult: NativeCaptureResult) {\n const {\n cause: nativeCause,\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n state,\n } = faceCaptureResult.nativeEvent;\n\n if (\n state === 'ValidFace' &&\n croppedImage != null &&\n croppedFaceBoundingBox != null &&\n faceBoundingBox != null &&\n originalImage != null\n ) {\n this.props.onFaceCaptureAnalyzedImage({\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n });\n return;\n }\n if (nativeCause === undefined || originalImage === undefined) {\n return;\n }\n\n let cause = FACE_CAPTURE_FAILURE_RENAMING[nativeCause];\n if (cause === undefined) {\n cause = 'FaceCaptureAnalysisErrorFaceAnalysisFailed';\n }\n\n this.props.onFaceCaptureImageAnalysisFailed({\n cause,\n originalImage,\n });\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireValidAngle = false,\n requiredStableFrames = 3,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n scanningArea = [\n 0,\n 0,\n PixelRatio.getPixelSizeForLayoutSize(720),\n PixelRatio.getPixelSizeForLayoutSize(1280),\n ],\n } = this.props;\n\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n imageQuality={imageQuality}\n scanningArea={scanningArea}\n ref={this._setReference}\n onCameraStateChange={this.onCameraStateChange.bind(this)}\n onFaceCaptureResult={this.onFaceCaptureResult.bind(this)}\n />\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["RNYotiCapture.android.tsx"],"names":["React","findNodeHandle","PixelRatio","requireNativeComponent","NativeModules","IMAGE_QUALITY_MEDIUM","YotiFaceCaptureView","YotiFaceCaptureModule","FACE_CAPTURE_FAILURE_RENAMING","FaceTooBig","EyesClosed","FaceTooSmall","FaceNotStable","NoFaceDetected","FaceNotCentered","FaceNotStraight","EnvironmentTooDark","AnalysisError","MultipleFacesDetected","RNYotiCapture","Component","constructor","props","ref","_faceCaptureHandle","startAnalyzing","stopAnalyzing","startCamera","stopCamera","onCameraStateChange","cameraState","state","nativeEvent","onFaceCaptureStateChanged","onFaceCaptureStateFailed","onFaceCaptureResult","faceCaptureResult","cause","nativeCause","croppedImage","croppedFaceBoundingBox","faceBoundingBox","originalImage","onFaceCaptureAnalyzedImage","undefined","onFaceCaptureImageAnalysisFailed","render","requireEyesOpen","requireBrightEnvironment","requireValidAngle","requiredStableFrames","imageQuality","scanningArea","getPixelSizeForLayoutSize","_setReference","bind"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,cADF,EAEEC,UAFF,EAGEC,sBAHF,EAIEC,aAJF,QAKO,cALP;AAaA,SAASC,oBAAT,QAAqC,sBAArC;AAEA,MAAMC,mBAAmB,GACvBH,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AAAA,KAD0C;AAE1CK,MAAAA;AAF0C,KAA5C;AAID;;AAEDI,EAAAA,MAAM,GAAG;AACP,UAAM;AACJC,MAAAA,eAAe,GAAG,KADd;AAEJC,MAAAA,wBAAwB,GAAG,IAFvB;AAGJC,MAAAA,iBAAiB,GAAG,KAHhB;AAIJC,MAAAA,oBAAoB,GAAG,CAJnB;AAKJC,MAAAA,YAAY,GAAG9C,oBALX;AAMJ+C,MAAAA,YAAY,GAAG,CACb,CADa,EAEb,CAFa,EAGblD,UAAU,CAACmD,yBAAX,CAAqC,GAArC,CAHa,EAIbnD,UAAU,CAACmD,yBAAX,CAAqC,IAArC,CAJa;AANX,QAYF,KAAK/B,KAZT;AAcA,wBACE,oBAAC,mBAAD,eACM,KAAKA,KADX;AAEE,MAAA,eAAe,EAAEyB,eAFnB;AAGE,MAAA,iBAAiB,EAAEE,iBAHrB;AAIE,MAAA,oBAAoB,EAAEC,oBAJxB;AAKE,MAAA,wBAAwB,EAAEF,wBAL5B;AAME,MAAA,YAAY,EAAEG,YANhB;AAOE,MAAA,YAAY,EAAEC,YAPhB;AAQE,MAAA,GAAG,EAAE,KAAKE,aARZ;AASE,MAAA,mBAAmB,EAAE,KAAKzB,mBAAL,CAAyB0B,IAAzB,CAA8B,IAA9B,CATvB;AAUE,MAAA,mBAAmB,EAAE,KAAKpB,mBAAL,CAAyBoB,IAAzB,CAA8B,IAA9B;AAVvB,OADF;AAcD;;AArIwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n PixelRatio,\n requireNativeComponent,\n NativeModules,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\nconst YotiFaceCaptureView =\n requireNativeComponent<NativeFaceCaptureViewAndroid>('YotiFaceCaptureView');\nconst YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n\ntype NativeCaptureResultState = 'ValidFace' | 'InvalidFace';\n\ntype NATIVE_ANALYSIS_FAILURE_CAUSE =\n | 'FaceTooBig'\n | 'EyesClosed'\n | 'FaceTooSmall'\n | 'FaceNotStable'\n | 'NoFaceDetected'\n | 'FaceNotCentered'\n | 'FaceNotStraight'\n | 'EnvironmentTooDark'\n | 'AnalysisError'\n | 'MultipleFacesDetected';\n\ntype NativeCaptureResult = {\n nativeEvent: {\n cause?: NATIVE_ANALYSIS_FAILURE_CAUSE;\n croppedImage?: string;\n croppedFaceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage?: string;\n state: NativeCaptureResultState;\n };\n};\n\ntype NativeFaceCaptureSuccessState =\n | 'Analyzing'\n | 'CameraReady'\n | 'CameraStopped';\n\ntype NativeFaceCaptureFailureState =\n | 'CameraInitializationError'\n | 'MissingPermissions';\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: NativeFaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: NativeFaceCaptureFailureState;\n };\n};\n\ninterface NativeFaceCaptureViewAndroid {\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: Boolean;\n imageQuality: IMAGE_QUALITY;\n scanningArea: Array<number>;\n onCameraStateChange: (\n faceCaptureState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) => void;\n onFaceCaptureResult: (faceCaptureResult: NativeCaptureResult) => void;\n}\n\ntype FailureRenaming = {\n [Property in NATIVE_ANALYSIS_FAILURE_CAUSE]: ANALYSIS_FAILURE_CAUSE;\n};\n\nconst FACE_CAPTURE_FAILURE_RENAMING: FailureRenaming = {\n FaceTooBig: 'FaceCaptureAnalysisErrorFaceTooBig',\n EyesClosed: 'FaceCaptureAnalysisErrorEyesNotOpen',\n FaceTooSmall: 'FaceCaptureAnalysisErrorFaceTooSmall',\n FaceNotStable: 'FaceCaptureAnalysisErrorFaceNotStable',\n NoFaceDetected: 'FaceCaptureAnalysisErrorNoFaceDetected',\n FaceNotCentered: 'FaceCaptureAnalysisErrorFaceNotCentered',\n FaceNotStraight: 'FaceCaptureAnalysisErrorFaceNotStraight',\n EnvironmentTooDark: 'FaceCaptureAnalysisErrorEnvironmentTooDark',\n AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',\n MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces',\n};\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n YotiFaceCaptureModule.startAnalyzing(this._faceCaptureHandle);\n }\n\n stopAnalyzing() {\n YotiFaceCaptureModule.stopAnalyzing(this._faceCaptureHandle);\n }\n\n startCamera() {\n YotiFaceCaptureModule.startCamera(this._faceCaptureHandle);\n }\n\n stopCamera() {\n YotiFaceCaptureModule.stopCamera(this._faceCaptureHandle);\n }\n\n onCameraStateChange(\n cameraState: NativeFaceCaptureState | NativeFaceCaptureStateFailure\n ) {\n let state = cameraState.nativeEvent.state;\n\n switch (state) {\n case 'Analyzing':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');\n break;\n\n case 'CameraReady':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraReady');\n break;\n\n case 'CameraStopped':\n this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');\n break;\n\n case 'CameraInitializationError':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraInitializingError'\n );\n break;\n\n case 'MissingPermissions':\n this.props.onFaceCaptureStateFailed(\n 'FaceCaptureStateErrorCameraNotAccessible'\n );\n break;\n }\n }\n\n onFaceCaptureResult(faceCaptureResult: NativeCaptureResult) {\n const {\n cause: nativeCause,\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n state,\n } = faceCaptureResult.nativeEvent;\n\n if (\n state === 'ValidFace' &&\n croppedImage != null &&\n croppedFaceBoundingBox != null &&\n faceBoundingBox != null &&\n originalImage != null\n ) {\n this.props.onFaceCaptureAnalyzedImage({\n croppedImage,\n croppedFaceBoundingBox,\n faceBoundingBox,\n originalImage,\n });\n return;\n }\n if (nativeCause === undefined || originalImage === undefined) {\n return;\n }\n\n let cause = FACE_CAPTURE_FAILURE_RENAMING[nativeCause];\n if (cause === undefined) {\n cause = 'FaceCaptureAnalysisErrorFaceAnalysisFailed';\n }\n\n this.props.onFaceCaptureImageAnalysisFailed({\n cause,\n originalImage,\n });\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireBrightEnvironment = true,\n requireValidAngle = false,\n requiredStableFrames = 3,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n scanningArea = [\n 0,\n 0,\n PixelRatio.getPixelSizeForLayoutSize(720),\n PixelRatio.getPixelSizeForLayoutSize(1280),\n ],\n } = this.props;\n\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n scanningArea={scanningArea}\n ref={this._setReference}\n onCameraStateChange={this.onCameraStateChange.bind(this)}\n onFaceCaptureResult={this.onFaceCaptureResult.bind(this)}\n />\n );\n }\n}\n"]}
|
|
@@ -44,6 +44,7 @@ export default class RNYotiCapture extends React.Component {
|
|
|
44
44
|
requireEyesOpen = false,
|
|
45
45
|
requireValidAngle = false,
|
|
46
46
|
requiredStableFrames = 3,
|
|
47
|
+
requireBrightEnvironment = true,
|
|
47
48
|
imageQuality = IMAGE_QUALITY_MEDIUM,
|
|
48
49
|
scanningArea = [0, 0, PixelRatio.getPixelSizeForLayoutSize(720), PixelRatio.getPixelSizeForLayoutSize(1280)]
|
|
49
50
|
} = this.props;
|
|
@@ -51,6 +52,7 @@ export default class RNYotiCapture extends React.Component {
|
|
|
51
52
|
requireEyesOpen: requireEyesOpen,
|
|
52
53
|
requireValidAngle: requireValidAngle,
|
|
53
54
|
requiredStableFrames: requiredStableFrames,
|
|
55
|
+
requireBrightEnvironment: requireBrightEnvironment,
|
|
54
56
|
imageQuality: imageQuality,
|
|
55
57
|
scanningArea: scanningArea,
|
|
56
58
|
onFaceCaptureAnalyzedImage: ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RNYotiCapture.ios.tsx"],"names":["React","findNodeHandle","PixelRatio","requireNativeComponent","UIManager","IMAGE_QUALITY_MEDIUM","YotiFaceCaptureView","RNYotiCapture","Component","constructor","props","ref","_faceCaptureHandle","dispatchViewManagerCommand","getViewManagerConfig","Commands","startCamera","startAnalyzing","stopAnalyzing","stopCamera","render","requireEyesOpen","requireValidAngle","requiredStableFrames","imageQuality","scanningArea","getPixelSizeForLayoutSize","nativeEvent","faceCaptureResult","onFaceCaptureAnalyzedImage","faceCaptureAnalysisFailure","onFaceCaptureImageAnalysisFailed","state","faceCaptureState","onFaceCaptureStateChanged","faceCaptureStateFailure","onFaceCaptureStateFailed","_setReference"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,cADF,EAEEC,UAFF,EAGEC,sBAHF,EAIEC,SAJF,QAKO,cALP;AAgBA,SAASC,oBAAT,QAAqC,sBAArC;
|
|
1
|
+
{"version":3,"sources":["RNYotiCapture.ios.tsx"],"names":["React","findNodeHandle","PixelRatio","requireNativeComponent","UIManager","IMAGE_QUALITY_MEDIUM","YotiFaceCaptureView","RNYotiCapture","Component","constructor","props","ref","_faceCaptureHandle","dispatchViewManagerCommand","getViewManagerConfig","Commands","startCamera","startAnalyzing","stopAnalyzing","stopCamera","render","requireEyesOpen","requireValidAngle","requiredStableFrames","requireBrightEnvironment","imageQuality","scanningArea","getPixelSizeForLayoutSize","nativeEvent","faceCaptureResult","onFaceCaptureAnalyzedImage","faceCaptureAnalysisFailure","onFaceCaptureImageAnalysisFailed","state","faceCaptureState","onFaceCaptureStateChanged","faceCaptureStateFailure","onFaceCaptureStateFailed","_setReference"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,cADF,EAEEC,UAFF,EAGEC,sBAHF,EAIEC,SAJF,QAKO,cALP;AAgBA,SAASC,oBAAT,QAAqC,sBAArC;AA4CA,MAAMC,mBAAmB,GAAGH,sBAAsB,CAChD,qBADgD,CAAlD;AAIA,eAAe,MAAMI,aAAN,SAA4BP,KAAK,CAACQ,SAAlC,CAA4D;AAGzEC,EAAAA,WAAW,CAACC,KAAD,EAAwB;AACjC,UAAMA,KAAN;;AADiC;;AAAA,2CAKlBC,GAAD,IAAc;AAC5B,UAAIA,GAAJ,EAAS;AACP,aAAKC,kBAAL,GAA0BX,cAAc,CAACU,GAAD,CAAxC;AACD,OAFD,MAEO;AACL,aAAKC,kBAAL,GAA0B,IAA1B;AACD;AACF,KAXkC;;AAAA,yCA+Bd,MAAM;AACzBR,MAAAA,SAAS,CAACS,0BAAV,CACEZ,cAAc,CAAC,KAAKW,kBAAN,CADhB,EAEER,SAAS,CAACU,oBAAV,CAA+B,qBAA/B,EAAsDC,QAAtD,CACGC,WAHL,EAIE,EAJF;AAMD,KAtCkC;;AAEjC,SAAKJ,kBAAL,GAA0B,IAA1B;AACD;;AAUDK,EAAAA,cAAc,GAAG;AACfb,IAAAA,SAAS,CAACS,0BAAV,CACEZ,cAAc,CAAC,IAAD,CADhB,EAEEG,SAAS,CAACU,oBAAV,CAA+B,qBAA/B,EAAsDC,QAAtD,CACGE,cAHL,EAIE,EAJF;AAMD;;AAEDC,EAAAA,aAAa,GAAG;AACdd,IAAAA,SAAS,CAACS,0BAAV,CACEZ,cAAc,CAAC,IAAD,CADhB,EAEEG,SAAS,CAACU,oBAAV,C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AAT;AADa,OAAD,KAGzB,KAAKxB,KAAL,CAAWyB,yBAAX,CAAqCD,gBAArC,CAvBJ;AAyBE,MAAA,wBAAwB,EAAE,CAAC;AACzBN,QAAAA,WAAW,EAAE;AAAEK,UAAAA,KAAK,EAAEG;AAAT;AADY,OAAD,KAGxB,KAAK1B,KAAL,CAAW2B,wBAAX,CAAoCD,uBAApC,CA5BJ;AA8BE,MAAA,GAAG,EAAE,KAAKE;AA9BZ,OADF;AAkCD;;AAnGwE","sourcesContent":["import React from 'react';\nimport {\n findNodeHandle,\n PixelRatio,\n requireNativeComponent,\n UIManager,\n} from 'react-native';\n\nimport type {\n ANALYSIS_FAILURE_CAUSE,\n ComponentProps,\n FaceCaptureResult,\n FaceCaptureSuccessState,\n FaceCaptureFailureState,\n IMAGE_QUALITY,\n} from './RNYotiCaptureTypes';\n\nimport { IMAGE_QUALITY_MEDIUM } from './RNYotiCaptureTypes';\n\ntype NativeFaceCaptureResult = {\n nativeEvent: FaceCaptureResult;\n};\n\ntype NativeFaceCaptureState = {\n nativeEvent: {\n state: FaceCaptureSuccessState;\n };\n};\n\ntype NativeFaceCaptureStateFailure = {\n nativeEvent: {\n state: FaceCaptureFailureState;\n };\n};\n\ntype NativeFaceCaptureAnalysisFailure = {\n nativeEvent: {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n };\n};\n\ninterface NativeFaceCaptureViewIOS {\n imageQuality: IMAGE_QUALITY;\n requireEyesOpen: boolean;\n requireValidAngle: boolean;\n requiredStableFrames: number;\n requireBrightEnvironment: boolean;\n scanningArea: Array<number>;\n onFaceCaptureAnalyzedImage: (\n faceCaptureResult: NativeFaceCaptureResult\n ) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: NativeFaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (faceCaptureState: NativeFaceCaptureState) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: NativeFaceCaptureStateFailure\n ) => void;\n}\n\nconst YotiFaceCaptureView = requireNativeComponent<NativeFaceCaptureViewIOS>(\n 'YotiFaceCaptureView'\n);\n\nexport default class RNYotiCapture extends React.Component<ComponentProps> {\n _faceCaptureHandle: number | null;\n\n constructor(props: ComponentProps) {\n super(props);\n this._faceCaptureHandle = null;\n }\n\n _setReference = (ref: any) => {\n if (ref) {\n this._faceCaptureHandle = findNodeHandle(ref);\n } else {\n this._faceCaptureHandle = null;\n }\n };\n\n startAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startAnalyzing,\n []\n );\n }\n\n stopAnalyzing() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .stopAnalyzing,\n []\n );\n }\n\n public startCamera = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands\n .startCamera,\n []\n );\n };\n\n stopCamera() {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(this._faceCaptureHandle),\n UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.stopCamera,\n []\n );\n }\n\n render() {\n const {\n requireEyesOpen = false,\n requireValidAngle = false,\n requiredStableFrames = 3,\n requireBrightEnvironment = true,\n imageQuality = IMAGE_QUALITY_MEDIUM,\n scanningArea = [\n 0,\n 0,\n PixelRatio.getPixelSizeForLayoutSize(720),\n PixelRatio.getPixelSizeForLayoutSize(1280),\n ],\n } = this.props;\n return (\n <YotiFaceCaptureView\n {...this.props}\n requireEyesOpen={requireEyesOpen}\n requireValidAngle={requireValidAngle}\n requiredStableFrames={requiredStableFrames}\n requireBrightEnvironment={requireBrightEnvironment}\n imageQuality={imageQuality}\n scanningArea={scanningArea}\n onFaceCaptureAnalyzedImage={({\n nativeEvent: faceCaptureResult,\n }: NativeFaceCaptureResult) =>\n this.props.onFaceCaptureAnalyzedImage(faceCaptureResult)\n }\n onFaceCaptureImageAnalysisFailed={({\n nativeEvent: faceCaptureAnalysisFailure,\n }: NativeFaceCaptureAnalysisFailure) =>\n this.props.onFaceCaptureImageAnalysisFailed(\n faceCaptureAnalysisFailure\n )\n }\n onFaceCaptureStateChanged={({\n nativeEvent: { state: faceCaptureState },\n }: NativeFaceCaptureState) =>\n this.props.onFaceCaptureStateChanged(faceCaptureState)\n }\n onFaceCaptureStateFailed={({\n nativeEvent: { state: faceCaptureStateFailure },\n }: NativeFaceCaptureStateFailure) =>\n this.props.onFaceCaptureStateFailed(faceCaptureStateFailure)\n }\n ref={this._setReference}\n />\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RNYotiCaptureTypes.tsx"],"names":["NativeModules","Platform","UIManager","qualityConstants","IMAGE_QUALITY_LOW","IMAGE_QUALITY_MEDIUM","IMAGE_QUALITY_HIGH","OS","iOSConstants","YotiFaceCaptureView","Constants","YotiFaceCaptureModule","androidConstants","getConstants","IMAGE_QUALITY"],"mappings":"AACA,SACEA,aADF,EAEEC,QAFF,EAIEC,SAJF,QAMO,cANP;AAcA,IAAIC,gBAAgB,GAAG;AACrBC,EAAAA,iBAAiB,EAAE,CADE;AAErBC,EAAAA,oBAAoB,EAAE,CAFD;AAGrBC,EAAAA,kBAAkB,EAAE;AAHC,CAAvB;;AAMA,IAAIL,QAAQ,CAACM,EAAT,KAAgB,KAApB,EAA2B;AACzB,QAAMC,YAA+B,GACnC;AACAN,EAAAA,SAAS,CAACO,mBAAV,CAA8BC,SAFhC;AAGAP,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCI,YAAY,CAACJ,iBAAlD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCG,YAAY,CAACH,oBAArD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCE,YAAY,CAACF,kBAAnD;AACD,CAPD,MAOO;AACL,QAAMK,qBAAqB,GAAGX,aAAa,CAACW,qBAA5C;AACA,QAAMC,gBAAmC,GACvCD,qBAAqB,CAACE,YAAtB,EADF;AAEAV,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCQ,gBAAgB,CAACR,iBAAtD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCO,gBAAgB,CAACP,oBAAzD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCM,gBAAgB,CAACN,kBAAvD;AACD;;AAED,OAAO,IAAIF,iBAAiB,GAAGD,gBAAgB,CAACC,iBAAzC;AACP,OAAO,IAAIC,oBAAoB,GAAGF,gBAAgB,CAACE,oBAA5C;AACP,OAAO,IAAIC,kBAAkB,GAAGH,gBAAgB,CAACG,kBAA1C;AAEP,WAAYQ,aAAZ;;WAAYA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,KAAAA,a","sourcesContent":["import type { Component } from 'react';\nimport {\n NativeModules,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\ninterface PlatformConstants {\n IMAGE_QUALITY_LOW: number;\n IMAGE_QUALITY_MEDIUM: number;\n IMAGE_QUALITY_HIGH: number;\n}\n\nlet qualityConstants = {\n IMAGE_QUALITY_LOW: 0,\n IMAGE_QUALITY_MEDIUM: 0,\n IMAGE_QUALITY_HIGH: 0,\n};\n\nif (Platform.OS === 'ios') {\n const iOSConstants: PlatformConstants =\n // @ts-ignore UIManagerStatic\n UIManager.YotiFaceCaptureView.Constants;\n qualityConstants.IMAGE_QUALITY_LOW = iOSConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = iOSConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = iOSConstants.IMAGE_QUALITY_HIGH;\n} else {\n const YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n const androidConstants: PlatformConstants =\n YotiFaceCaptureModule.getConstants();\n qualityConstants.IMAGE_QUALITY_LOW = androidConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = androidConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = androidConstants.IMAGE_QUALITY_HIGH;\n}\n\nexport let IMAGE_QUALITY_LOW = qualityConstants.IMAGE_QUALITY_LOW;\nexport let IMAGE_QUALITY_MEDIUM = qualityConstants.IMAGE_QUALITY_MEDIUM;\nexport let IMAGE_QUALITY_HIGH = qualityConstants.IMAGE_QUALITY_HIGH;\n\nexport enum IMAGE_QUALITY {\n IMAGE_QUALITY_HIGH,\n IMAGE_QUALITY_MEDIUM,\n IMAGE_QUALITY_LOW,\n}\n\nexport type FaceCaptureResult = {\n croppedImage: string;\n croppedFaceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage: string;\n};\n\nexport type ANALYSIS_FAILURE_CAUSE =\n | 'FaceCaptureAnalysisErrorFaceTooBig'\n | 'FaceCaptureAnalysisErrorEyesNotOpen'\n | 'FaceCaptureAnalysisErrorFaceTooSmall'\n | 'FaceCaptureAnalysisErrorFaceNotStable'\n | 'FaceCaptureAnalysisErrorNoFaceDetected'\n | 'FaceCaptureAnalysisErrorFaceNotCentered'\n | 'FaceCaptureAnalysisErrorFaceNotStraight'\n | 'FaceCaptureAnalysisErrorFaceAnalysisFailed'\n | 'FaceCaptureAnalysisErrorMultipleFaces';\n\nexport type FaceCaptureAnalysisFailure = {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n};\n\nexport type FaceCaptureSuccessState =\n | 'FaceCaptureStateAnalyzing'\n | 'FaceCaptureStateCameraReady'\n | 'FaceCaptureStateCameraStopped';\n\nexport type FaceCaptureFailureState =\n | 'FaceCaptureStateErrorCameraInitializingError'\n | 'FaceCaptureStateErrorInvalidState'\n | 'FaceCaptureStateErrorCameraNotAccessible';\n\nexport type ComponentProps = {\n requireEyesOpen?: boolean;\n requireValidAngle?: boolean;\n requiredStableFrames?: number;\n imageQuality?: IMAGE_QUALITY;\n scanningArea?: Array<number>;\n onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: FaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (\n faceCaptureState: FaceCaptureSuccessState\n ) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: FaceCaptureFailureState\n ) => void;\n style?: StyleProp<ViewStyle>;\n ref: Component;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["RNYotiCaptureTypes.tsx"],"names":["NativeModules","Platform","UIManager","qualityConstants","IMAGE_QUALITY_LOW","IMAGE_QUALITY_MEDIUM","IMAGE_QUALITY_HIGH","OS","iOSConstants","YotiFaceCaptureView","Constants","YotiFaceCaptureModule","androidConstants","getConstants","IMAGE_QUALITY"],"mappings":"AACA,SACEA,aADF,EAEEC,QAFF,EAIEC,SAJF,QAMO,cANP;AAcA,IAAIC,gBAAgB,GAAG;AACrBC,EAAAA,iBAAiB,EAAE,CADE;AAErBC,EAAAA,oBAAoB,EAAE,CAFD;AAGrBC,EAAAA,kBAAkB,EAAE;AAHC,CAAvB;;AAMA,IAAIL,QAAQ,CAACM,EAAT,KAAgB,KAApB,EAA2B;AACzB,QAAMC,YAA+B,GACnC;AACAN,EAAAA,SAAS,CAACO,mBAAV,CAA8BC,SAFhC;AAGAP,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCI,YAAY,CAACJ,iBAAlD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCG,YAAY,CAACH,oBAArD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCE,YAAY,CAACF,kBAAnD;AACD,CAPD,MAOO;AACL,QAAMK,qBAAqB,GAAGX,aAAa,CAACW,qBAA5C;AACA,QAAMC,gBAAmC,GACvCD,qBAAqB,CAACE,YAAtB,EADF;AAEAV,EAAAA,gBAAgB,CAACC,iBAAjB,GAAqCQ,gBAAgB,CAACR,iBAAtD;AACAD,EAAAA,gBAAgB,CAACE,oBAAjB,GAAwCO,gBAAgB,CAACP,oBAAzD;AACAF,EAAAA,gBAAgB,CAACG,kBAAjB,GAAsCM,gBAAgB,CAACN,kBAAvD;AACD;;AAED,OAAO,IAAIF,iBAAiB,GAAGD,gBAAgB,CAACC,iBAAzC;AACP,OAAO,IAAIC,oBAAoB,GAAGF,gBAAgB,CAACE,oBAA5C;AACP,OAAO,IAAIC,kBAAkB,GAAGH,gBAAgB,CAACG,kBAA1C;AAEP,WAAYQ,aAAZ;;WAAYA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,KAAAA,a","sourcesContent":["import type { Component } from 'react';\nimport {\n NativeModules,\n Platform,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\ninterface PlatformConstants {\n IMAGE_QUALITY_LOW: number;\n IMAGE_QUALITY_MEDIUM: number;\n IMAGE_QUALITY_HIGH: number;\n}\n\nlet qualityConstants = {\n IMAGE_QUALITY_LOW: 0,\n IMAGE_QUALITY_MEDIUM: 0,\n IMAGE_QUALITY_HIGH: 0,\n};\n\nif (Platform.OS === 'ios') {\n const iOSConstants: PlatformConstants =\n // @ts-ignore UIManagerStatic\n UIManager.YotiFaceCaptureView.Constants;\n qualityConstants.IMAGE_QUALITY_LOW = iOSConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = iOSConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = iOSConstants.IMAGE_QUALITY_HIGH;\n} else {\n const YotiFaceCaptureModule = NativeModules.YotiFaceCaptureModule;\n const androidConstants: PlatformConstants =\n YotiFaceCaptureModule.getConstants();\n qualityConstants.IMAGE_QUALITY_LOW = androidConstants.IMAGE_QUALITY_LOW;\n qualityConstants.IMAGE_QUALITY_MEDIUM = androidConstants.IMAGE_QUALITY_MEDIUM;\n qualityConstants.IMAGE_QUALITY_HIGH = androidConstants.IMAGE_QUALITY_HIGH;\n}\n\nexport let IMAGE_QUALITY_LOW = qualityConstants.IMAGE_QUALITY_LOW;\nexport let IMAGE_QUALITY_MEDIUM = qualityConstants.IMAGE_QUALITY_MEDIUM;\nexport let IMAGE_QUALITY_HIGH = qualityConstants.IMAGE_QUALITY_HIGH;\n\nexport enum IMAGE_QUALITY {\n IMAGE_QUALITY_HIGH,\n IMAGE_QUALITY_MEDIUM,\n IMAGE_QUALITY_LOW,\n}\n\nexport type FaceCaptureResult = {\n croppedImage: string;\n croppedFaceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n faceBoundingBox: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n originalImage: string;\n};\n\nexport type ANALYSIS_FAILURE_CAUSE =\n | 'FaceCaptureAnalysisErrorFaceTooBig'\n | 'FaceCaptureAnalysisErrorEyesNotOpen'\n | 'FaceCaptureAnalysisErrorFaceTooSmall'\n | 'FaceCaptureAnalysisErrorFaceNotStable'\n | 'FaceCaptureAnalysisErrorNoFaceDetected'\n | 'FaceCaptureAnalysisErrorFaceNotCentered'\n | 'FaceCaptureAnalysisErrorFaceNotStraight'\n | 'FaceCaptureAnalysisErrorEnvironmentTooDark'\n | 'FaceCaptureAnalysisErrorFaceAnalysisFailed'\n | 'FaceCaptureAnalysisErrorMultipleFaces';\n\nexport type FaceCaptureAnalysisFailure = {\n cause: ANALYSIS_FAILURE_CAUSE;\n originalImage: string;\n};\n\nexport type FaceCaptureSuccessState =\n | 'FaceCaptureStateAnalyzing'\n | 'FaceCaptureStateCameraReady'\n | 'FaceCaptureStateCameraStopped';\n\nexport type FaceCaptureFailureState =\n | 'FaceCaptureStateErrorCameraInitializingError'\n | 'FaceCaptureStateErrorInvalidState'\n | 'FaceCaptureStateErrorCameraNotAccessible';\n\nexport type ComponentProps = {\n requireEyesOpen?: boolean;\n requireValidAngle?: boolean;\n requiredStableFrames?: number;\n requireBrightEnvironment?: boolean;\n imageQuality?: IMAGE_QUALITY;\n scanningArea?: Array<number>;\n onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;\n onFaceCaptureImageAnalysisFailed: (\n faceCaptureAnalysisFailure: FaceCaptureAnalysisFailure\n ) => void;\n onFaceCaptureStateChanged: (\n faceCaptureState: FaceCaptureSuccessState\n ) => void;\n onFaceCaptureStateFailed: (\n faceCaptureStateFailure: FaceCaptureFailureState\n ) => void;\n style?: StyleProp<ViewStyle>;\n ref: Component;\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ComponentProps } from './RNYotiCaptureTypes';
|
|
3
3
|
declare type NativeCaptureResultState = 'ValidFace' | 'InvalidFace';
|
|
4
|
-
declare type NATIVE_ANALYSIS_FAILURE_CAUSE = 'FaceTooBig' | 'EyesClosed' | 'FaceTooSmall' | 'FaceNotStable' | 'NoFaceDetected' | 'FaceNotCentered' | 'FaceNotStraight' | 'AnalysisError' | 'MultipleFacesDetected';
|
|
4
|
+
declare type NATIVE_ANALYSIS_FAILURE_CAUSE = 'FaceTooBig' | 'EyesClosed' | 'FaceTooSmall' | 'FaceNotStable' | 'NoFaceDetected' | 'FaceNotCentered' | 'FaceNotStraight' | 'EnvironmentTooDark' | 'AnalysisError' | 'MultipleFacesDetected';
|
|
5
5
|
declare type NativeCaptureResult = {
|
|
6
6
|
nativeEvent: {
|
|
7
7
|
cause?: NATIVE_ANALYSIS_FAILURE_CAUSE;
|
|
@@ -24,7 +24,7 @@ export declare type FaceCaptureResult = {
|
|
|
24
24
|
};
|
|
25
25
|
originalImage: string;
|
|
26
26
|
};
|
|
27
|
-
export declare type ANALYSIS_FAILURE_CAUSE = 'FaceCaptureAnalysisErrorFaceTooBig' | 'FaceCaptureAnalysisErrorEyesNotOpen' | 'FaceCaptureAnalysisErrorFaceTooSmall' | 'FaceCaptureAnalysisErrorFaceNotStable' | 'FaceCaptureAnalysisErrorNoFaceDetected' | 'FaceCaptureAnalysisErrorFaceNotCentered' | 'FaceCaptureAnalysisErrorFaceNotStraight' | 'FaceCaptureAnalysisErrorFaceAnalysisFailed' | 'FaceCaptureAnalysisErrorMultipleFaces';
|
|
27
|
+
export declare type ANALYSIS_FAILURE_CAUSE = 'FaceCaptureAnalysisErrorFaceTooBig' | 'FaceCaptureAnalysisErrorEyesNotOpen' | 'FaceCaptureAnalysisErrorFaceTooSmall' | 'FaceCaptureAnalysisErrorFaceNotStable' | 'FaceCaptureAnalysisErrorNoFaceDetected' | 'FaceCaptureAnalysisErrorFaceNotCentered' | 'FaceCaptureAnalysisErrorFaceNotStraight' | 'FaceCaptureAnalysisErrorEnvironmentTooDark' | 'FaceCaptureAnalysisErrorFaceAnalysisFailed' | 'FaceCaptureAnalysisErrorMultipleFaces';
|
|
28
28
|
export declare type FaceCaptureAnalysisFailure = {
|
|
29
29
|
cause: ANALYSIS_FAILURE_CAUSE;
|
|
30
30
|
originalImage: string;
|
|
@@ -35,6 +35,7 @@ export declare type ComponentProps = {
|
|
|
35
35
|
requireEyesOpen?: boolean;
|
|
36
36
|
requireValidAngle?: boolean;
|
|
37
37
|
requiredStableFrames?: number;
|
|
38
|
+
requireBrightEnvironment?: boolean;
|
|
38
39
|
imageQuality?: IMAGE_QUALITY;
|
|
39
40
|
scanningArea?: Array<number>;
|
|
40
41
|
onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;
|
package/package.json
CHANGED
|
@@ -11,10 +11,10 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.authors = package["author"]
|
|
12
12
|
s.homepage = 'https://github.com/getyoti/react-native-yoti-face-capture'
|
|
13
13
|
s.source = { :git => "https://github.com/getyoti/react-native-yoti-face-capture.git", :tag => "#{s.version}" }
|
|
14
|
-
s.platforms = { :ios => "
|
|
14
|
+
s.platforms = { :ios => "13.0" }
|
|
15
15
|
|
|
16
16
|
s.source_files = "ios/**/*.{h,m,mm}"
|
|
17
17
|
|
|
18
18
|
s.dependency "React-Core"
|
|
19
|
-
s.dependency "YotiFaceCapture", "
|
|
19
|
+
s.dependency "YotiFaceCapture", "4.1.0"
|
|
20
20
|
end
|
|
@@ -28,6 +28,7 @@ type NATIVE_ANALYSIS_FAILURE_CAUSE =
|
|
|
28
28
|
| 'NoFaceDetected'
|
|
29
29
|
| 'FaceNotCentered'
|
|
30
30
|
| 'FaceNotStraight'
|
|
31
|
+
| 'EnvironmentTooDark'
|
|
31
32
|
| 'AnalysisError'
|
|
32
33
|
| 'MultipleFacesDetected';
|
|
33
34
|
|
|
@@ -77,6 +78,7 @@ interface NativeFaceCaptureViewAndroid {
|
|
|
77
78
|
requireEyesOpen: boolean;
|
|
78
79
|
requireValidAngle: boolean;
|
|
79
80
|
requiredStableFrames: number;
|
|
81
|
+
requireBrightEnvironment: Boolean;
|
|
80
82
|
imageQuality: IMAGE_QUALITY;
|
|
81
83
|
scanningArea: Array<number>;
|
|
82
84
|
onCameraStateChange: (
|
|
@@ -97,6 +99,7 @@ const FACE_CAPTURE_FAILURE_RENAMING: FailureRenaming = {
|
|
|
97
99
|
NoFaceDetected: 'FaceCaptureAnalysisErrorNoFaceDetected',
|
|
98
100
|
FaceNotCentered: 'FaceCaptureAnalysisErrorFaceNotCentered',
|
|
99
101
|
FaceNotStraight: 'FaceCaptureAnalysisErrorFaceNotStraight',
|
|
102
|
+
EnvironmentTooDark: 'FaceCaptureAnalysisErrorEnvironmentTooDark',
|
|
100
103
|
AnalysisError: 'FaceCaptureAnalysisErrorFaceAnalysisFailed',
|
|
101
104
|
MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces',
|
|
102
105
|
};
|
|
@@ -208,6 +211,7 @@ export default class RNYotiCapture extends React.Component<ComponentProps> {
|
|
|
208
211
|
render() {
|
|
209
212
|
const {
|
|
210
213
|
requireEyesOpen = false,
|
|
214
|
+
requireBrightEnvironment = true,
|
|
211
215
|
requireValidAngle = false,
|
|
212
216
|
requiredStableFrames = 3,
|
|
213
217
|
imageQuality = IMAGE_QUALITY_MEDIUM,
|
|
@@ -225,6 +229,7 @@ export default class RNYotiCapture extends React.Component<ComponentProps> {
|
|
|
225
229
|
requireEyesOpen={requireEyesOpen}
|
|
226
230
|
requireValidAngle={requireValidAngle}
|
|
227
231
|
requiredStableFrames={requiredStableFrames}
|
|
232
|
+
requireBrightEnvironment={requireBrightEnvironment}
|
|
228
233
|
imageQuality={imageQuality}
|
|
229
234
|
scanningArea={scanningArea}
|
|
230
235
|
ref={this._setReference}
|
|
@@ -45,6 +45,7 @@ interface NativeFaceCaptureViewIOS {
|
|
|
45
45
|
requireEyesOpen: boolean;
|
|
46
46
|
requireValidAngle: boolean;
|
|
47
47
|
requiredStableFrames: number;
|
|
48
|
+
requireBrightEnvironment: boolean;
|
|
48
49
|
scanningArea: Array<number>;
|
|
49
50
|
onFaceCaptureAnalyzedImage: (
|
|
50
51
|
faceCaptureResult: NativeFaceCaptureResult
|
|
@@ -118,6 +119,7 @@ export default class RNYotiCapture extends React.Component<ComponentProps> {
|
|
|
118
119
|
requireEyesOpen = false,
|
|
119
120
|
requireValidAngle = false,
|
|
120
121
|
requiredStableFrames = 3,
|
|
122
|
+
requireBrightEnvironment = true,
|
|
121
123
|
imageQuality = IMAGE_QUALITY_MEDIUM,
|
|
122
124
|
scanningArea = [
|
|
123
125
|
0,
|
|
@@ -132,6 +134,7 @@ export default class RNYotiCapture extends React.Component<ComponentProps> {
|
|
|
132
134
|
requireEyesOpen={requireEyesOpen}
|
|
133
135
|
requireValidAngle={requireValidAngle}
|
|
134
136
|
requiredStableFrames={requiredStableFrames}
|
|
137
|
+
requireBrightEnvironment={requireBrightEnvironment}
|
|
135
138
|
imageQuality={imageQuality}
|
|
136
139
|
scanningArea={scanningArea}
|
|
137
140
|
onFaceCaptureAnalyzedImage={({
|
|
@@ -70,6 +70,7 @@ export type ANALYSIS_FAILURE_CAUSE =
|
|
|
70
70
|
| 'FaceCaptureAnalysisErrorNoFaceDetected'
|
|
71
71
|
| 'FaceCaptureAnalysisErrorFaceNotCentered'
|
|
72
72
|
| 'FaceCaptureAnalysisErrorFaceNotStraight'
|
|
73
|
+
| 'FaceCaptureAnalysisErrorEnvironmentTooDark'
|
|
73
74
|
| 'FaceCaptureAnalysisErrorFaceAnalysisFailed'
|
|
74
75
|
| 'FaceCaptureAnalysisErrorMultipleFaces';
|
|
75
76
|
|
|
@@ -92,6 +93,7 @@ export type ComponentProps = {
|
|
|
92
93
|
requireEyesOpen?: boolean;
|
|
93
94
|
requireValidAngle?: boolean;
|
|
94
95
|
requiredStableFrames?: number;
|
|
96
|
+
requireBrightEnvironment?: boolean;
|
|
95
97
|
imageQuality?: IMAGE_QUALITY;
|
|
96
98
|
scanningArea?: Array<number>;
|
|
97
99
|
onFaceCaptureAnalyzedImage: (faceCaptureResult: FaceCaptureResult) => void;
|