Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added UnifiedResult and fixed selfie and faceliveness signature.
- Loading branch information
Showing
10 changed files
with
199 additions
and
30 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
12 changes: 3 additions & 9 deletions
12
ZenIDDemo/Controller/Camera/CameraViewControllerDelegate.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 |
---|---|---|
@@ -1,17 +1,11 @@ | ||
// | ||
// CameraViewControllerDelegate.swift | ||
// ZenIDDemo | ||
// | ||
// Created by František Kratochvíl on 21/06/2019. | ||
// Copyright © 2019 Trask, a.s. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import AVFoundation | ||
import RecogLib_iOS | ||
|
||
public protocol CameraViewControllerDelegate: class { | ||
func didTakePhoto(_ imageData: Data?, type: PhotoType, result: DocumentResult?) | ||
|
||
protocol CameraViewControllerDelegate: class { | ||
func didTakePhoto(_ imageData: Data?, type: PhotoType, result: UnifiedResult?) | ||
func didTakeVideo(_ videoAsset: AVURLAsset?, type: PhotoType) | ||
func didFinishPDF() | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
import Foundation | ||
import RecogLib_iOS | ||
|
||
|
||
final class UnifiedDocumentResultAdapter: UnifiedResult { | ||
|
||
let state: UnifiedState | ||
let role: RecogLib_iOS.DocumentRole? | ||
let country: RecogLib_iOS.Country? | ||
let code: RecogLib_iOS.DocumentCode? | ||
let page: RecogLib_iOS.PageCode? | ||
let signature: ImageSignature? | ||
|
||
init(result: DocumentResult) { | ||
state = result.state.toDomain() | ||
role = result.role | ||
country = result.country | ||
code = result.code | ||
page = result.page | ||
signature = result.signature | ||
} | ||
|
||
} | ||
|
||
extension DocumentState { | ||
func toDomain() -> UnifiedState { | ||
switch self { | ||
case .AlignCard: | ||
return .alignCard | ||
case .Blurry: | ||
return .blurry | ||
case .Dark: | ||
return .dark | ||
case .HoldSteady: | ||
return .holdSteady | ||
case .NoMatchFound: | ||
return .notFound | ||
case .Ok: | ||
return .ok | ||
case .Hologram: | ||
return .hologram | ||
case .ReflectionPresent: | ||
return .reflectionPresent | ||
} | ||
} | ||
} |
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,39 @@ | ||
|
||
import Foundation | ||
import RecogLib_iOS | ||
|
||
|
||
final class UnifiedFacelivenessResultAdapter: UnifiedResult { | ||
|
||
let state: UnifiedState | ||
let role: RecogLib_iOS.DocumentRole? | ||
let country: RecogLib_iOS.Country? | ||
let code: RecogLib_iOS.DocumentCode? | ||
let page: RecogLib_iOS.PageCode? | ||
let signature: ImageSignature? | ||
|
||
init(result: FaceLivenessResult) { | ||
state = result.faceLivenessState.toDomain() | ||
role = nil | ||
country = nil | ||
code = nil | ||
page = nil | ||
signature = result.signature | ||
} | ||
|
||
} | ||
|
||
extension FaceLivenessState { | ||
func toDomain() -> UnifiedState { | ||
switch self { | ||
case .LookAtMe: | ||
return .lookAtMe | ||
case .TurnHead: | ||
return .turnHead | ||
case .Smile: | ||
return .smile | ||
case .Ok: | ||
return .ok | ||
} | ||
} | ||
} |
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,13 @@ | ||
|
||
import Foundation | ||
import RecogLib_iOS | ||
|
||
|
||
protocol UnifiedResult { | ||
var state: UnifiedState { get } | ||
var role: RecogLib_iOS.DocumentRole? { get } | ||
var country: RecogLib_iOS.Country? { get } | ||
var code: RecogLib_iOS.DocumentCode? { get } | ||
var page: RecogLib_iOS.PageCode? { get } | ||
var signature: RecogLib_iOS.ImageSignature? { get } | ||
} |
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,41 @@ | ||
|
||
import Foundation | ||
import RecogLib_iOS | ||
|
||
|
||
final class UnifiedSelfieResultAdapter: UnifiedResult { | ||
|
||
let state: UnifiedState | ||
let role: RecogLib_iOS.DocumentRole? | ||
let country: RecogLib_iOS.Country? | ||
let code: RecogLib_iOS.DocumentCode? | ||
let page: RecogLib_iOS.PageCode? | ||
let signature: ImageSignature? | ||
|
||
init(result: SelfieResult) { | ||
state = result.selfieState.toDomain() | ||
role = nil | ||
country = nil | ||
code = nil | ||
page = nil | ||
signature = result.signature | ||
} | ||
|
||
} | ||
|
||
extension SelfieState { | ||
func toDomain() -> UnifiedState { | ||
switch self { | ||
case .ConfirmingFace: | ||
return .confirming | ||
case .Blurry: | ||
return .blurry | ||
case .Dark: | ||
return .dark | ||
case .NoFaceFound: | ||
return .notFound | ||
case .Ok: | ||
return .ok | ||
} | ||
} | ||
} |
Oops, something went wrong.