Liveness 2D

Além de poder usar o SDK em sua forma padrão de exibição, o SDK permite também, que as telas sejam customizadas e para tal, no Liveness2DCustomizationBuilder você terá acesso a todos os métodos de customização:

1. Tela de instruções

IdentificadorMétodos
(1) Back buttonsetBackButtonIcon(_:)
setBackButtonColor(forContent:background:border:)
(2) BackgroundsetBackgroundColor(_:)
(2) Context imagesetContextImage(_:)
(3) TitlesetTitleText(_:color:font:)
(4) First instruction iconsetFirstInstructionIcon(_:)
setFirstInstructionIconColor(forContent:background:border:)
(5) Second instruction iconsetSecondInstructionIcon(_:)
setSecondInstructionIconColor(forContent:background:border:)
(6) Bottom sheetsetBottomSheetColor(_:)
setBottomSheetCornerRadius(_:)
(7) CaptionsetCaptionText(_:color:font:)
(8) First instruction textsetFirstInstructionTitleText(_:color:font:)
(9) Second instruction textsetSecondInstructionTitleText(_:color:font:)
(10) Continue buttonsetContinueButtonText(_:font:)
setContinueButtonColor(forContent:background:border:)

Código de exemplo

Liveness2DCustomizationBuilder.builder()
    .customizeInstructionScreen { instructionBuilder in
        instructionBuilder
            .setBackButtonIcon(UIImage(named: "back-icon")!)
            .setBackButtonColor(
                forContent: UIColor.red,
                background: UIColor.green,
                border: UIColor.white
            )
            .setBackgroundColor(UIColor.purple)
            .setContextImage(UIImage(named: "context-image")!)
            .setBottomSheetColor(UIColor.cyan)
            .setBottomSheetCornerRadius(CGFloat(10))
            .setTitleText(
                "title-text",
                color: UIColor.brown,
                font: UIFont.systemFont(ofSize: 40)
            )
            .setCaptionText(
                "caption-text",
                color: UIColor.systemPink,
                font: UIFont.systemFont(ofSize: 30)
            )
            .setFirstInstructionIcon(UIImage(named: "first-instruction-icon")!)
            .setFirstInstructionIconColor(
                forContent: UIColor.purple,
                background: UIColor.green,
                border: UIColor.red
            )
            .setFirstInstructionTitleText(
                "fist-intruction-text",
                color: UIColor.darkGray,
                font: UIFont.systemFont(ofSize: 30)
            )
            .setSecondInstructionIcon(UIImage(named: "second-instruction-icon")!)
            .setSecondInstructionIconColor(
                forContent: UIColor.white,
                background: UIColor.orange,
                border: UIColor.black
            )
            .setSecondInstructionTitleText(
                "second-intruction-text",
                color: UIColor.magenta,
                font: UIFont.systemFont(ofSize: 24)
            )
            .setContinueButtonText(
                "continue-button-text",
                font: UIFont.systemFont(ofSize: 50)
            )
            .setContinueButtonColor(
                forContent: UIColor.lightGray,
                background: UIColor.systemPink,
                border: UIColor.white
            )
    }

2. Tela de captura

IdentificadorMétodos
(1) Back buttonsetBackButtonIcon(_:)
setBackButtonColor(forContent:background:border:)
(2) Instruction textsetInstruction(withText:color:font:)
setInstructionBackgroundColor(_:)
setInstructionCornerRadius(_:)
(2) ChallengesetChallengeBackgroundColor(_:)
setChallengeCornerRadius(_:)
(3) OvalsetOval(withColor:borderWidth:)
(4) Close buttonsetCloseButtonIcon(_:)
setCloseButtonColor(forContent:background:border:)
(5) Start buttonsetStartButtonText(_:font:)
setStartButtonColor(forContent:background:border:)
(6) BackgroundsetBackgroundColor(_:)
(8-9) Oval loadingsetOvalLoadingColors(forTop:bottom:)

Código de exemplo

Liveness2DCustomizationBuilder.builder()
    .customizeCaptureScreen { captureBuilder in
        captureBuilder
            .setBackButtonIcon(UIImage(named: "back-button-icon")!)
            .setBackButtonColor(
                forContent: UIColor.white,
                background: UIColor.magenta,
                border: UIColor.green
            )
            .setCloseButtonIcon(UIImage(named: "close-button-icon")!)
            .setCloseButtonColor(
                forContent: UIColor.magenta,
                background: UIColor.green,
                border: UIColor.white
            )
            .setInstruction(
                withText: "instruction-text",
                color: UIColor.blue,
                font: UIFont.systemFont(ofSize: 22)
            )
            .setInstructionBackgroundColor(UIColor.yellow)
            .setChallengeCornerRadius(CGFloat.zero)
            .setChallengeBackgroundColor(UIColor.purple)
            .setChallengeCornerRadius(CGFloat(30))
            .setBackgroundColor(UIColor.red)
            .setOval(
                withColor: UIColor.purple,
                borderWidth: CGFloat(2)
            )
            .setOvalLoadingColors(
                forTop: UIColor.red,
                bottom: UIColor.yellow
            )
            .setStartButtonText(
                "start-button-text",
                font: UIFont.systemFont(ofSize: 20)
            )
            .setStartButtonColor(
                forContent: UIColor.systemPink,
                background: UIColor.orange,
                border: UIColor.black
            )
    }

3. Tela de loading

IdentificadorMétodos
(1) LoadingsetLoading(withColor:width:scaleFactor:)
(2) BackgroundsetBackgroundColor(_:)

Código de exemplo

Liveness2DCustomizationBuilder.builder()
    .customizeLoadingScreen { loadingBuilder in
        loadingBuilder
            .setBackgroundColor(UIColor.orange)
            .setLoading(
                withColor: UIColor.cyan,
                width: CGFloat(20),
                scaleFactor: Int(8)
            )
    }

4. Tela de resultado

IdentificadorMétodos
(1) ImagesetSuccesImage(_:)
setErrorImage(_:)
(2) MessagesetSuccessMessage(_:color:font:)
setErrorMessage(_:color:font:)
(4) BackgroundsetSuccessBackgroundColor(_:)
setErrorBackgroundColor(_:)

Código de exemplo

Liveness2DCustomizationBuilder.builder()
    .customizeResultScreen { resultBuilder in
        resultBuilder
            .setSuccessBackgroundColor(UIColor.brown)
            .setSuccesImage(UIImage(named: "success-icon")!)
            .setSuccessMessage(
                "success-message-text",
                color: UIColor.white,
                font: UIFont.systemFont(ofSize: 30)
            )
            .setErrorBackgroundColor(UIColor.systemPink)
            .setErrorImage(UIImage(named: "error-icon")!)
            .setErrorMessage(
                "error-message-text",
                color: UIColor.white,
                font: UIFont.systemFont(ofSize: 40)
            )
    }

5. Tela de permissão da câmera

IdentificadorMétodos
(1) Back buttonsetBackButtonIcon(_:)
setBackButtonColor(forContent:background:border:)
(2) Camera imagesetCameraImage(_:color:)
(3) TitlesetTitle(text:color:font:)
(4) CaptionsetCaption(text:color:font:)
(5) Check permission buttonsetCheckPermissionButtonText(_:font:)
setCheckPermissionButtonColor(forContent:background:border:)
(6) BackgroundsetBackgroundColor(_:)
(7) Bottom sheetsetBottomSheetBackgroundColor(_:)
setBottomSheetCornerRadius(_:)
setBottomSheetTitle(text:color:font:)
setBottomSheetCaption(text:color:font:)
(8) Open settings buttonsetOpenSettingsButtonText(_:font:)
setOpenSettingsButtonColor(forContent:background:border:)
(9) Close buttonsetCloseButtonText(_:font:)
setCloseButtonColor(forContent:background:border:)

Código de exemplo

Liveness2DCustomizationBuilder.builder()
    .customizeCameraPermissionScreen { cameraPermissionBuilder in
        cameraPermissionBuilder
            .setBackButtonIcon(UIImage(named: "back-button-icon")!)
            .setBackButtonColor(
                forContent: UIColor.red,
                background: UIColor.blue,
                border: UIColor.yellow
            )
            .setCameraImage(UIImage(named: "image"), color: UIColor.white)
            .setTitle(
                text: "Title",
                color: UIColor.green,
                font: UIFont.systemFont(ofSize: 14)
            )
            .setCaption(
                text: "Caption",
                color: UIColor.orange,
                font: UIFont.systemFont(ofSize: 16)
            )
            .setCheckPermissionButtonText("Check Permission", font: UIFont.systemFont(ofSize: 20))
            .setCheckPermissionButtonColor(
                forContent: UIColor.purple,
                background: UIColor.systemPink,
                border: UIColor.brown
            )
            .setBackgroundColor(UIColor.green)
            .setBottomSheetBackgroundColor(UIColor.cyan)
            .setBottomSheetCornerRadius(CGFloat(15.0))
            .setBottomSheetTitle(
                text: "Bottom sheet title",
                color: UIColor.yellow,
                font: UIFont.systemFont(ofSize: 30)
            )
            .setBottomSheetCaption(
                text: "Bottom sheet caption",
                color: UIColor.white,
                font: UIFont.systemFont(ofSize: 20)
            )
            .setOpenSettingsButtonText("Open Settings", font: UIFont.systemFont(ofSize: 18))
            .setOpenSettingsButtonColor(
                forContent: UIColor.black,
                background: UIColor.orange,
                border: UIColor.systemPink
            )
            .setCloseButtonText("Close", font: UIFont.systemFont(ofSize: 12))
            .setCloseButtonColor(
                forContent: UIColor.magenta,
                background: UIColor.systemPink,
                border: UIColor.blue
            )
    }