Skip to content

Commit

Permalink
fix: send client close frame (#39)
Browse files Browse the repository at this point in the history
* fix: send client close frame

* tmp: update amplify swift dependency to fix branch

* dont send close frame on successful completion

* add new close method in test mock

* update amplify swift dep version
  • Loading branch information
atierian authored and phantumcode committed Jul 13, 2023
1 parent abe085c commit c09aba6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/aws-amplify/amplify-swift",
"state" : {
"revision" : "4241439bae1662134f0a73bd87c84f7384ffabb6",
"version" : "2.11.0"
"revision" : "bb69fc1febc23dfc539531ce7dd3b51cdf97d813",
"version" : "2.14.1"
}
},
{
"identity" : "amplify-swift-utils-notifications",
"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"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions Tests/FaceLivenessTests/MockLivenessService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class MockLivenessService {
var onVideoEvent: (LivenessEvent<VideoEvent>, Date) -> Void = { _, _ in }
var onInitializeLivenessStream: (String, String) -> Void = { _, _ in }
var onServiceException: (FaceLivenessSessionError) -> Void = { _ in }
var onCloseSocket: (URLSessionWebSocketTask.CloseCode) -> Void = { _ in }
}

extension MockLivenessService: LivenessService {
Expand Down Expand Up @@ -61,4 +62,9 @@ extension MockLivenessService: LivenessService {
) {
interactions.append(#function)
}

func closeSocket(with code: URLSessionWebSocketTask.CloseCode) {
interactions.append(#function)
onCloseSocket(code)
}
}

0 comments on commit c09aba6

Please sign in to comment.