File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed
aws-predictions/src/main/java/com/amplifyframework/predictions/aws
core/src/main/java/com/amplifyframework/predictions/models Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -481,9 +481,9 @@ internal class LivenessWebSocket(
481481 }
482482 }
483483
484- fun destroy () {
485- // Close gracefully
486- webSocket?.close(NORMAL_SOCKET_CLOSURE_STATUS_CODE , null )
484+ fun destroy (reasonCode : Int = NORMAL_SOCKET_CLOSURE_STATUS_CODE ) {
485+ // Close with provided reason code
486+ webSocket?.close(reasonCode , null )
487487 }
488488
489489 fun adjustedDate (date : Long = Date ().time): Long {
Original file line number Diff line number Diff line change @@ -179,8 +179,8 @@ internal class RunFaceLivenessSession(
179179 }
180180 }
181181
182- private fun stopLivenessSession () {
182+ private fun stopLivenessSession (reasonCode : Int? ) {
183183 livenessWebSocket.clientStoppedSession = true
184- livenessWebSocket.destroy()
184+ reasonCode?. let { livenessWebSocket.destroy(it) } ? : livenessWebSocket.destroy()
185185 }
186186}
Original file line number Diff line number Diff line change 1616package com.amplifyframework.predictions.models
1717
1818import com.amplifyframework.annotations.InternalAmplifyApi
19- import com.amplifyframework.core.Action
2019
2120@InternalAmplifyApi
2221class FaceLivenessSession (
2322 val challenges : List <FaceLivenessSessionChallenge >,
2423 private val onVideoEvent : (VideoEvent ) -> Unit ,
2524 private val onChallengeResponseEvent : (ChallengeResponseEvent ) -> Unit ,
26- private val stopLivenessSession : Action
25+ private val stopLivenessSession : ( Int? ) -> Unit
2726) {
2827
2928 fun sendVideoEvent (videoEvent : VideoEvent ) {
@@ -34,7 +33,8 @@ class FaceLivenessSession(
3433 onChallengeResponseEvent(challengeResponseEvent)
3534 }
3635
37- fun stopSession () {
38- stopLivenessSession.call()
36+ @JvmOverloads
37+ fun stopSession (reasonCode : Int? = null) {
38+ stopLivenessSession(reasonCode)
3939 }
4040}
You can’t perform that action at this time.
0 commit comments