Skip to content

Commit

Permalink
Release FaceSDK 3.0.792
Browse files Browse the repository at this point in the history
  • Loading branch information
pkandrashkou committed Jul 22, 2021
2 parents 6af2ea5 + 61dd9d1 commit 0f3eb3b
Show file tree
Hide file tree
Showing 52 changed files with 596 additions and 63 deletions.
105 changes: 100 additions & 5 deletions Catalog.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Catalog/Core/CatalogTableDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ final class CatalogTableDataProvider {

LivenessCameraSwitchItem(),
LivenessAttemptsCountItem(),
LivenessHintAnimationItem(),
FaceCaptureCameraPositionItem(),
FaceCaptureHintAnimationItem(),

LivenessHintViewAppearanceItem(),
LivenessHintPositionItem(),
LivenessHideTorchItem(),
LivenessToolbarAppearanceItem(),
LivenessToolbarPositionItem(),
LivenessToolbarCustomButtonItem(),
LivenessToolbarCustomColors(),
LivenessLogoItem(),
FaceCaptureBackgroundColor(),

Expand Down
2 changes: 1 addition & 1 deletion Catalog/Items/Basic/FaceCaptureDefaultItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class FaceCaptureDefaultItem: CatalogItem {
}

override func onItemSelected(from viewController: UIViewController) {
Face.service.presentCaptureViewController(
FaceSDK.service.presentFaceCaptureViewController(
from: viewController,
animated: true,
onCapture: { [weak self, weak viewController] response in
Expand Down
2 changes: 1 addition & 1 deletion Catalog/Items/Basic/LivenessDefaultItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class LivenessDefaultItem: CatalogItem {
}

override func onItemSelected(from viewController: UIViewController) {
Face.service.startLiveness(
FaceSDK.service.startLiveness(
from: viewController,
animated: true,
onLiveness: { [weak self, weak viewController] response in
Expand Down
4 changes: 2 additions & 2 deletions Catalog/Items/Basic/MatchFacesRequestItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ final class MatchFacesRequestViewController: UIViewController {
private func createImageForPosition(_ position: Position, completion: @escaping (Image?) -> Void) {
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Regula FaceCaptureUI", style: .default, handler: { _ in
Face.service.presentCaptureViewController(
FaceSDK.service.presentFaceCaptureViewController(
from: self,
animated: true,
onCapture: { response in
Expand Down Expand Up @@ -211,7 +211,7 @@ final class MatchFacesRequestViewController: UIViewController {
self.matchFacesButton.isEnabled = false
self.clearButton.isEnabled = false

Face.service.matchFaces(request, completion: { (response: MatchFacesResponse) in
FaceSDK.service.matchFaces(request, completion: { (response: MatchFacesResponse) in
self.matchFacesButton.isEnabled = true
self.clearButton.isEnabled = true

Expand Down
3 changes: 1 addition & 2 deletions Catalog/Items/Features/FaceCaptureCameraPositionItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ final class FaceCaptureCameraPositionItem: CatalogItem {
let configuration = FaceCaptureConfiguration {
$0.cameraPosition = .back
}

Face.service.presentCaptureViewController(
FaceSDK.service.presentFaceCaptureViewController(
from: viewController,
animated: true,
configuration: configuration,
Expand Down
35 changes: 35 additions & 0 deletions Catalog/Items/Features/FaceCaptureHintAnimationItem.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// FaceCaptureHintAnimationItem.swift
// Catalog
//
// Created by Pavel Kondrashkov on 5/31/21.
// Copyright © 2021 Regula. All rights reserved.
//

import FaceSDK

final class FaceCaptureHintAnimationItem: CatalogItem {
override init() {
super.init()

title = "Disable FaceCapture HintView animation"
itemDescription = "Disables blinking HintView animation for FaceCapture."
category = .feature
}

override func onItemSelected(from viewController: UIViewController) {
let configuration = FaceCaptureConfiguration {
$0.isHintAnimationEnabled = false
}

FaceSDK.service.presentFaceCaptureViewController(
from: viewController,
animated: true,
configuration: configuration,
onCapture: { [weak self, weak viewController] response in
guard let self = self, let viewController = viewController else { return }
self.showFaceCaptureResult(response, from: viewController)
},
completion: nil)
}
}
4 changes: 2 additions & 2 deletions Catalog/Items/Features/LivenessAttemptsCountItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ final class LivenessAttemptsCountItem: CatalogItem {

override func onItemSelected(from viewController: UIViewController) {
let configuration = LivenessConfiguration {
$0.attemptsCount = 2;
$0.attemptsCount = 2
}

Face.service.startLiveness(
FaceSDK.service.startLiveness(
from: viewController,
animated: true,
configuration: configuration,
Expand Down
2 changes: 1 addition & 1 deletion Catalog/Items/Features/LivenessCameraSwitchItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class LivenessCameraSwitchItem: CatalogItem {
$0.cameraSwitchEnabled = true
}

Face.service.startLiveness(
FaceSDK.service.startLiveness(
from: viewController,
animated: true,
configuration: configuration,
Expand Down
36 changes: 36 additions & 0 deletions Catalog/Items/Features/LivenessHintAnimationItem.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// LivenessHintAnimationItem.swift
// Catalog
//
// Created by Pavel Kondrashkov on 5/31/21.
// Copyright © 2021 Regula. All rights reserved.
//

import FaceSDK

final class LivenessHintAnimationItem: CatalogItem {
override init() {
super.init()

title = "Disable Liveness HintView animation"
itemDescription = "Disables blinking HintView animation for Liveness."
category = .feature
}

override func onItemSelected(from viewController: UIViewController) {
let configuration = LivenessConfiguration {
$0.isHintAnimationEnabled = false
}

FaceSDK.service.startLiveness(
from: viewController,
animated: true,
configuration: configuration,
onLiveness: { [weak self, weak viewController] response in
guard let self = self, let viewController = viewController else { return }
self.showLivenessResult(response, from: viewController)
},
completion: nil
)
}
}
9 changes: 5 additions & 4 deletions Catalog/Items/Other/LocalizationHandlerItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class LocalizationHandlerItem: CatalogItem {

override func onItemSelected(from viewController: UIViewController) {

Face.service.localizationHandler = { localizationKey in
FaceSDK.service.localizationHandler = { localizationKey in
// This will look up localization in `CustomLocalization.strings`.
let result = NSLocalizedString(localizationKey, tableName: "CustomLocalization", comment: "")

Expand All @@ -29,21 +29,22 @@ final class LocalizationHandlerItem: CatalogItem {
}

// Custom key lookup.
if localizationKey == "faceSDKMoveCloser" {
// You can find all the keys listed in `.strings` located at `FaceSDK.framework/FaceSDK.bundle/` path.
if localizationKey == "hint.moveCloser" {
return "Handler: Move Closer"
}

// Fallback to default localization provided by SDK
return nil
}

Face.service.startLiveness(
FaceSDK.service.startLiveness(
from: viewController,
animated: true,
onLiveness: { [weak self, weak viewController] response in
guard let self = self, let viewController = viewController else { return }
self.showLivenessResult(response, from: viewController)
Face.service.localizationHandler = nil
FaceSDK.service.localizationHandler = nil
},
completion: nil
)
Expand Down
2 changes: 1 addition & 1 deletion Catalog/Items/Other/URLRequestInterceptorItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class URLRequestInterceptorItem: CatalogItem {
}

override func onItemSelected(from viewController: UIViewController) {
let service = Face.service
let service = FaceSDK.service
service.requestInterceptingDelegate = self
service.startLiveness(
from: viewController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@ final class FaceCaptureBackgroundColor: CatalogItem {
super.init()

title = "Face Capture background color"
itemDescription = "Changes default background color of the overlay."
itemDescription = "Changes default background color of the overlay. Only for FaceCapture."
category = .viewCustomization
}

override func onItemSelected(from viewController: UIViewController) {
// Note: This appearance modification can not be applied to the FaceCapture Liveness Module
// because of the security and accuracy constraints.

let appearance = FaceCaptureContentView.appearance()
appearance.setBackgroundColor(.init(hex: "#FEE9FF"), for: .front)
appearance.setBackgroundColor(.init(hex: "#6F5685"), for: .rear)

let configuration = FaceCaptureConfiguration {
$0.cameraSwitchEnabled = true
}

Face.service.presentCaptureViewController(
FaceSDK.service.presentFaceCaptureViewController(
from: viewController,
animated: true,
configuration: configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class LivenessHideTorchItem: CatalogItem {
$0.registerClass(Toolbar.self, forBaseClass: CameraToolbarView.self)
}

Face.service.startLiveness(
FaceSDK.service.startLiveness(
from: viewController,
animated: true,
configuration: configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class LivenessHintPositionItem: CatalogItem {
$0.registerClass(ContentView.self, forBaseClass: LivenessContentView.self)
}

Face.service.startLiveness(
FaceSDK.service.startLiveness(
from: viewController,
animated: true,
configuration: configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class LivenessHintViewAppearanceItem: CatalogItem {
let hintLabelAppearance = UILabel.appearance(whenContainedInInstancesOf: [HintView.self, LivenessContentView.self])
hintLabelAppearance.font = UIFont(name: "ChalkboardSE-Regular", size: 40)

Face.service.startLiveness(
FaceSDK.service.startLiveness(
from: viewController,
animated: true,
onLiveness: { [weak self, weak viewController] response in
Expand Down
2 changes: 1 addition & 1 deletion Catalog/Items/ViewCustomization/LivenessLogoItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class LivenessLogoItem: CatalogItem {
$0.registerClass(ContentView.self, forBaseClass: LivenessContentView.self)
}

Face.service.startLiveness(
FaceSDK.service.startLiveness(
from: viewController,
animated: true,
configuration: configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ final class LivenessToolbarAppearanceItem: CatalogItem {
override func onItemSelected(from viewController: UIViewController) {
let toolbarAppearance = CameraToolbarView.appearance(whenContainedInInstancesOf: [LivenessContentView.self])
toolbarAppearance.backgroundColor = .windsor
toolbarAppearance.setTintColor(.init(hex: "#84B1CB"), for: .front)

let toolbarButtonAppearance = UIButton.appearance(whenContainedInInstancesOf: [CameraToolbarView.self, LivenessContentView.self])
toolbarButtonAppearance.backgroundColor = .black
toolbarButtonAppearance.tintColor = .init(hex: "#84B1CB")

Face.service.startLiveness(
FaceSDK.service.startLiveness(
from: viewController,
animated: true,
onLiveness: { [weak self, weak viewController] response in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class LivenessToolbarCustomButtonItem: CatalogItem {
override init() {
super.init()

title = "Liveness CameraToolbarView custom close button."
title = "Liveness CameraToolbarView custom close button"
itemDescription = "Overriden CameraToolbarView class."
category = .viewCustomization
}
Expand All @@ -51,7 +51,7 @@ final class LivenessToolbarCustomButtonItem: CatalogItem {
$0.registerClass(Toolbar.self, forBaseClass: CameraToolbarView.self)
}

Face.service.startLiveness(
FaceSDK.service.startLiveness(
from: viewController,
animated: true,
configuration: configuration,
Expand Down
56 changes: 56 additions & 0 deletions Catalog/Items/ViewCustomization/LivenessToolbarCustomColors.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// LivenessToolbarCustomColors.swift
// Catalog
//
// Created by Pavel Kondrashkov on 6/22/21.
// Copyright © 2021 Regula. All rights reserved.
//

import FaceSDK

final class LivenessToolbarCustomColors: CatalogItem {
final class Toolbar: CameraToolbarView {
override func updateState(_ state: CameraToolbarViewState) {
switch state {
case .front:
self.backgroundColor = .windsor
self.torchButton?.tintColor = .white
self.switchCameraButton?.tintColor = .white
self.closeButton?.tintColor = .white
case .rear:
self.backgroundColor = .white
self.torchButton?.tintColor = .windsor
self.switchCameraButton?.tintColor = .windsor
self.closeButton?.tintColor = .windsor
@unknown default:
fatalError("Unexpected state")
}
}
}

override init() {
super.init()

title = "Liveness CameraToolbarView custom colors"
itemDescription = "Overriden CameraToolbarView class reacts to Camera state changes."
category = .viewCustomization
}

override func onItemSelected(from viewController: UIViewController) {
let configuration = LivenessConfiguration {
$0.cameraSwitchEnabled = true
$0.registerClass(Toolbar.self, forBaseClass: CameraToolbarView.self)
}

FaceSDK.service.startLiveness(
from: viewController,
animated: true,
configuration: configuration,
onLiveness: { [weak self, weak viewController] response in
guard let self = self, let viewController = viewController else { return }
self.showLivenessResult(response, from: viewController)
},
completion: nil
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class LivenessToolbarPositionItem: CatalogItem {
$0.registerClass(ContentView.self, forBaseClass: LivenessContentView.self)
}

Face.service.startLiveness(
FaceSDK.service.startLiveness(
from: viewController,
animated: true,
configuration: configuration,
Expand Down
Loading

0 comments on commit 0f3eb3b

Please sign in to comment.