Skip to content

Commit 1b67412

Browse files
feat(docs): Add no light details to the liveness component docs (#6593)
Co-authored-by: Abhash Kumar Singh <thisisabhash@gmail.com>
1 parent 2f3073a commit 1b67412

File tree

11 files changed

+97
-11
lines changed

11 files changed

+97
-11
lines changed

docs/src/data/frameworks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ export const FRAMEWORK_INSTALL_SCRIPTS = {
6161
vue: 'npm i @aws-amplify/ui-vue aws-amplify',
6262
angular: 'npm i @aws-amplify/ui-angular aws-amplify',
6363
flutter: 'flutter pub add amplify_authenticator',
64-
android: "implementation 'com.amplifyframework.ui:liveness:1.3.0'",
64+
android: "implementation 'com.amplifyframework.ui:liveness:1.5.0'",
6565
'react-native': `npm i @aws-amplify/ui-react-native aws-amplify ${REACT_NATIVE_DEPENDENCIES}`,
6666
};

docs/src/pages/[platform]/connected-components/authenticator/quick-start.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ import AmplifyCLI from './amplify-cli.mdx';
7676
compose true
7777
}
7878
composeOptions {
79-
kotlinCompilerExtensionVersion '1.2.0'
79+
kotlinCompilerExtensionVersion '1.5.3'
8080
}
8181
```
8282

docs/src/pages/[platform]/connected-components/liveness/android-props.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const FACE_LIVENESS_DETECTOR_PARAMETERS = [
1212
},
1313
{
1414
name: `credentialsProvider`,
15-
description: 'An optional paramter that provides AWS Credentials',
15+
description: 'An optional parameter that provides AWS Credentials.',
1616
type: `AWSCredentialsProvider?`,
1717
},
1818
{
@@ -21,6 +21,12 @@ export const FACE_LIVENESS_DETECTOR_PARAMETERS = [
2121
'Optional parameter for the disabling the intial view with instructions, default = false.',
2222
type: `Boolean`,
2323
},
24+
{
25+
name: `challengeOptions`,
26+
description:
27+
'Optional parameter that allows you to configure options for a given liveness challenge.',
28+
type: `ChallengeOptions`,
29+
},
2430
{
2531
name: `onComplete`,
2632
description:
@@ -62,6 +68,12 @@ export const FACE_LIVENESS_DETECTOR_ERROR_STATES = [
6268
'The session timed out and did not receive response from server within the time limit.',
6369
type: `Error`,
6470
},
71+
{
72+
name: `FaceLivenessDetectionException.UnsupportedChallengeTypeException`,
73+
description:
74+
'The backend sent a liveness challenge that is not supported by the library.',
75+
type: `Error`,
76+
},
6577
{
6678
name: `FaceLivenessDetectionException.UserCancelledException`,
6779
description: 'The user cancelled the face liveness check.',
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Alert } from '@aws-amplify/ui-react';
2+
3+
## Challenge Options
4+
5+
Certain liveness challenges have client-side options that you can configure based on your business requirements. For example, you can configure the `FaceMovement` challenge to use either the device's front-facing camera or back-facing camera.
6+
7+
```kotlin
8+
FaceLivenessDetector(
9+
sessionId = <session ID>,
10+
region = <region>,
11+
challengeOptions = ChallengeOptions(
12+
faceMovement = LivenessChallenge.FaceMovement(camera = Camera.Back)
13+
),
14+
onComplete = {
15+
Log.i("MyApp", "Face Liveness flow is complete")
16+
},
17+
onError = { error ->
18+
Log.e("MyApp", "Error during Face Liveness flow", error)
19+
}
20+
)
21+
```
22+
23+
<Alert variation="info" role="none">
24+
When the FaceLivenessDetector is rendered, Rekognition will mark the session ID as used and any future usages of the FaceLivenessDector will require a new session ID. So if you want to change which camera is used for the FaceMovement challenge at runtime, you will need to create a new liveness session and pass the new session ID into the FaceLivenessDetector with the new Camera option.
25+
</Alert>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Alert } from '@aws-amplify/ui-react';
2+
3+
## Challenge Options
4+
5+
Certain liveness challenges have client-side options that you can configure based on your business requirements. For example, you can configure the `FaceMovement` challenge to use either the device's front-facing camera or back-facing camera.
6+
7+
```swift
8+
FaceLivenessDetectorView(
9+
sessionID: <session ID>,
10+
region: <region>,
11+
challengeOptions: .init(faceMovementChallengeOption: .init(camera: .back)),
12+
isPresented: $isPresentingLiveness,
13+
onCompletion: { result in
14+
switch result {
15+
case .success:
16+
// ...
17+
case .failure(let error):
18+
// ...
19+
default:
20+
// ...
21+
}
22+
}
23+
)
24+
```
25+
26+
<Alert variation="info" role="none">
27+
When the FaceLivenessDetector is rendered, Rekognition will mark the session ID as used and any future usages of the FaceLivenessDector will require a new session ID. So if you want to change which camera is used for the FaceMovement challenge at runtime, you will need to create a new liveness session and pass the new session ID into the FaceLivenessDetector with the new Camera option.
28+
</Alert>

docs/src/pages/[platform]/connected-components/liveness/customization/index.page.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { getCustomStaticPath } from '@/utils/getCustomStaticPath';
1212
import StartAndroid from './customization.start-view.android.mdx';
1313
import StartReact from './customization.start-view.react.mdx';
1414
import StartSwift from './customization.start-view.swift.mdx';
15+
import OptionsAndroid from './customization.options.android.mdx';
16+
import OptionsSwift from './customization.options.swift.mdx';
1517
import I18Android from './customization.i18n.android.mdx';
1618
import I18React from './customization.i18n.react.mdx';
1719
import I18Swift from './customization.i18n.swift.mdx';
@@ -43,6 +45,14 @@ export async function getStaticProps() {
4345
<StartSwift />
4446
</InlineFilter>
4547

48+
<InlineFilter filters={['android']}>
49+
<OptionsAndroid />
50+
</InlineFilter>
51+
52+
<InlineFilter filters={['swift']}>
53+
<OptionsSwift />
54+
</InlineFilter>
55+
4656
## Internationalization (I18n)
4757

4858
<InlineFilter filters={['android']}>

docs/src/pages/[platform]/connected-components/liveness/full-api.android.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FACE_LIVENESS_DETECTOR_PARAMETERS, FACE_LIVENESS_DETECTOR_ERROR_STATES
33

44
## Full API Reference
55

6-
### FaceLivenessDetectorView Parameters
6+
### FaceLivenessDetector Parameters
77

88
Below is the full list of parameters that can be used with the `FaceLivenessDetector` component. You can also reference the [source code here](https://github.com/aws-amplify/amplify-ui-android/blob/main/liveness/src/main/java/com/amplifyframework/ui/liveness/ui/FaceLivenessDetector.kt#L73).
99

docs/src/pages/[platform]/connected-components/liveness/quick-start-add.android.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ buildFeatures {
1919
compose true
2020
}
2121
composeOptions {
22-
kotlinCompilerExtensionVersion '1.2.0'
22+
kotlinCompilerExtensionVersion '1.5.3'
2323
}
2424
```
2525

@@ -28,10 +28,10 @@ Add the following dependencies to your **app**'s `build.gradle` file and click "
2828
```groovy
2929
dependencies {
3030
// FaceLivenessDetector dependency
31-
implementation 'com.amplifyframework.ui:liveness:1.3.0'
31+
implementation 'com.amplifyframework.ui:liveness:1.5.0'
3232
3333
// Amplify Auth dependency (unnecessary if using your own credentials provider)
34-
implementation 'com.amplifyframework:aws-auth-cognito:2.26.0'
34+
implementation 'com.amplifyframework:aws-auth-cognito:2.29.0'
3535
3636
// Material3 dependency for theming FaceLivenessDetector
3737
implementation 'androidx.compose.material3:material3:1.1.2'

docs/src/pages/[platform]/connected-components/liveness/quick-start-pull.android.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ FaceLivenessDetector(
147147
compose true
148148
}
149149
composeOptions {
150-
kotlinCompilerExtensionVersion '1.2.0'
150+
kotlinCompilerExtensionVersion '1.5.3'
151151
}
152152
```
153153

@@ -156,7 +156,7 @@ FaceLivenessDetector(
156156
```groovy
157157
dependencies {
158158
// FaceLivenessDetector dependency
159-
implementation 'com.amplifyframework.ui:liveness:1.3.0'
159+
implementation 'com.amplifyframework.ui:liveness:1.5.0'
160160
161161
// Material3 dependency for theming FaceLivenessDetector
162162
implementation 'androidx.compose.material3:material3:1.1.2'

docs/src/pages/[platform]/connected-components/liveness/swift-props.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const FACE_LIVENESS_DETECTOR_PARAMETERS = [
66
},
77
{
88
name: `credentialsProvider`,
9-
description: 'An optional paramter that provides AWS Credentials',
9+
description: 'An optional parameter that provides AWS Credentials',
1010
type: `AWSCredentialsProvider`,
1111
},
1212
{
@@ -21,6 +21,12 @@ export const FACE_LIVENESS_DETECTOR_PARAMETERS = [
2121
'Optional parameter for the disabling the intial view with instructions, default: false.',
2222
type: `Bool`,
2323
},
24+
{
25+
name: `challengeOptions`,
26+
description:
27+
'Optional parameter that allows you to configure options for a given liveness challenge.',
28+
type: `ChallengeOptions`,
29+
},
2430
{
2531
name: `isPresented`,
2632
description:
@@ -68,6 +74,11 @@ export const FACE_LIVENESS_DETECTOR_ERROR_STATES = [
6874
description: 'The camera permission has not been granted.',
6975
type: `Error`,
7076
},
77+
{
78+
name: `.cameraNotAvailable`,
79+
description: 'The camera is not available due to a hardware issue.',
80+
type: `Error`,
81+
},
7182
{
7283
name: `.userCancelled`,
7384
description: 'The user cancelled the face liveness check.',

0 commit comments

Comments
 (0)