-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from regulaforensics/ui-configuration
UI configuration
- Loading branch information
Showing
16 changed files
with
186 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
Catalog/Items/ViewCustomization/FaceCaptureUIConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// FaceCaptureUIConfiguration.swift | ||
// Catalog | ||
// | ||
// Created by Dmitry Evglevsky on 29.06.23. | ||
// Copyright © 2023 Regula. All rights reserved. | ||
// | ||
|
||
import FaceSDK | ||
|
||
final class FaceCaptureUIConfigurationItem: CatalogItem { | ||
override init() { | ||
super.init() | ||
|
||
title = "FaceCapture UI Configuration" | ||
itemDescription = "Interface customization." | ||
category = .viewCustomization | ||
} | ||
|
||
override func onItemSelected(from viewController: UIViewController) { | ||
let titleFont = UIFont(name: "Copperplate", size: 26)! | ||
|
||
let interfaceConfiguration = UIConfiguration { | ||
// Camera screen colors. | ||
$0.setColor(.systemYellow, forItem: .CameraScreenStrokeActive) | ||
$0.setColor(.systemYellow, forItem: .CameraScreenStrokeNormal) | ||
$0.setColor(.systemYellow, forItem: .CameraScreenFrontHintLabelBackground) | ||
$0.setColor(.black, forItem: .CameraScreenFrontHintLabelText) | ||
|
||
// Camera screen fonts. | ||
$0.setFont(titleFont, forItem: .CameraScreenHintLabel) | ||
} | ||
FaceSDK.service.customization.configuration = interfaceConfiguration | ||
|
||
FaceSDK.service.presentFaceCaptureViewController( | ||
from: viewController, | ||
animated: true, | ||
onCapture: { [weak self, weak viewController] response in | ||
FaceSDK.service.customization.configuration = nil | ||
guard let self = self, let viewController = viewController else { return } | ||
self.showFaceCaptureResult(response, from: viewController) | ||
}, | ||
completion: nil) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
Catalog/Items/ViewCustomization/LivenessUIConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// | ||
// LivenessUIConfiguration.swift | ||
// Catalog | ||
// | ||
// Created by Dmitry Evglevsky on 9.06.23. | ||
// Copyright © 2023 Regula. All rights reserved. | ||
// | ||
|
||
import FaceSDK | ||
|
||
final class LivenessUIConfigurationItem: CatalogItem { | ||
override init() { | ||
super.init() | ||
|
||
title = "Liveness UI Configuration" | ||
itemDescription = "Interface customization." | ||
category = .viewCustomization | ||
} | ||
|
||
override func onItemSelected(from viewController: UIViewController) { | ||
let messageFont = UIFont(name: "Copperplate", size: 18)! | ||
let titleFont = UIFont(name: "Copperplate", size: 26)! | ||
|
||
let interfaceConfiguration = UIConfiguration { | ||
// Onboarding screen colors. | ||
$0.setColor(.systemYellow, forItem: .OnboardingScreenBackground) | ||
$0.setColor(.black, forItem: .OnboardingScreenStartButtonBackground) | ||
|
||
// Onboarding screen fonts. | ||
$0.setFont(messageFont, forItem: .OnboardingScreenMessageLabel) | ||
$0.setFont(titleFont, forItem: .OnboardingScreenTitleLabel) | ||
$0.setFont(titleFont, forItem: .OnboardingScreenStartButton) | ||
|
||
// Onboarding screen images. | ||
if #available(iOS 16.0, *) { | ||
$0.setImage(UIImage(systemName: "sun.max.trianglebadge.exclamationmark")!.withTintColor(.black, renderingMode: .alwaysOriginal), | ||
forItem: .OnboardingScreenIllumination) | ||
$0.setImage(UIImage(systemName: "eyeglasses")!.withTintColor(.black, renderingMode: .alwaysOriginal), | ||
forItem: .OnboardingScreenAccessories) | ||
$0.setImage(UIImage(systemName: "camera.viewfinder")!.withTintColor(.black, renderingMode: .alwaysOriginal), | ||
forItem: .OnboardingScreenCameraLevel) | ||
} else { | ||
// Use your image assets. | ||
} | ||
|
||
// Camera screen colors. | ||
$0.setColor(.systemYellow, forItem: .CameraScreenStrokeActive) | ||
$0.setColor(.systemYellow, forItem: .CameraScreenStrokeNormal) | ||
$0.setColor(.systemYellow, forItem: .CameraScreenSectorActive) | ||
$0.setColor(.systemYellow.withAlphaComponent(0.35), forItem: .CameraScreenSectorTarget) | ||
$0.setColor(.systemYellow, forItem: .CameraScreenFrontHintLabelBackground) | ||
$0.setColor(.black, forItem: .CameraScreenFrontHintLabelText) | ||
|
||
// Camera screen fonts. | ||
$0.setFont(titleFont, forItem: .CameraScreenHintLabel) | ||
|
||
// Processing screen colors. | ||
$0.setColor(.systemYellow, forItem: .ProcessingScreenBackground) | ||
$0.setColor(.black, forItem: .ProcessingScreenProgress) | ||
$0.setColor(.black, forItem: .ProcessingScreenTitleLabel) | ||
|
||
// Processing screen fonts. | ||
$0.setFont(titleFont, forItem: .ProcessingScreenLabel) | ||
|
||
// Retry screen colors. | ||
$0.setColor(.systemYellow, forItem: .RetryScreenBackground) | ||
$0.setColor(.black, forItem: .RetryScreenRetryButtonBackground) | ||
|
||
// Retry screen fonts. | ||
$0.setFont(messageFont, forItem: .RetryScreenHintLabels) | ||
$0.setFont(titleFont, forItem: .RetryScreenTitleLabel) | ||
$0.setFont(titleFont, forItem: .RetryScreenRetryButton) | ||
|
||
// Retry screen images. | ||
if #available(iOS 16.0, *) { | ||
$0.setImage(UIImage(systemName: "sun.max.trianglebadge.exclamationmark")!.withTintColor(.black, renderingMode: .alwaysOriginal), | ||
forItem: .RetryScreenHintEnvironment) | ||
$0.setImage(UIImage(systemName: "face.smiling")!.withTintColor(.black, renderingMode: .alwaysOriginal), | ||
forItem: .RetryScreenHintSubject) | ||
} else { | ||
// Use your image assets. | ||
} | ||
|
||
// Success screen colors. | ||
$0.setColor(.systemYellow, forItem: .SuccessScreenBackground) | ||
|
||
// Success screen images. | ||
$0.setImage(UIImage(named: "checkmark")!, forItem: .SuccessScreenImage) | ||
} | ||
FaceSDK.service.customization.configuration = interfaceConfiguration | ||
|
||
FaceSDK.service.startLiveness( | ||
from: viewController, | ||
animated: true, | ||
onLiveness: { [weak self, weak viewController] response in | ||
FaceSDK.service.customization.configuration = nil | ||
guard let self = self, let viewController = viewController else { return } | ||
self.showLivenessResult(response, from: viewController) | ||
}, | ||
completion: nil) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Catalog/Resources/Assets.xcassets/checkmark.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "checkmark.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
45 changes: 2 additions & 43 deletions
45
Catalog/Resources/Assets.xcassets/logo.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters