ZaigIosFaceRecognitionConfiguration
SDK 5.0.0 and later
let visualConfiguration = VisualConfiguration()
visualConfiguration.setOnboarding(onboardingFilePath: Bundle.main.path(forResource: "onboarding", ofType: "png")!, onboardingWidth: 200)
let textConfiguration = TextConfiguration()
textConfiguration.setCustomText(on: .onboardingTitle, text: "To take a good photo:")
textConfiguration.setCustomText(on: .onboardingFirstLabel, text: "- Go to a well-lit place")
textConfiguration.setCustomText(on: .onboardingSecondLabel, text: "- Remove accessories and show your face clearly")
textConfiguration.setCustomText(on: .onboardingThirdLabel, text: "- Insert your face into the frame, waiting for it to turn green to capture")
let faceRecognitionConfig = ZaigIosFaceRecognitionConfiguration(environment: ZaigIosFaceRecognitionEnvironment.Sandbox,
clientSessionKey: clientSessionKey,
sessionId: "7d8c6f9a-f222-450d-9501-a07c68eb2388",
backgroundColor: "#C9CCD3",
fontColor: "#337DFF",
fontFamily: .open_sans,
showIntroductionScreens: true,
showSuccessScreen: false,
showInvalidTokenScreen: true,
activeFaceLiveness: true,
audioConfiguration: AudioConfiguration.Enable,
logLevel: .debug
)
faceRecognitionConfig.setVisualConfiguration(visualConfiguration: visualConfiguration)
faceRecognitionConfig.setTextConfiguration(textConfiguration: textConfiguration)
The ZaigIosFaceRecognitionConfiguration class is used so you can configure environment, credentials, visual and textual aspects, that is, all the necessary configurations for SDK personalization and operation.
In the table below you will find the details of all arguments that should be used in its instantiation:
| name | type | description |
|---|---|---|
| environment | ZaigIosFaceRecognitionEnvironment | (required) Enumerator that describes the environment. |
| sessionId | string | (optional) Unique ID used to track the entire flow taken by the user in FaceRecon execution through logs. This field accepts up to 255 characters. |
| clientSessionKey | string | (required) Token sent by the face recognition API for SDK authentication. |
| backgroundColor | string | (optional) Hexadecimal of the screen background color. If not specified, the default is #FFFFFF. |
| fontColor | string | (optional) Hexadecimal of the font color. If not specified, the default is #000000. |
| fontFamily | FontFamily | (optional) Font family. If not specified, the default is .open_sans. Available fonts: .open_sans, .futura, .verdana, .trebuchetms, .tamilsangammn and .system_font. |
| showIntroductionScreens | boolean | (optional) Flag that indicates whether the introduction screens, with instructions on how the photo should be captured, should be shown. If not specified, the default is true. |
| showSuccessScreen | boolean | (optional) Flag that indicates whether the success screen, with the success message on capture, should be shown. If not specified, the default is true. |
| showInvalidTokenScreen | boolean | (optional) Flag that indicates whether the authentication failure screen, with the token expiration message, should be shown. If not specified, the default is true. |
| activeFaceLiveness | boolean | (optional) Indicates whether the SDK should perform a user selfie capture procedure or active proof of life. If not specified, the default is false. |
| audioConfiguration | AudioConfiguration | (optional) Indicates whether the SDK should or should not execute indication audios for the user. Accepted configurations are: Enable which will always execute indication audios, Disable which will never execute these audios and Accessibility which executes audios if the user's device has accessibility settings enabled. |
| logLevel | LogLevel | (optional) Used to customize the verbosity level of the SDK logs. Available levels: LogLevel.debug, LogLevel.info, LogLevel.warn, LogLevel.error and LogLevel.trace. If not specified, the default is LogLevel.debug. |
In the table below you will find all methods accepted by the instance for configuration:
| method | arguments | description |
|---|---|---|
| setVisualConfiguration | visualConfiguration : VisualConfiguration | (optional) Class that allows modification of images displayed during SDK execution; |
| setTextConfiguration | textConfiguration : TextConfiguration | (optional) Class that allows modification of texts displayed during SDK execution; |
| setDocumentNumber | Used to define the user's document number. This field accepts 14 characters of CPF formatted as follows 000.000.000-00 | Yes in all calls if using 1:1 validation at some point. |
| setValidation | Used to define whether the SDK should or should not perform 1:1 validation with the user's selfie. In the user's first session this flag must be mandatorily false. This function requires the setDocumentNumber method to be filled. | No. Default is false. |
Previous Versions
Configuration
let visualConfiguration = VisualConfiguration()
visualConfiguration.setOnboarding(onboardingFilePath: Bundle.main.path(forResource: "onboarding", ofType: "png")!, onboardingWidth: 200)
let textConfiguration = TextConfiguration()
textConfiguration.setCustomText(on: .onboardingTitle, text: "To take a good photo:")
textConfiguration.setCustomText(on: .onboardingFirstLabel, text: "- Go to a well-lit place")
textConfiguration.setCustomText(on: .onboardingSecondLabel, text: "- Remove accessories and show your face clearly")
textConfiguration.setCustomText(on: .onboardingThirdLabel, text: "- Insert your face into the frame, waiting for it to turn green to capture")
let faceRecognitionConfig = ZaigIosFaceRecognitionConfiguration(environment: ZaigIosFaceRecognitionEnvironment.Sandbox,
mobileToken: "41fb4755-9bcf-4ae3-b981-b6009e51ce4a",
sessionId: "7d8c6f9a-f222-450d-9501-a07c68eb2388",
backgroundColor: "#C9CCD3",
fontColor: "#337DFF",
fontFamily: .open_sans,
showIntroductionScreens: true,
showSuccessScreen: false,
activeFaceLiveness: true,
audioConfiguration: AudioConfiguration.Enable,
logLevel: .debug
)
faceRecognitionConfig.setVisualConfiguration(visualConfiguration: visualConfiguration)
faceRecognitionConfig.setTextConfiguration(textConfiguration: textConfiguration)
Arguments table
| name | type | description |
|---|---|---|
| environment | ZaigIosFaceRecognitionEnvironment | (required) Enumerator that describes the environment. |
| sessionId | string | (optional) Unique ID used to track the entire flow taken by the user in FaceRecon execution through logs. This field accepts up to 255 characters. |
| mobileToken | string | (required) Token sent by QI Tech for SDK authentication. |
| backgroundColor | string | (optional) Hexadecimal of the screen background color. If not specified, the default is #FFFFFF. |
| fontColor | string | (optional) Hexadecimal of the font color. If not specified, the default is #000000. |
| fontFamily | FontFamily | (optional) Font family. If not specified, the default is .open_sans. Available fonts: .open_sans, .futura, .verdana, .trebuchetms, .tamilsangammn and .system_font. |
| showIntroductionScreens | boolean | (optional) Flag that indicates whether the introduction screens, with instructions on how the photo should be captured, should be shown. If not specified, the default is true. |
| showSuccessScreen | boolean | (optional) Flag that indicates whether the success screen, with the success message on capture, should be shown. If not specified, the default is true. |
| activeFaceLiveness | boolean | (optional) Indicates whether the SDK should perform a user selfie capture procedure or active proof of life. If not specified, the default is false. |
| audioConfiguration | AudioConfiguration | (optional) Indicates whether the SDK should or should not execute indication audios for the user. Accepted configurations are: Enable which will always execute indication audios, Disable which will never execute these audios and Accessibility which executes audios if the user's device has accessibility settings enabled. |
| logLevel | LogLevel | (optional) . Used to customize the verbosity level of the SDK logs. Available levels: LogLevel.debug, LogLevel.info, LogLevel.warn, LogLevel.error and LogLevel.trace. If not specified, the default is LogLevel.debug. |