ActiveFaceCaptureView

@MainActor
struct ActiveFaceCaptureView : View

Active Face Capture view This view is responsible for capturing the user’s face and guiding them through the process. It includes animations, instructions, and error handling.

  • The view starts by setting up the initial camera configuration and preparing for face scanning.
  • It displays a camera view with a red circle indicating the user’s face position.
  • It also includes an arc animation to guide the user on where to position their face.
  • Instructions are displayed based on the current state of the face capture process.
  • The view handles different types of errors that may occur during face capture, such as timeout, motion too fast, or liveness failure.
  • It includes functions to show dialogs with retry options or single button confirmation based on the error type.
  • The view also decrypts QR data after successful face capture and displays person details if decryption is successful. Overall, this view provides a seamless experience for users to capture their faces accurately and handle any errors that may occur during the process.
  • Unique identifier for animation

    Declaration

    Swift

    @State
    @MainActor
    private var animationID: UUID { get nonmutating set }
  • Flag to indicate if animation is currently playing

    Declaration

    Swift

    @State
    @MainActor
    private var animationPlaying: Bool { get nonmutating set }
  • Flag to show/hide an alert

    Declaration

    Swift

    @State
    @MainActor
    private var showAlert: Bool { get nonmutating set }
  • Number of previously completed states

    Declaration

    Swift

    @State
    @MainActor
    private var previousNumCompletedStates: UInt8? { get nonmutating set }
  • Factory object for face capture

    Declaration

    Swift

    @StateObject
    @MainActor
    private var faceCaptureFactory: ActiveFaceCaptureFactory { get }
  • Expected user action for face capture

    Declaration

    Swift

    @State
    @MainActor
    var expectedUserAction: ActiveFaceCaptureStateName? { get nonmutating set }
  • Target action score for face capture

    Declaration

    Swift

    @State
    @MainActor
    var targetActionScore: Float? { get nonmutating set }
  • Instructions for face capture

    Declaration

    Swift

    @State
    @MainActor
    var instructions: String { get nonmutating set }
  • Total number of states for face capture

    Declaration

    Swift

    @State
    @MainActor
    var numStates: UInt8? { get nonmutating set }
  • Number of completed states for face capture

    Declaration

    Swift

    @State
    @MainActor
    var numCompletedStates: UInt8? { get nonmutating set }
  • Flag to show/hide user guide face animation

    Declaration

    Swift

    @State
    @MainActor
    var showUserGuideFaceAnimation: Bool { get nonmutating set }
  • Flag to show/hide arc animation

    Declaration

    Swift

    @State
    @MainActor
    var showArc: Bool { get nonmutating set }
  • Angle of the arc animation

    Declaration

    Swift

    @State
    @MainActor
    var arcAngle: Double { get nonmutating set }
  • Animated angle of the arc animation

    Declaration

    Swift

    @State
    @MainActor
    var animatedArcAngle: Double { get nonmutating set }
  • Error type for face capture

    Declaration

    Swift

    @State
    @MainActor
    var error: SDKErrors { get nonmutating set }
  • Flag to show/hide error message

    Declaration

    Swift

    @State
    @MainActor
    var showError: Bool { get nonmutating set }
  • Current animation file name

    Declaration

    Swift

    @State
    @MainActor
    var getCurrentAnimationFile: String { get nonmutating set }
  • Diameter of the circle

    Declaration

    Swift

    @MainActor
    let circleDiameter: CGFloat
  • Diameter of the camera view

    Declaration

    Swift

    @MainActor
    let cameraDiameter: CGFloat
  • Size of the arc

    Declaration

    Swift

    @MainActor
    let arcSize: CGFloat
  • Opacity for the arc

    Declaration

    Swift

    @MainActor
    let arcOpacity: Double
  • Width of the stroke

    Declaration

    Swift

    @MainActor
    let width: Double
  • Offset angle for the stroke

    Declaration

    Swift

    @MainActor
    let offsetAngle: Double
  • Password for face capture

    Declaration

    Swift

    @MainActor
    var password: String
  • Hex color for the circle

    Declaration

    Swift

    @State
    @MainActor
    var circleHexColor: UInt { get nonmutating set }
  • Flag to indicate if data is loading

    Declaration

    Swift

    @State
    @MainActor
    var isLoading: Bool { get nonmutating set }
  • Metadata for face capture

    Declaration

    Swift

    @State
    @MainActor
    var metaData: [String : String] { get nonmutating set }
  • Face bytes for face capture

    Declaration

    Swift

    @State
    @MainActor
    var faceBytes: Data { get nonmutating set }
  • Binding for QR bytes

    Declaration

    Swift

    @State
    @MainActor
    var qrBytes: [UInt8] { get nonmutating set }
  • Type of view

    Declaration

    Swift

    @MainActor
    var typeView: TypeView?
  • This EnvironmentObject navigationStore give access to all the view we want to navigate to and from It can be used to pop and push the view in the stack.

    Declaration

    Swift

    @EnvironmentObject
    @MainActor
    private var navigationStore: NavigationStackController { get }
  • This is the body of the ActiveFaceCaptureView

    Declaration

    Swift

    @MainActor
    var body: some View { get }
  • Get the oval width

    See more

    Declaration

    Swift

    @MainActor
    struct BackToMainSectionFromData : View

    Return Value

    The width of the oval

  • Check camera permission and show the alert if permission is not granted

    Declaration

    Swift

    @MainActor
    func checkCameraPermission()
  • Set up initial configurations for face capture

    Declaration

    Swift

    @MainActor
    func setUpInitial()
  • Update the instructions for face capture

    Declaration

    Swift

    @MainActor
    func updateInstructions(model: ActiveFaceCaptureModel)

    Parameters

    model

    The ActiveFaceCaptureModel containing the updated instructions.

  • Update the circle color for face capture

    Declaration

    Swift

    @MainActor
    func updateCircleColor(model: ActiveFaceCaptureModel)

    Parameters

    model

    The ActiveFaceCaptureModel containing the updated circle color.

  • Update the number of instructions for face capture

    Declaration

    Swift

    @MainActor
    func updateNumberOfInstruction(model: ActiveFaceCaptureModel)

    Parameters

    model

    The ActiveFaceCaptureModel containing the updated number of instructions.

  • Handles the completion of the face capture process

    Declaration

    Swift

    @MainActor
    func sessionCompleted()
  • Update the directions for face capture

    Declaration

    Swift

    @MainActor
    func updateDirections(model: ActiveFaceCaptureModel)

    Parameters

    model

    The ActiveFaceCaptureModel containing the updated directions.

  • Update the animation for face capture

    Declaration

    Swift

    @MainActor
    func updateAnimation(model: ActiveFaceCaptureModel)

    Parameters

    model

    The ActiveFaceCaptureModel containing the updated animation.

  • Show the error view for face capture

    Declaration

    Swift

    @MainActor
    func showError(model: ActiveFaceCaptureModel)

    Parameters

    model

    The ActiveFaceCaptureModel containing the error information.

  • Show the dialog with a single button for the given error

    Declaration

    Swift

    @MainActor
    func showDialogWithSingleButton(_ error: SDKErrors) -> some View

    Parameters

    error

    The SDKErrors representing the error type.

    Return Value

    The DialogViewWithSingleButton view.

  • Show the timeout error dialog for face capture

    Declaration

    Swift

    @MainActor
    func showActiveTimeOutError(_ error: SDKErrors) -> some View

    Parameters

    error

    The SDKErrors representing the error type.

    Return Value

    The ActiveCaptureErrorDialog view.

  • Show active motion to fast error dialog

    • error: The error object

    Declaration

    Swift

    @MainActor
    func showActiveMotionToFast(_ error: SDKErrors) -> some View

    Return Value

    A view representing the active motion to fast error dialog

  • Show confirmation dialog with retry

    • error: The error object

    Declaration

    Swift

    @MainActor
    private func confirmationDialogWithRetry(_ error: SDKErrors) -> some View

    Return Value

    A view representing the confirmation dialog with retry

  • Show liveness error dialog

    • error: The error object

    Declaration

    Swift

    @MainActor
    func showFaceCaptureLivenessError(_ error: SDKErrors) -> some View

    Return Value

    A view representing the liveness error dialog

  • Show no face detected error dialog

    • error: The error object

    Declaration

    Swift

    @MainActor
    func showFaceCaptureNoFaceDetected(_ error: SDKErrors) -> some View

    Return Value

    A view representing the liveness error dialog

  • Show face capture error dialog

    • error: The error object

    Declaration

    Swift

    @MainActor
    func showFaceCapturError(_ error: SDKErrors) -> some View

    Return Value

    A view representing the liveness error dialog

  • Get the opacity for the arc

    Declaration

    Swift

    @MainActor
    func getArcOpacity() -> Double

    Return Value

    The opacity value for the arc

  • Start indication

    • model: The active face capture model

    Declaration

    Swift

    @MainActor
    func startIndication(model: ActiveFaceCaptureModel) -> Bool

    Return Value

    A boolean value indicating whether to start indication or not

  • Show face capture multiple face error dialog

    • error: The error object

    Declaration

    Swift

    @MainActor
    func showFaceCapturMultipleFaceError(_ error: SDKErrors) -> some View

    Return Value

    A view representing the liveness error dialog

  • Decrypt SensePrint QR

    This function decrypts the SensePrint QR

    • password: The password used for decryption

    Declaration

    Swift

    @MainActor
    func decryptSensePrintQR()
  • Get the error view and show different dialog according to the error type

    Declaration

    Swift

    @MainActor
    func getErrorView() -> some View

    Return Value

    A view representing the error view

Testing function for the UI