diff --git a/README.md b/README.md index 74cbfb7..d92f69d 100644 --- a/README.md +++ b/README.md @@ -12,44 +12,46 @@ To get this sample running, please follow the instructions : 2. To be able to fetch IDCheckIOSDK, you need to have a .netrc file with your credentials given by our team to let Cocoapods authenticate through our Nexus repository. Just create a .netrc file in the root directory of your user and add the following lines : -``` - machine repoman.rennes.ariadnext.com - login YOUR_LOGIN - password YOUR_PASSWORD -``` -3. Open your terminal and execute the following commands in order to install dependencies: - ``` -$ cd idcheckio-sdk-sample-ios -$ pod install -``` + ``` + machine repoman.rennes.ariadnext.com + login YOUR_LOGIN + password YOUR_PASSWORD + ``` -⚠️ Cocoapods v1.10 is needed. -> More information at https://cocoapods.org/ +3. Open your terminal and execute the following commands in order to install dependencies: + ```shell + $ cd idcheckio-sdk-sample-ios + $ pod install --repo-update + ``` -4. Add your SDK's licence + ⚠️ **Cocoapods v1.10 is needed** > More information at https://cocoapods.org/ -To be able to use the sample, please : +4. Add your SDK's token + With your application bundle identifier, ask the [Customer Success Managers](mailto:csm@ariadnext.com) to create an `idToken` to activate the SDK. You can then integrate it in your project using the **Token.swift** file or your own file or variable: -- Add your license file in the `idcheckio-sdk-sample-ios` folder of this project. - - _(same directory as the `idcheckio-sdk-sample-ios.xcworkspace` and the `Podfile`)_ -- Name it "**licence.axt**". + ```swift + import Foundation -> 💡   Do not forget to **edit the sample's app bundle identifier to match the one configured for your license**, otherwise the SDK will throw an invaid license error. + public enum Token: String { + case demo = YOUR_ID_TOKEN" + } + ``` 5. Run the project You are now good to go ! ## Sample application - +​ This sample project aims to showcase all possibilities of the **IDCheck.io Mobile SDK** and the associated best practices regarding these features. It also helps you understand how you can easily integrate the SDK, activate it and customise/adapt it to your application and business needs. - +​ The main screen displays a sliding tile to choose between four distinct capture flows : +​ - **Online flow** : this flow uses the SDK for capturing an ID document first, and then continues with a Biometric Liveness session capture. It shows what you need to do in order to chain multiple online captures and keep transferring the *OnlineContext* through all these captures. - **Simple capture** : this flow has a specific selector to show you how to setup the SDK in order to capture a specific document (from ID to address proof, or even selfie). - - **Advanced capture** : this flow is identical to the *Simple capture* regarding the SDK configuration, but it shows you how you can register your application as a listener to every SDK Interaction and display your own UI over the SDK. This way, yous can easily "override" the SDK while capturing a document and show your own designed screens and messages to the user. + - **IPS session** : Specific capture session that will handle ID + Biometric Liveness capture in the most secure way (PVID certified). - **Analyze** : this flow uses the `Idcheckio.analyze` API which is useful when you don't want to use the camera feed for live-capturing and analyzing a document, but instead use a static image provided by the user from his phone's gallery. - +​ Select the flow you want to try, and click on *Give it a try* button to start capturing documents with the SDK. \ No newline at end of file diff --git a/idcheckio-sdk-sample-ios/Gemfile b/idcheckio-sdk-sample-ios/Gemfile new file mode 100644 index 0000000..1e84d3f --- /dev/null +++ b/idcheckio-sdk-sample-ios/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem 'cocoapods', '~> 1.10' diff --git a/idcheckio-sdk-sample-ios/Gemfile.lock b/idcheckio-sdk-sample-ios/Gemfile.lock new file mode 100644 index 0000000..65c0db1 --- /dev/null +++ b/idcheckio-sdk-sample-ios/Gemfile.lock @@ -0,0 +1,94 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.3) + activesupport (5.2.4.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + atomos (0.1.3) + claide (1.0.3) + cocoapods (1.10.1) + addressable (~> 2.6) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.10.1) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.4.0, < 2.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.6.6) + nap (~> 1.0) + ruby-macho (~> 1.4) + xcodeproj (>= 1.19.0, < 2.0) + cocoapods-core (1.10.1) + activesupport (> 5.0, < 6) + addressable (~> 2.6) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.4) + cocoapods-downloader (1.4.0) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.0) + cocoapods-trunk (1.5.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + colored2 (3.1.2) + concurrent-ruby (1.1.8) + escape (0.0.4) + ethon (0.12.0) + ffi (>= 1.3.0) + ffi (1.14.2) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + httpclient (2.8.3) + i18n (1.8.7) + concurrent-ruby (~> 1.0) + json (2.5.1) + minitest (5.14.3) + molinillo (0.6.6) + nanaimo (0.3.0) + nap (1.1.0) + netrc (0.11.0) + public_suffix (5.0.0) + ruby-macho (1.4.0) + thread_safe (0.3.6) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.9) + thread_safe (~> 0.1) + xcodeproj (1.19.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + +PLATFORMS + ruby + x86_64-darwin-20 + +DEPENDENCIES + cocoapods (~> 1.10) + +BUNDLED WITH + 2.2.6 diff --git a/idcheckio-sdk-sample-ios/Podfile b/idcheckio-sdk-sample-ios/Podfile index d25e0a4..1a4bb50 100644 --- a/idcheckio-sdk-sample-ios/Podfile +++ b/idcheckio-sdk-sample-ios/Podfile @@ -8,6 +8,6 @@ target 'idcheckio-sdk-sample-ios' do use_frameworks! platform :ios, '12.0' # Pods for idcheckio-sdk-sample-ios - pod 'IDCheckIOSDK', '6.1.0' + pod 'IDCheckIOSDK', '7.0.0' end diff --git a/idcheckio-sdk-sample-ios/Podfile.lock b/idcheckio-sdk-sample-ios/Podfile.lock index a030e0b..3207dff 100644 --- a/idcheckio-sdk-sample-ios/Podfile.lock +++ b/idcheckio-sdk-sample-ios/Podfile.lock @@ -1,25 +1,16 @@ PODS: - - IDCheckIOSDK (6.0.0): - - Starscream (~> 4.0.4) - - SwiftProtobuf (~> 1.6.0) - - Starscream (4.0.4) - - SwiftProtobuf (1.6.0) + - IDCheckIOSDK (7.0.0) DEPENDENCIES: - - IDCheckIOSDK (= 6.0.0) + - IDCheckIOSDK (= 7.0.0) SPEC REPOS: https://git-externe.rennes.ariadnext.com/idcheckio/axt-podspecs.git: - IDCheckIOSDK - https://github.com/CocoaPods/Specs.git: - - Starscream - - SwiftProtobuf SPEC CHECKSUMS: - IDCheckIOSDK: 57feccf02a2fba4290480c5cd76280d4a1eb64b1 - Starscream: 5178aed56b316f13fa3bc55694e583d35dd414d9 - SwiftProtobuf: e905ca1366405696411aaf174411c4b19c0ef73d + IDCheckIOSDK: 7e4279e0e41f0e1a54a95f9b6ac70c9e1277adc2 -PODFILE CHECKSUM: 5d0764523ecae94df62bc34b4e56edfe28befd4e +PODFILE CHECKSUM: 9201d6543a7f39c36e278560c1318dfc11109afe -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.3 diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios.xcodeproj/project.pbxproj b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios.xcodeproj/project.pbxproj index 3039221..a7e4fd5 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios.xcodeproj/project.pbxproj +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios.xcodeproj/project.pbxproj @@ -9,6 +9,9 @@ /* Begin PBXBuildFile section */ 7C23A43726AAFEAB00FFA724 /* ExternalAccessory.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C23A43626AAFEAB00FFA724 /* ExternalAccessory.framework */; }; 7CB20C1A269835D400AD4B7A /* SDKConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CB20C19269835D400AD4B7A /* SDKConfig.swift */; }; + A833763628FDA72C00722F0F /* IpsSessionCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = A833763528FDA72C00722F0F /* IpsSessionCoordinator.swift */; }; + A833763828FDA73300722F0F /* IpsFlowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A833763728FDA73300722F0F /* IpsFlowViewController.swift */; }; + A899911928FDA5B80019EC7A /* Token.swift in Sources */ = {isa = PBXBuildFile; fileRef = A899911828FDA5B80019EC7A /* Token.swift */; }; B603EDD825F76CE200E2CE7A /* OnlineFlowCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B603EDD725F76CE200E2CE7A /* OnlineFlowCoordinator.swift */; }; B603EDDB25F775DB00E2CE7A /* OnlineFlowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B603EDDA25F775DB00E2CE7A /* OnlineFlowViewController.swift */; }; B60857BE25C07F6300AABCBB /* Coordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B60857BD25C07F6300AABCBB /* Coordinator.swift */; }; @@ -17,14 +20,11 @@ B611BED125E4126900F0A145 /* DisplayInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B611BED025E4126900F0A145 /* DisplayInfoViewController.swift */; }; B611BEEB25E41B7800F0A145 /* DisplayInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B611BEEA25E41B7800F0A145 /* DisplayInfoView.swift */; }; B611BEEE25E41BA500F0A145 /* DisplayInfoView.xib in Resources */ = {isa = PBXBuildFile; fileRef = B611BEED25E41BA500F0A145 /* DisplayInfoView.xib */; }; - B62269DE25D19B4C00BAD6E1 /* AdvancedCaptureCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B62269DD25D19B4C00BAD6E1 /* AdvancedCaptureCoordinator.swift */; }; - B62269E225D19C2600BAD6E1 /* AdvancedSessionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B62269E125D19C2600BAD6E1 /* AdvancedSessionViewController.swift */; }; B674365225ECE2DA00F817CF /* ResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B674365125ECE2DA00F817CF /* ResultViewController.swift */; }; B674366425ECF4FF00F817CF /* UIStackView+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = B674366325ECF4FF00F817CF /* UIStackView+Utils.swift */; }; B6750FC025F135DB0011A536 /* AnalyzeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6750FBF25F135DB0011A536 /* AnalyzeManager.swift */; }; B6C9D72B25BF08FC0060B0DE /* SDKScenario.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6C9D72A25BF08FC0060B0DE /* SDKScenario.swift */; }; B6D37A5C25C1C85100D012C8 /* SimpleCaptureCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6D37A5B25C1C85100D012C8 /* SimpleCaptureCoordinator.swift */; }; - B6D37C5E25C2F51000D012C8 /* licence.axt in Resources */ = {isa = PBXBuildFile; fileRef = B6D37C5D25C2F51000D012C8 /* licence.axt */; }; B6D8222825BB1B7500FFF853 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6D8222725BB1B7500FFF853 /* AppDelegate.swift */; }; B6D8222F25BB1B7500FFF853 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B6D8222D25BB1B7500FFF853 /* Main.storyboard */; }; B6D8223125BB1B7700FFF853 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B6D8223025BB1B7700FFF853 /* Assets.xcassets */; }; @@ -40,6 +40,9 @@ 7C23A43526AAFEAB00FFA724 /* idcheckio-sdk-sample-ios.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "idcheckio-sdk-sample-ios.entitlements"; sourceTree = ""; }; 7C23A43626AAFEAB00FFA724 /* ExternalAccessory.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExternalAccessory.framework; path = System/Library/Frameworks/ExternalAccessory.framework; sourceTree = SDKROOT; }; 7CB20C19269835D400AD4B7A /* SDKConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDKConfig.swift; sourceTree = ""; }; + A833763528FDA72C00722F0F /* IpsSessionCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IpsSessionCoordinator.swift; sourceTree = ""; }; + A833763728FDA73300722F0F /* IpsFlowViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IpsFlowViewController.swift; sourceTree = ""; }; + A899911828FDA5B80019EC7A /* Token.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Token.swift; sourceTree = ""; }; B603EDD725F76CE200E2CE7A /* OnlineFlowCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnlineFlowCoordinator.swift; sourceTree = ""; }; B603EDDA25F775DB00E2CE7A /* OnlineFlowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnlineFlowViewController.swift; sourceTree = ""; }; B60857BD25C07F6300AABCBB /* Coordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Coordinator.swift; sourceTree = ""; }; @@ -48,14 +51,11 @@ B611BED025E4126900F0A145 /* DisplayInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayInfoViewController.swift; sourceTree = ""; }; B611BEEA25E41B7800F0A145 /* DisplayInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayInfoView.swift; sourceTree = ""; }; B611BEED25E41BA500F0A145 /* DisplayInfoView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DisplayInfoView.xib; sourceTree = ""; }; - B62269DD25D19B4C00BAD6E1 /* AdvancedCaptureCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedCaptureCoordinator.swift; sourceTree = ""; }; - B62269E125D19C2600BAD6E1 /* AdvancedSessionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdvancedSessionViewController.swift; sourceTree = ""; }; B674365125ECE2DA00F817CF /* ResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResultViewController.swift; sourceTree = ""; }; B674366325ECF4FF00F817CF /* UIStackView+Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+Utils.swift"; sourceTree = ""; }; B6750FBF25F135DB0011A536 /* AnalyzeManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyzeManager.swift; sourceTree = ""; }; B6C9D72A25BF08FC0060B0DE /* SDKScenario.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDKScenario.swift; sourceTree = ""; }; B6D37A5B25C1C85100D012C8 /* SimpleCaptureCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleCaptureCoordinator.swift; sourceTree = ""; }; - B6D37C5D25C2F51000D012C8 /* licence.axt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = licence.axt; sourceTree = ""; }; B6D8222425BB1B7500FFF853 /* idcheckio-sdk-sample-ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "idcheckio-sdk-sample-ios.app"; sourceTree = BUILT_PRODUCTS_DIR; }; B6D8222725BB1B7500FFF853 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; B6D8222E25BB1B7500FFF853 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -92,11 +92,11 @@ B60857BC25C07E1600AABCBB /* Coordinator */ = { isa = PBXGroup; children = ( + A833763528FDA72C00722F0F /* IpsSessionCoordinator.swift */, B60857BD25C07F6300AABCBB /* Coordinator.swift */, B60857C025C07FAE00AABCBB /* MainCoordinator.swift */, B60857C525C086C100AABCBB /* ScenariosCoordinator.swift */, B6D37A5B25C1C85100D012C8 /* SimpleCaptureCoordinator.swift */, - B62269DD25D19B4C00BAD6E1 /* AdvancedCaptureCoordinator.swift */, B603EDD725F76CE200E2CE7A /* OnlineFlowCoordinator.swift */, ); path = Coordinator; @@ -105,7 +105,7 @@ B62269E025D19C0600BAD6E1 /* Sessions */ = { isa = PBXGroup; children = ( - B62269E125D19C2600BAD6E1 /* AdvancedSessionViewController.swift */, + A833763728FDA73300722F0F /* IpsFlowViewController.swift */, B611BED025E4126900F0A145 /* DisplayInfoViewController.swift */, B603EDDA25F775DB00E2CE7A /* OnlineFlowViewController.swift */, ); @@ -141,7 +141,6 @@ B6D8221B25BB1B7500FFF853 = { isa = PBXGroup; children = ( - B6D37C5D25C2F51000D012C8 /* licence.axt */, B6D8222625BB1B7500FFF853 /* idcheckio-sdk-sample-ios */, B6D8222525BB1B7500FFF853 /* Products */, E3BA822A37F50014A0CF68DF /* Pods */, @@ -173,6 +172,7 @@ B6D8223525BB1B7700FFF853 /* Info.plist */, B6C9D72A25BF08FC0060B0DE /* SDKScenario.swift */, 7CB20C19269835D400AD4B7A /* SDKConfig.swift */, + A899911828FDA5B80019EC7A /* Token.swift */, ); path = "idcheckio-sdk-sample-ios"; sourceTree = ""; @@ -259,7 +259,6 @@ B6D8223425BB1B7700FFF853 /* LaunchScreen.storyboard in Resources */, B6D8223125BB1B7700FFF853 /* Assets.xcassets in Resources */, B6D8222F25BB1B7500FFF853 /* Main.storyboard in Resources */, - B6D37C5E25C2F51000D012C8 /* licence.axt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -314,7 +313,6 @@ files = ( B603EDDB25F775DB00E2CE7A /* OnlineFlowViewController.swift in Sources */, B674365225ECE2DA00F817CF /* ResultViewController.swift in Sources */, - B62269DE25D19B4C00BAD6E1 /* AdvancedCaptureCoordinator.swift in Sources */, B611BEEB25E41B7800F0A145 /* DisplayInfoView.swift in Sources */, B611BED125E4126900F0A145 /* DisplayInfoViewController.swift in Sources */, B6D8222825BB1B7500FFF853 /* AppDelegate.swift in Sources */, @@ -323,12 +321,14 @@ B603EDD825F76CE200E2CE7A /* OnlineFlowCoordinator.swift in Sources */, B674366425ECF4FF00F817CF /* UIStackView+Utils.swift in Sources */, B60857C625C086C100AABCBB /* ScenariosCoordinator.swift in Sources */, + A833763628FDA72C00722F0F /* IpsSessionCoordinator.swift in Sources */, B60857C125C07FAE00AABCBB /* MainCoordinator.swift in Sources */, B6D37A5C25C1C85100D012C8 /* SimpleCaptureCoordinator.swift in Sources */, + A833763828FDA73300722F0F /* IpsFlowViewController.swift in Sources */, B6C9D72B25BF08FC0060B0DE /* SDKScenario.swift in Sources */, 7CB20C1A269835D400AD4B7A /* SDKConfig.swift in Sources */, + A899911928FDA5B80019EC7A /* Token.swift in Sources */, B60857BE25C07F6300AABCBB /* Coordinator.swift in Sources */, - B62269E225D19C2600BAD6E1 /* AdvancedSessionViewController.swift in Sources */, B6750FC025F135DB0011A536 /* AnalyzeManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Analyze/AnalyzeManager.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Analyze/AnalyzeManager.swift index 1f268aa..963ddc9 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Analyze/AnalyzeManager.swift +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Analyze/AnalyzeManager.swift @@ -14,8 +14,8 @@ class AnalyzeManager { func start(images: (UIImage, UIImage?), completion: ((Result) -> ())?) { self.finishCompletion = completion - //Activate the SDK with your licence file provided by ARIADNEXT - Idcheckio.shared.activate(withLicenseFilename: "licence.axt", extractData: true, sdkEnvironment: .demo) { (error) in + // Activate the SDK with your token provided by ARIADNEXT + Idcheckio.shared.activate(withToken: Token.demo.rawValue, extractData: true) { error in if let activationError = error { self.finishCompletion?(.failure(activationError)) return @@ -43,8 +43,4 @@ extension AnalyzeManager: IdcheckioDelegate { } finishCompletion?(.success(result)) } - - func idcheckioDidSendEvent(interaction: IdcheckioInteraction, msg: IdcheckioMsg?) { - // Not used here. - } } diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Base.lproj/Main.storyboard b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Base.lproj/Main.storyboard index 3ef9140..b9b6521 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Base.lproj/Main.storyboard +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -211,119 +211,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -439,7 +326,7 @@ - + @@ -479,11 +366,11 @@ - + - + @@ -525,23 +412,14 @@ - - - - + @@ -602,17 +480,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - + diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/ResultViewController.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/ResultViewController.swift index cf6ce16..954c50b 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/ResultViewController.swift +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/ResultViewController.swift @@ -86,10 +86,6 @@ class ResultViewController: UIViewController { super.viewDidLoad() fill() } - - @IBAction func goBack(_ sender: Any) { - navigationController?.popViewController(animated: true) - } func fill() { guard let vm = viewModel, let result = vm.result else { return } diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/ScenariosViewController.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/ScenariosViewController.swift index 39ab771..e2ba6c7 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/ScenariosViewController.swift +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/ScenariosViewController.swift @@ -34,7 +34,7 @@ class ScenariosViewController: UIViewController { @IBOutlet private weak var appDescription: UILabel! { didSet { - appDescription.text = "This is the official sample of the IDCheck.io SDK, a by-product of IDCheck.io produced by Ariadnext. You will find several examples of sdk integration there, you are free to look at the one that best meets your needs.\n\nWarning, to run this sample you will need a license file, for more information you can contact us at the following address: csm@ariadnext.com" + appDescription.text = "This is the official sample of the IDCheck.io SDK, a by-product of IDCheck.io produced by Ariadnext. You will find several examples of sdk integration there, you are free to look at the one that best meets your needs.\n\nWarning, to run this sample you will need a token, for more information you can contact us at the following address: csm@ariadnext.com" } } @IBOutlet private weak var choicesCollectionView: UICollectionView! diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/Sessions/AdvancedSessionViewController.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/Sessions/AdvancedSessionViewController.swift deleted file mode 100644 index 3a11223..0000000 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/Sessions/AdvancedSessionViewController.swift +++ /dev/null @@ -1,345 +0,0 @@ -// -// AdvancedSessionViewController.swift -// idcheckio-sdk-sample-ios -// -// Created by Arthur Josselin on 08/02/2021. -// - -import UIKit -import IDCheckIOSDK - -class AdvancedSessionViewController: UIViewController { - - @IBOutlet weak private var quadView: UIView! - - @IBOutlet weak private var cameraButton: UIButton! { - didSet { - let cornerRadius: CGFloat = cameraButton.frame.width / 2 - cameraButton.isHidden = true - cameraButton.layer.cornerRadius = cornerRadius - } - } - - @IBOutlet weak private var flashButton: UIButton! { - didSet { - let cornerRadius: CGFloat = cameraButton.frame.width / 2 - flashButton.isHidden = true - flashButton.layer.cornerRadius = cornerRadius - } - } - - @IBOutlet weak private var bottomLabelContainer: UIView! { - didSet { - bottomLabelContainer.isHidden = true - } - } - @IBOutlet weak private var informationLabel: UILabel! - - static let storyboardIdentifier = "AdvancedSessionViewControllerIdentifier" - - weak var coordinator: AdvancedCaptureCoordinator? - var scenario: SDKScenario? - - fileprivate var idcheckioViewController: IdcheckioViewController? - fileprivate var quadLayer: CAShapeLayer? - fileprivate var acceptCommand: SDKCommand? - fileprivate var declineCommand: SDKCommand? - fileprivate weak var photoCommand: SDKCommand? - fileprivate weak var flashCommand: SDKCommand? - - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - if let sdkController = segue.destination as? IdcheckioViewController { - self.idcheckioViewController = sdkController - self.prepareSession(controller: sdkController) - } - } - - override func viewDidLoad() { - super.viewDidLoad() - // Needed when view controller is pushed to manage orientation properly. - navigationController?.delegate = self - } - - // Let IdcheckioViewController manage orientation - override var supportedInterfaceOrientations: UIInterfaceOrientationMask { - return idcheckioViewController?.supportedInterfaceOrientations ?? super.supportedInterfaceOrientations - } - - override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation { - return idcheckioViewController?.preferredInterfaceOrientationForPresentation ?? super.preferredInterfaceOrientationForPresentation - } - - override var shouldAutorotate: Bool { - return idcheckioViewController?.shouldAutorotate ?? super.shouldAutorotate - } -} - -fileprivate extension AdvancedSessionViewController { - - func prepareSession(controller: IdcheckioViewController) { - //Set the prameters for your capture session - guard let sdkParams = scenario?.config?.sdkParams, - let sdkExtraParams = scenario?.config?.sdkExtraParams else { - coordinator?.showResult(.failure(ConfigError.emptyConfig)) - return - } - do { - try Idcheckio.shared.setParams(sdkParams) - Idcheckio.shared.extraParameters = sdkExtraParams - } catch { - coordinator?.showResult(.failure(error)) - return - } - //Manage errors that could occur during SDK startup. - controller.startCompletion = { [weak self] (error) in - if let error = error { - self?.handleSdkResult(result: .failure(error)) - } - } - //Set the completion handler for both sdk events and sdk result - controller.eventCompletion = { [weak self] in self?.handleSdkEvent(interaction: $0, msg: $1) } - controller.resultCompletion = { [weak self] in self?.handleSdkResult(result: $0) } - registerInteraction() - } - - func registerInteraction() { - //Register UI interaction - Idcheckio.shared.register(for: .ui, - uiMsgs: [ .clear, - .displayMotion, - .showInitialization, - .hideInitialization, - .showLoading, - .hideLoading, - .showZoom, - .showFlash, - .hideFlash, - .pictureInProgress, - .ocrFailed, - .imageBlur, - .imageGlare, - .showScanAnimation, - .hideScanAnimation, - .showManualButton, - .hideManualButton, - .showScanVersoSkippable, - .showScanVersoNonSkippable, - .wrongSide, - .invalidDocument, - .invalidDocType, - .undefined], - override: true) - - //Register quad ineraction - Idcheckio.shared.register(for: .quad, uiMsgs: nil, override: true) - //Register the data interaction - Idcheckio.shared.register(for: .data, uiMsgs: nil, override: true) - - } - - func handleSdkResult(result: Result) { - coordinator?.showResult(result) - } - - func handleSdkEvent(interaction: IdcheckioInteraction, msg: IdcheckioMsg?) { - switch interaction { - case .ui: - if let msg = msg as? UIMessage { - handleUiEvent(uiMessage: msg) - } - case .quad: - if let msg = msg as? QuadMessage { - handleQuadEvent(quadMessage: msg) - } - case .data: - if let msg = msg as? DataMessage { - handleDataEvent(dataMessage: msg) - } - default: - return - } - } - - func handleDataEvent(dataMessage: DataMessage?) { - guard let msg = dataMessage, let accepteCommand = msg.command(for: .acceptResults), let declineCommand = msg.command(for: .declineResults) else { return } - self.acceptCommand = accepteCommand - self.declineCommand = declineCommand - //Get data from message - //The type of returned data is IdcheckioResult - let data = msg.data - var dataFields = [String: String]() - switch data.document { - case .identity(let id): - id.fields.forEach { (field, data) in - dataFields[field.rawValue] = data.value - } - case .vehicleRegistration(let vehicleRegistration): - vehicleRegistration.fields.forEach { (field, data) in - dataFields[field.rawValue] = data.value - } - default: - break - } - let vm = DisplayInfoViewModel() - vm.dataFields = dataFields - let imageResult = data.images.first - vm.sourceImage = imageResult?.cropped - vm.faceImage = imageResult?.face - showInfoController(vm: vm) - } - - func showInfoController(vm: DisplayInfoViewModel) { - let storyboard = UIStoryboard(name: "Main", bundle: nil) - DispatchQueue.main.async { - if let vc = storyboard.instantiateViewController(withIdentifier: DisplayInfoViewController.storyboardIdentifier) as? DisplayInfoViewController { - vc.viewModel = vm - vc.delegate = self - vc.modalPresentationStyle = .popover - self.present(vc, animated: true) - } - } - } - - func handleQuadEvent(quadMessage: QuadMessage?) { - guard let msg = quadMessage else { return } - if quadMessage?.show == true { - drawQuad(quad: msg.quad) - } else { - removeQuad() - } - } - - func handleUiEvent(uiMessage: UIMessage?) { - switch uiMessage?.msg { - case .clear: - clear() - case .displayMotion: - showInformation(info: "Try to stabilize the device") - case .showInitialization: - showInformation(info: "Initialization") - case .hideInitialization: - clear() - case .showLoading: - showInformation(info: "Loading...") - case .hideLoading: - clear() - case .showZoom: - showInformation(info: "Please get closer to the document") - case .showFlash, .hideFlash: - showFlash(show: uiMessage?.msg == .showFlash) - flashCommand = uiMessage?.command(for: .toggleFlash) - case .showManualButton, .hideManualButton: - showManualButton(show: uiMessage?.msg == .showManualButton) - photoCommand = uiMessage?.command(for: .takePicture) - case .pictureInProgress: - showInformation(info: "Taking picture, please do not move") - case .ocrFailed: - showInformation(info: "Please present the side that includes the Machine Readable Zone") - case .imageBlur: - showInformation(info: "Blur detected. Wait…") - case .imageGlare: - showInformation(info: "Glare detected. Please avoid high luminosity") - case .showScanAnimation: - showInformation(info: "Analyse in progress ...") - case .hideScanAnimation: - clear() - case .wrongSide: - showInformation(info: "Please present the other side of the document") - case .invalidDocument: - showInformation(info: "Invalid or illegible document") - case .invalidDocType: - showInformation(info: "Rejected document") - case .showScanVersoSkippable: - self.acceptCommand = uiMessage?.command(for: .scanVerso) - self.declineCommand = uiMessage?.command(for: .skipVerso) - let vm = DisplayInfoViewModel() - vm.versoSkipable = true - showInfoController(vm: vm) - default: - return - } - } - - func removeQuad() { - DispatchQueue.main.async { - self.quadLayer?.removeFromSuperlayer() - } - } - - func drawQuad(quad: Quad) { - let radius: CGFloat = 8.0 - - let dotPath = UIBezierPath(arcCenter: CGPoint(x: quad.leftTop.x, y: quad.leftTop.y), radius: radius, startAngle: 0, endAngle: 2 * CGFloat.pi, clockwise: true) - dotPath.append(UIBezierPath(arcCenter: CGPoint(x: quad.leftBottom.x, y: quad.leftBottom.y), radius: radius, startAngle: 0, endAngle: 2 * CGFloat.pi, clockwise: true)) - dotPath.append(UIBezierPath(arcCenter: CGPoint(x: quad.rightTop.x, y: quad.rightTop.y), radius: radius, startAngle: 0, endAngle: 2 * CGFloat.pi, clockwise: true)) - dotPath.append(UIBezierPath(arcCenter: CGPoint(x: quad.rightBottom.x, y: quad.rightBottom.y), radius: radius, startAngle: 0, endAngle: 2 * CGFloat.pi, clockwise: true)) - - DispatchQueue.main.async { - self.quadLayer?.removeFromSuperlayer() - self.quadLayer = CAShapeLayer() - self.quadLayer?.path = dotPath.cgPath - self.quadLayer?.fillColor = UIColor.red.cgColor - self.quadLayer?.frame = self.quadView.frame - self.quadView?.layer.addSublayer(self.quadLayer ?? CAShapeLayer()) - } - - } - - func showFlash(show: Bool) { - DispatchQueue.main.async { - self.flashButton.isHidden = !show - } - } - - func showManualButton(show: Bool) { - DispatchQueue.main.async { - self.cameraButton.isHidden = !show - } - } - - func showInformation(info: String) { - DispatchQueue.main.async { - self.informationLabel.text = info - self.bottomLabelContainer.isHidden = false - } - } - - func clear() { - DispatchQueue.main.async { - self.bottomLabelContainer.isHidden = true - } - } - - @IBAction func didTouchFlashButton(sender: Any) { - flashCommand?.execute() - } - - @IBAction func didTouchShutterButton(sender: Any) { - photoCommand?.execute() - } -} - -extension AdvancedSessionViewController: DisplayInfoViewControllerDelegate { - - func confirmDidTap() { - DispatchQueue.main.async { - self.dismiss(animated: true, completion: { - self.acceptCommand?.execute() - }) - } - } - - func cancelDidTap() { - DispatchQueue.main.async { - self.dismiss(animated: true, completion: { - self.declineCommand?.execute() - }) - } - } -} - -extension AdvancedSessionViewController: UINavigationControllerDelegate { - func navigationControllerSupportedInterfaceOrientations(_ navigationController: UINavigationController) -> UIInterfaceOrientationMask { - return navigationController.topViewController?.supportedInterfaceOrientations ?? supportedInterfaceOrientations - } -} diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/Sessions/IpsFlowViewController.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/Sessions/IpsFlowViewController.swift new file mode 100644 index 0000000..c57d203 --- /dev/null +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/Sessions/IpsFlowViewController.swift @@ -0,0 +1,58 @@ +// +// IpsFlowViewController.swift +// idcheckio-sdk-sample-ios +// +// Created by Arthur Josselin on 24/05/2022. +// + +import UIKit + +class IpsFlowViewController: UIViewController { + + static let identifier = "IpsFlowViewController" + + weak var coordinator: IpsSessionCoordinator? + + // MARK: - Outlets + @IBOutlet weak private var headerLabel: UILabel! { + didSet { + headerLabel.text = "Enter your folder UID" + } + } + @IBOutlet weak private var textField: UITextField! { + didSet { + textField.placeholder = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX" + } + } + @IBOutlet weak private var footerLabel: UILabel! { + didSet { + footerLabel.text = "Folder UID can be request to the IPS service. Please contact customer support for more information." + } + } + @IBOutlet weak private var button: UIButton! { + didSet { + button.setTitleColor(.white, for: .normal) + button.backgroundColor = UIColor(named: "BlueAriadnext") + button.setTitle("START", for: .normal) + } + } + + override func viewDidLoad() { + super.viewDidLoad() + navigationController?.navigationBar.isHidden = false + let tap = UITapGestureRecognizer(target: self, action: #selector(UIInputViewController.dismissKeyboard)) + view.addGestureRecognizer(tap) + } + + @IBAction func startAction(_ sender: Any) { + guard textField.text?.isEmpty == false else { + coordinator?.showAlert(error: "File UID must not be empty") + return + } + coordinator?.startSdk(file: textField.text ?? "") + } + + @objc func dismissKeyboard() { + view.endEditing(true) + } +} diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/Sessions/OnlineFlowViewController.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/Sessions/OnlineFlowViewController.swift index 7a37988..a0faa30 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/Sessions/OnlineFlowViewController.swift +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Controllers/Sessions/OnlineFlowViewController.swift @@ -34,6 +34,11 @@ class OnlineFlowViewController: UIViewController { } } + override func viewDidLoad() { + super.viewDidLoad() + navigationController?.navigationBar.isHidden = false + } + var documentType: DocumentType? weak var coordinator: OnlineFlowCoordinator? diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/AdvancedCaptureCoordinator.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/AdvancedCaptureCoordinator.swift deleted file mode 100644 index 435d8bb..0000000 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/AdvancedCaptureCoordinator.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// AdvancedCaptureCoordinator.swift -// idcheckio-sdk-sample-ios -// -// Created by Arthur Josselin on 08/02/2021. -// - -import UIKit -import IDCheckIOSDK - -class AdvancedCaptureCoordinator: Coordinator { - - var childCoordinators = [Coordinator]() - var navigationController: UINavigationController - var parentCoordinator: Coordinator? - - fileprivate var scenario: SDKScenario - - init(navigationController: UINavigationController, sdkScenario: SDKScenario) { - self.navigationController = navigationController - self.scenario = sdkScenario - } - - func start() { - let storyboard = UIStoryboard(name: "Main", bundle: nil) - Idcheckio.shared.activate(withLicenseFilename: "licence.axt", extractData: true, sdkEnvironment: .demo) { error in - if let activationError = error { - self.parentCoordinator?.childDidFinish(self, result: .failure(activationError)) - } else { - if let sessionController = storyboard.instantiateViewController(withIdentifier: AdvancedSessionViewController.storyboardIdentifier) as? AdvancedSessionViewController { - sessionController.scenario = self.scenario - sessionController.coordinator = self - //Enable all supported orientatons in App Delegate in order to launch the SDK in landscape if needed - if let myDelegate = UIApplication.shared.delegate as? AppDelegate { - myDelegate.supportedOrientation = .all - } - self.navigationController.pushViewController(sessionController, animated: true) - } - } - } - } - - func showResult(_ result: Result) { - //Go back to portrait orientaion when the sdk has finished - navigationController.popToRootViewController(animated: true) - if let myDelegate = UIApplication.shared.delegate as? AppDelegate { - myDelegate.supportedOrientation = .portrait - } - parentCoordinator?.childDidFinish(self, result: result) - } -} diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/Coordinator.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/Coordinator.swift index 2e9a112..55e103b 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/Coordinator.swift +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/Coordinator.swift @@ -21,7 +21,7 @@ protocol Coordinator: AnyObject { extension Coordinator { func childDidFinish(_ child: Coordinator, result: Result) {} func displayError(error: String) { - let alert = UIAlertController(title: "Error", message: error, preferredStyle: UIAlertController.Style.alert) + let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: UIAlertController.Style.alert) alert.addAction(UIAlertAction(title: "Ok", style: UIAlertAction.Style.default, handler: nil)) self.navigationController.present(alert, animated: true, completion: nil) } diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/IpsSessionCoordinator.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/IpsSessionCoordinator.swift new file mode 100644 index 0000000..d92b127 --- /dev/null +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/IpsSessionCoordinator.swift @@ -0,0 +1,65 @@ +// +// IpsSessionCoordinator.swift +// idcheckio-sdk-sample-ios +// +// Created by Arthur Josselin on 23/05/2022. +// + +import UIKit +import IDCheckIOSDK + +class IpsSessionCoordinator: Coordinator { + + var childCoordinators = [Coordinator]() + var navigationController: UINavigationController + var parentCoordinator: Coordinator? + + init(navigationController: UINavigationController) { + self.navigationController = navigationController + } + + func start() { + activateSdk() + } + + func showIpsSession() { + let storyboard = UIStoryboard(name: "Main", bundle: nil) + if let vc = storyboard.instantiateViewController(withIdentifier: IpsFlowViewController.identifier ) as? IpsFlowViewController { + vc.coordinator = self + navigationController.pushViewController(vc, animated: true) + } + } + + func showAlert(error: String) { + let alert = UIAlertController(title: "Error", message: error, preferredStyle: UIAlertController.Style.alert) + alert.addAction(UIAlertAction(title: "Ok", style: UIAlertAction.Style.default, handler: nil)) + self.navigationController.present(alert, animated: true, completion: nil) + } +} + +extension IpsSessionCoordinator { + + private func activateSdk() { + // Activate the SDK with your token provided by ARIADNEXT + Idcheckio.shared.activate(withToken: Token.demo.rawValue, extractData: true) { error in + if let activationError = error { + self.parentCoordinator?.childDidFinish(self, result: .failure(activationError)) + } else { + self.showIpsSession() + } + } + } + + func startSdk(file: String) { + Idcheckio.startIps(with: "6e195ca9-73ea-4d73-bec6-9001b9cff41c", from: self.navigationController) { result in + self.navigationController.popViewController(animated: true) + switch result { + case .success: + self.parentCoordinator?.childDidFinish(self, result: .success(nil)) + case .failure(let error): + self.parentCoordinator?.childDidFinish(self, result: .failure(error)) + } + } + } +} + diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/MainCoordinator.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/MainCoordinator.swift index 8b86280..53540f7 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/MainCoordinator.swift +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/MainCoordinator.swift @@ -15,7 +15,7 @@ class MainCoordinator: Coordinator { var scenarios: [SDKScenario] = [SDKScenario(captureType: .onlineFlow), SDKScenario(captureType: .simple), - SDKScenario(captureType: .advanced), + SDKScenario(captureType: .ips), SDKScenario(captureType: .analyze)] init(navigationController: UINavigationController) { diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/OnlineFlowCoordinator.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/OnlineFlowCoordinator.swift index dece572..041d8b4 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/OnlineFlowCoordinator.swift +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/OnlineFlowCoordinator.swift @@ -43,13 +43,12 @@ class OnlineFlowCoordinator: Coordinator { case .id: //Set isReferenceDocument to `true` for an ID that will be a reference document for the liveness session. sdkParams.onlineConfig.isReferenceDocument = true - sdkParams.onlineConfig.checkType = .checkFast default: break } do { try Idcheckio.shared.setParams(sdkParams) - Idcheckio.shared.extraParameters = sdkExtraParams + try Idcheckio.shared.setExtraParams(sdkExtraParams) } catch { parentCoordinator?.childDidFinish(self, result: .failure(error)) return @@ -61,8 +60,8 @@ class OnlineFlowCoordinator: Coordinator { fileprivate extension OnlineFlowCoordinator { func activateSdk() { - //Activate the SDK with your licence file provided by ARIADNEXT - Idcheckio.shared.activate(withLicenseFilename: "licence.axt", extractData: true, sdkEnvironment: .demo) { (error) in + // Activate the SDK with your token provided by ARIADNEXT + Idcheckio.shared.activate(withToken: Token.demo.rawValue, extractData: true) { error in if let activationError = error { self.parentCoordinator?.childDidFinish(self, result: .failure(activationError)) } else { @@ -88,12 +87,6 @@ fileprivate extension OnlineFlowCoordinator { //Give online context from your previous session to link your liveness to the right CIS folder. sessionController.onlineContext = onlineContext sessionController.modalPresentationStyle = .fullScreen - //Manage errors that could occur during SDK startup. - sessionController.startCompletion = { [weak self] (error) in - if let error = error { - self?.handleSdkResult(result: .failure(error)) - } - } //Handle session result or error here sessionController.resultCompletion = { [weak self] in self?.handleSdkResult(result: $0) } //Enable all supported orientatons in App Delegate in order to launch the SDK in landscape if needed diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/ScenariosCoordinator.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/ScenariosCoordinator.swift index 91dd958..6f52bcd 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/ScenariosCoordinator.swift +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/ScenariosCoordinator.swift @@ -42,7 +42,9 @@ class ScenariosCoordinator: Coordinator { showResult(result: result) case .failure(let error): navigationController.popToRootViewController(animated: true) - displayError(error: error.localizedDescription) + // It is useful to log the detail of the error in order to understand what is happening, but this error should not be displayed to the user + print("❌ ERROR : \(error.localizedDescription)") + displayError(error: "An error has occurred, please contact the developers") } } @@ -54,7 +56,9 @@ class ScenariosCoordinator: Coordinator { case .success(let result): weakSelf.showResult(result: result) case .failure(let error): - weakSelf.displayError(error: error.localizedDescription) + // It is useful to log the detail of the error in order to understand what is happening, but this error should not be displayed to the user + print("❌ ERROR : \(error.localizedDescription)") + weakSelf.displayError(error: "An error has occurred, please contact the developers") } } } @@ -65,10 +69,10 @@ class ScenariosCoordinator: Coordinator { switch scenario.captureType { case .simple: sessionCoordinator = SimpleCaptureCoordinator(navigationController: navigationController, sdkScenario: scenario) - case .advanced: - sessionCoordinator = AdvancedCaptureCoordinator(navigationController: navigationController, sdkScenario: scenario) case .onlineFlow: sessionCoordinator = OnlineFlowCoordinator(navigationController: navigationController) + case .ips: + sessionCoordinator = IpsSessionCoordinator(navigationController: navigationController) default: return } diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/SimpleCaptureCoordinator.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/SimpleCaptureCoordinator.swift index 9d5261c..f71285b 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/SimpleCaptureCoordinator.swift +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Coordinator/SimpleCaptureCoordinator.swift @@ -29,8 +29,8 @@ class SimpleCaptureCoordinator: Coordinator { fileprivate extension SimpleCaptureCoordinator { func activateSdk() { - //Activate the SDK with your licence file provided by ARIADNEXT - Idcheckio.shared.activate(withLicenseFilename: "licence.axt", extractData: true, sdkEnvironment: .demo) { (error) in + // Activate the SDK with your token provided by ARIADNEXT + Idcheckio.shared.activate(withToken: Token.demo.rawValue, extractData: true) { error in if let activationError = error { self.parentCoordinator?.childDidFinish(self, result: .failure(activationError)) } else { @@ -48,7 +48,7 @@ fileprivate extension SimpleCaptureCoordinator { } do { try Idcheckio.shared.setParams(sdkParams) - Idcheckio.shared.extraParameters = sdkExtraParams + try Idcheckio.shared.setExtraParams(sdkExtraParams) } catch { parentCoordinator?.childDidFinish(self, result: .failure(error)) return @@ -60,12 +60,6 @@ fileprivate extension SimpleCaptureCoordinator { //Start the capture session let sessionController = IdcheckioViewController() sessionController.modalPresentationStyle = .fullScreen - //Manage errors that could occur during SDK startup. - sessionController.startCompletion = { [weak self] (error) in - if let error = error { - self?.handleSdkResult(result: .failure(error)) - } - } //Handle session result or error here sessionController.resultCompletion = { [weak self] in self?.handleSdkResult(result: $0) } //Enable all supported orientatons in App Delegate in order to launch the SDK in landscape if needed diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/SDKConfig.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/SDKConfig.swift index 9128e41..c9cfa7c 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/SDKConfig.swift +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/SDKConfig.swift @@ -36,7 +36,6 @@ enum SDKConfig: String { switch self { case .id: params.documentType = .id - params.scanBothSides = .enabled params.confirmType = .dataOrPicture let extractionSide1 = Extraction() extractionSide1.codeline = .valid diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/SDKScenario.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/SDKScenario.swift index b820097..c8a3868 100644 --- a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/SDKScenario.swift +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/SDKScenario.swift @@ -11,19 +11,19 @@ import Foundation enum CaptureType { case onlineFlow case simple - case advanced case analyze + case ips var displayName: String { switch self { case .simple: return "Simple capture" - case .advanced: - return "Advanced capture" case .analyze: return "Analyze" case .onlineFlow: return "Online Flow" + case .ips: + return "IPS session" } } @@ -31,18 +31,18 @@ enum CaptureType { switch self { case .simple: return "This sample offers the most basic capture.\nYou must choose a document type here:" - case .advanced: - return "This example shows you how to use the advanced interaction to customize the UI.\nYou must choose a document type here:" case .analyze: return "This example shows you how to use the analyze API to use an image of an ID you already have on your phone." case .onlineFlow: return "This example shows you how to easily integrate the SDK into an online flow.\nIn this example, our flow includes an ID and a LIVENESS" + case .ips: + return "This sample offers to start an IPS session." } } var footer: String { switch self { - case .analyze, .onlineFlow: + case .analyze, .onlineFlow, .ips: return "" default: return "The sdk will then be configured with the recommended settings for this type of document." @@ -55,7 +55,7 @@ class SDKScenario: Equatable { internal init(captureType: CaptureType) { self.captureType = captureType self.config = availableConfigs.first - if captureType == .analyze || captureType == .onlineFlow { + if captureType == .analyze || captureType == .onlineFlow || captureType == .ips { availableConfigs.removeAll() } } diff --git a/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Token.swift b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Token.swift new file mode 100644 index 0000000..651b0fd --- /dev/null +++ b/idcheckio-sdk-sample-ios/idcheckio-sdk-sample-ios/Token.swift @@ -0,0 +1,12 @@ +// +// Token.swift +// idcheckio-sdk-sample-ios +// +// Created by Léa Lefeuvre on 10/10/2022. +// + +import Foundation + +public enum Token: String { + case demo = "YOUR_ID_TOKEN" +}