Skip to content

Commit

Permalink
fix switch case
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasbambullis committed May 8, 2024
1 parent b362bb1 commit feb0f19
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions ios/Plugin/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ public class FaceId: CAPPlugin {
let _ = authContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
switch(authContext.biometryType) {
case .none:
call.success([
call.resolve([
"value": "None"
])
case .touchID:
call.success([
call.resolve([
"value": "TouchId"
])
case .faceID:
call.success([
call.resolve([
"value": "FaceId"
])
default:
call.resolve([
"value": "None"
])
}
} else {
call.success([
Expand All @@ -44,10 +48,10 @@ public class FaceId: CAPPlugin {
authContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason ) { success, error in
if success {
DispatchQueue.main.async {
call.success()
call.resolve()
}
} else {
call.error(error?.localizedDescription ?? "Failed to authenticate")
call.reject(error?.localizedDescription ?? "Failed to authenticate")
}
}
}
Expand Down

0 comments on commit feb0f19

Please sign in to comment.