Bio Login with Backend V1
When setting up Amani for Bio Login, you can use any module under the Selfie Module sections, you need to give the UploadSource parameter in the init method as BIOLOGIN, or you can use the setUploadSource function after initing the Amani SDK.
The usage is as follows:
let amani:Amani = Amani.sharedInstance
amani.initAmani(
server: "<YOUR_SERVER_URL>",
token: "<YOUR_TOKEN>",
apiVersion: .v2
) { customerModel, error in
//If you wish you can set upload source parameter on above initAmani func or you can set directly setUploadSource function.
if let error = error {
print("Amani initAmani failed: \(error.localizedDescription)")
return
}
DispatchQueue.main.async {
do {
// Here you can set directly enum raw value or you can use string value.
amani.setUploadSource(uploadSource: .BIOLOGIN) // "bio_login"
let selfie = amani.selfie()
let view = try selfie.start { previewImage in
print("Amani Selfie captured. previewImage=\(previewImage != nil)")
selfie.upload { isSuccess in
if isSuccess == true {
print("Amani Upload success")
} else {
print("Amani Upload failed")
}
}
}
if let v = view {
print("Amani Selfie Module start func returned a UIView. Add it to your hierarchy.")
} else {
print("Amani Selfie Module start func returned nil view")
}
} catch {
print("Amani Selfie start error: \(error.localizedDescription)")
}
}
}