Skip to content

Commit

Permalink
chore: kickoff release
Browse files Browse the repository at this point in the history
  • Loading branch information
phantumcode authored Apr 23, 2024
2 parents 690d7c2 + 367b864 commit 151f685
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions HostApp/HostApp/Views/ExampleLivenessView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ struct ExampleLivenessView: View {
viewModel.presentationState = .error(.socketClosed)
case .failure(.countdownNoFace), .failure(.countdownFaceTooClose), .failure(.countdownMultipleFaces):
viewModel.presentationState = .error(.countdownFaceTooClose)
case .failure(.invalidSignature):
viewModel.presentationState = .error(.invalidSignature)
default:
viewModel.presentationState = .liveness
}
Expand Down Expand Up @@ -70,6 +72,8 @@ struct ExampleLivenessView: View {
LivenessCheckErrorContentView.faceMatchTimeOut
case .countdownNoFace, .countdownFaceTooClose, .countdownMultipleFaces:
LivenessCheckErrorContentView.failedDuringCountdown
case .invalidSignature:
LivenessCheckErrorContentView.invalidSignature
default:
LivenessCheckErrorContentView.unexpected
}
Expand Down
5 changes: 5 additions & 0 deletions HostApp/HostApp/Views/LivenessCheckErrorContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ extension LivenessCheckErrorContentView {
name: "Check failed during countdown",
description: "Avoid moving closer during countdown and ensure only one face is in front of camera."
)

static let invalidSignature = LivenessCheckErrorContentView(
name: "The signature on the request is invalid.",
description: "Ensure the device time is correct and try again."
)
}

struct LivenessCheckErrorContentView_Previews: PreviewProvider {
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", exact: "2.29.1")
.package(url: "https://github.com/aws-amplify/amplify-swift", exact: "2.29.3")
],
targets: [
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ public struct FaceLivenessDetectionError: Error, Equatable {
recoverySuggestion: ""
)

public static let invalidSignature = FaceLivenessDetectionError(
code: 17,
message: "The signature on the request is invalid.",
recoverySuggestion: "Ensure the device time is correct and try again."
)

public static func == (lhs: FaceLivenessDetectionError, rhs: FaceLivenessDetectionError) -> Bool {
lhs.code == rhs.code
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public struct FaceLivenessDetectorView: View {
case .userCancelled:
return .userCancelled
case .timedOut:
return .sessionTimedOut
return .faceInOvalMatchExceededTimeLimitError
case .socketClosed:
return .socketClosed
default:
Expand Down Expand Up @@ -273,6 +273,8 @@ private func map(detectionCompletion: @escaping (Result<Void, FaceLivenessDetect
detectionCompletion(.failure(.serviceUnavailable))
case .failure(.sessionNotFound):
detectionCompletion(.failure(.sessionNotFound))
case .failure(.invalidSignature):
detectionCompletion(.failure(.invalidSignature))
default:
detectionCompletion(.failure(.unknown))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class MockLivenessCaptureSession: LivenessCaptureSession {
displayLink?.invalidate()
}

override func startSession(frame: CGRect) throws -> CALayer {
override func configureCamera(frame: CGRect) throws -> CALayer {
videoRenderView = VideoRenderView(frame: frame)
let asset = AVAsset(url: inputFile)
// Setup display link
Expand Down

0 comments on commit 151f685

Please sign in to comment.