OndatoSDK 2.5.6

OndatoSDK 2.5.6

Ondato 授权Edgaras SimanaviciusIgnas 维护。



OndatoSDK 2.5.6

  • Ondato

Ondato iOS SDK

目录

概述

此 SDK 为 iOS 应用提供了嵌入式的屏幕和工具集,以捕获身份证明文件和面部照片/实时视频,用于身份验证。SDK 提供了多项优势,以帮助您为顾客创造最佳的入会/身份验证体验

  • 精心设计的 UI 引导顾客完成整个照片/视频捕获过程
  • 模块化设计,帮助您无缝地将照片/视频捕获过程集成到应用流程中
  • 高级图像质量检测技术,确保捕获的图像质量满足 Ondato 身份验证过程的要求,确保最佳成功率
  • 直接将图像上传到 Ondato 服务,简化集成*

* 注意:SDK 负责捕获和上传照片/视频。您仍需要访问 Ondato API 以创建和管理检查。

重要说明

我们建议您锁定应用为横屏方向。

开始使用

  • SDK支持iOS 12.0及以上版本

1. 应用权限

Ondato SDK使用了设备的相机。您需要在应用的Info.plist文件中包含NSCameraUsageDescription键。

<key>NSCameraUsageDescription</key>
<string>Required for document and facial capture</string>

2. 安装

CocoaPods

pod 'OndatoSDK'

3. 初始化和配置 SDK

Swift

// Use provided initializer
Ondato.sdk.setIdentityVerificationId("<Verification Id>")

您可以通过修改配置属性来更改配置

var configuration: OndatoServiceConfiguration = Ondato.sdk.configuration

配置选项包含3个属性

class OndatoServiceConfiguration {
	var appearance: OndatoAppearance
    var flowConfiguration: OndatoFlowConfiguration()
    var mode: OndatoEnvironment
}

模式 可以设置为 "测试" 或 "实时"

enum OndatoEnvironment {
	case test
	case live
}

flowConfiguration 包含多个流程配置选项

class OndatoFlowConfiguration {
    var showSplashScreen: Bool // Should the splash screen be shown
    var showStartScreen: Bool // Should the start screen be shown
    var showSuccessWindow: Bool // Should the success window be shown
    var removeSelfieFrame: Bool // whether to show or to remove the selfie frame in passive liveness check mode
}

外观 包含外观配置选项

class OndatoAppearance {
    
    var logoImage: UIImage // Logo image that can be shown in the splash screen
    var progressColor: UIColor // background color of the `ProgressBarView` which guides the user through the flow
    var buttonColor: UIColor // background color of the primary action buttons
    var buttonTextColor: UIColor // background color of the primary action buttons text
    var errorColor: UIColor // background color of the error message background
    var errorTextColor: UIColor // background color of the error message text color
    var textColor: UIColor // Text color
    var backgroundColor: UIColor //  background color in certain situations
    var consentWindow: OndatoConsentAppearance() // appearance of header, body, acceptButton, declineButton in consent screen

4. 启动流程

Swift

要实例化 SDK ViewController,应调用 instantiateOndatoViewController,如以下示例所示。在你的应用程序中呈现创建的 ViewController。

let sdk = Ondato.sdk.instantiateOndatoViewController()
sdk.modalPresentationStyle = .fullScreen
present(sdk, animated: true, completion: nil) 

OndatoFlowDelegate

为了处理结果,您的视图控制器应实现 OndatoFlowDelegate 方法 onSuccessonFailure,其中包含 OndatoError {CANCELED, BAD_SERVER_RESPONSE}

Ondato.sdk.flowDelegate = T: OndatoFlowDelegate

func flowDidSucceed(identificationId: String?) { // provided identificationId
    
}
func flowDidFail(identificationId: String?, error: OndatoServiceError) { // provided identificationId
    
}

代理还提供了可选方法以替换 Ondato 的窗口/视图为自定义视图

optional func viewControllerForStart(startPressed: @escaping () -> Void) -> UIViewController
optional func viewForSuccess(continue: @escaping () -> Void) -> UIView
optional func viewForLoading(progress: Float) -> UIView

4. 多语言支持

Ondato iOS SDK 内置以下语言环境的翻译

  • 保加利亚语 (bg)🇧🇬
  • 德语 (de) 🇩🇪
  • 希腊语 (el) 🇬🇷
  • 英语 (en) 🇬🇧
  • 西班牙语 (es) 🇪🇸
  • 爱沙尼亚语 (et) 🇪🇪
  • 法语 (fr) 🇫🇷
  • 意大利语 (it) 🇮🇹
  • 立陶宛语 (lt)🇱🇹
  • 拉脱维亚语 (lv) 🇱🇻
  • 荷兰语 (nl) 🇳🇱
  • 罗马尼亚语 (ro)
  • 俄语 (ru) 🇷🇺🇷🇺
  • 阿尔巴尼亚语 (sq) 🇦🇱🇦🇱
OndatoLocalizeHelper.language = OndatoLanguage.EN // .DE, .ET, .EN, .LT, .LV, .RU, .SQ, .BG, .ES, .FR, .EL, .IT, .NL, .RO

要覆盖任何本地化字符串,请传入一个包含一个 Bundle 和该 Bundle 中的 tableName 的一个 .strings 文件,该文件包含必要的翻译。所有键的示例翻译文件位于框架文件旁边

let bundle = Bundle.main
/// let bundle = Bundle.main.path(forResource: "lt", ofType: "bundle")
let localizationBundle = OndatoLocalizationBundle(bundle: budle, tableName: "Localizable")
/// let localizationBundle = OndatoLocalizationBundle.bundle(with: bundle, tableName: "Localizable")
OndatoLocalizeHelper.setLocalizationBundle(bundle, for: .LT)