diff --git a/Package.resolved b/Package.resolved index 8874564c..595e3b9b 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/aws-amplify/amplify-swift", "state" : { - "revision" : "4241439bae1662134f0a73bd87c84f7384ffabb6", - "version" : "2.11.0" + "revision" : "bb69fc1febc23dfc539531ce7dd3b51cdf97d813", + "version" : "2.14.1" } }, { @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/aws-amplify/amplify-swift-utils-notifications.git", "state" : { - "revision" : "d4fd3c17e8d40efc821f448d3d6cff75b8f3b0dd", - "version" : "1.0.0" + "revision" : "f970384ad1035732f99259255cd2f97564807e41", + "version" : "1.1.0" } }, { diff --git a/Package.swift b/Package.swift index 5475087d..dd738e4d 100644 --- a/Package.swift +++ b/Package.swift @@ -13,7 +13,7 @@ let package = Package( targets: ["FaceLiveness"]), ], dependencies: [ - .package(url: "https://github.com/aws-amplify/amplify-swift", from: "2.11.0") + .package(url: "https://github.com/aws-amplify/amplify-swift", from: "2.14.1") ], targets: [ .target( diff --git a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionView.swift b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionView.swift index 415a59e5..a5ad18d3 100644 --- a/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionView.swift +++ b/Sources/FaceLiveness/Views/Liveness/FaceLivenessDetectionView.swift @@ -170,6 +170,7 @@ public struct FaceLivenessDetectorView: View { isPresented = false onCompletion(.success(())) case .encounteredUnrecoverableError(let error): + viewModel.livenessService.closeSocket(with: .normalClosure) isPresented = false onCompletion(.failure(mapError(error))) default: diff --git a/Tests/FaceLivenessTests/MockLivenessService.swift b/Tests/FaceLivenessTests/MockLivenessService.swift index 9753a477..2b4633d1 100644 --- a/Tests/FaceLivenessTests/MockLivenessService.swift +++ b/Tests/FaceLivenessTests/MockLivenessService.swift @@ -20,6 +20,7 @@ class MockLivenessService { var onVideoEvent: (LivenessEvent, Date) -> Void = { _, _ in } var onInitializeLivenessStream: (String, String) -> Void = { _, _ in } var onServiceException: (FaceLivenessSessionError) -> Void = { _ in } + var onCloseSocket: (URLSessionWebSocketTask.CloseCode) -> Void = { _ in } } extension MockLivenessService: LivenessService { @@ -61,4 +62,9 @@ extension MockLivenessService: LivenessService { ) { interactions.append(#function) } + + func closeSocket(with code: URLSessionWebSocketTask.CloseCode) { + interactions.append(#function) + onCloseSocket(code) + } }