Skip to content

Commit

Permalink
chore: misc ux updates
Browse files Browse the repository at this point in the history
  • Loading branch information
phantumcode committed Nov 27, 2023
1 parent 33bff1a commit 8220c13
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Sources/FaceLiveness/AV/VideoChunker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ final class VideoChunker {

func start() {
guard state == .pending else { return }
state = .writing
assetWriter.startWriting()
assetWriter.startSession(atSourceTime: .zero)
state = .writing
}

func finish(singleFrame: @escaping (UIImage) -> Void) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ struct InstructionContainerView: View {
argument: LocalizedStrings.challenge_verifying
)
}
case .faceMatched:
InstructionView(
text: LocalizedStrings.challenge_instruction_hold_still,
backgroundColor: .livenessPrimaryBackground,
textColor: .livenessPrimaryLabel,
font: .title
)
default:
EmptyView()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@ public struct FaceLivenessDetectorView: View {
.onAppear {
Task {
do {
let newState = disableStartView
? DisplayState.displayingLiveness
: DisplayState.displayingGetReadyView
guard self.displayState != newState else { return }
let session = try await sessionTask.value
viewModel.livenessService = session
viewModel.registerServiceEvents()

self.displayState = disableStartView
? .displayingLiveness
: .displayingGetReadyView
self.displayState = newState
} catch {
throw FaceLivenessDetectionError.accessDenied
}
Expand All @@ -147,6 +148,7 @@ public struct FaceLivenessDetectorView: View {
case .displayingGetReadyView:
GetReadyPageView(
onBegin: {
guard displayState != .displayingLiveness else { return }
displayState = .displayingLiveness
},
beginCheckButtonDisabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ extension FaceLivenessDetectionViewModel: FaceDetectionResultHandler {
case .match:
self.livenessState.faceMatched()
self.faceMatchedTimestamp = Date().timestampMilliseconds
self.livenessViewControllerDelegate?.displayFreshness(colorSequences: colorSequences)
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
self.livenessViewControllerDelegate?.displayFreshness(colorSequences: colorSequences)
}
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.success)
self.noFitStartTime = nil
Expand Down
2 changes: 1 addition & 1 deletion Sources/FaceLiveness/Views/ProgressBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct ProgressBarView: View {
.foregroundColor(emptyColor)

Rectangle()
.cornerRadius(8, corners: [.topLeft, .bottomLeft])
.cornerRadius(8, corners: .allCorners)
.frame(
width: min(percentage, 1) * proxy.size.width,
height: proxy.size.height - 8
Expand Down

0 comments on commit 8220c13

Please sign in to comment.