Skip to content

Commit

Permalink
Merge pull request #231 from tangem/IOS-1943-passing-user-cancelled-f…
Browse files Browse the repository at this point in the history
…rom-biometrics

IOS-1943 Passing userCancelled from biometrics
  • Loading branch information
megakoko authored Nov 16, 2022
2 parents 60a5ed8 + 8bcc8bf commit 30d4a2a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions TangemSdk/TangemSdk/Common/Services/Secure/BiometricsUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,21 @@ public final class BiometricsUtil {
DispatchQueue.global().async {
context.evaluatePolicy(authenticationPolicy, localizedReason: localizedReason) { isSuccess, error in
DispatchQueue.main.async {
if let error = error {
completion(.failure(error.toTangemSdkError()))
} else {
guard let error = error else {
completion(.success(context))
return
}

guard let laError = error as? LAError else {
completion(.failure(error.toTangemSdkError()))
return
}

switch laError.code {
case .userCancel, .appCancel, .systemCancel:
completion(.failure(.userCancelled))
default:
completion(.failure(error.toTangemSdkError()))
}
}
}
Expand Down

0 comments on commit 30d4a2a

Please sign in to comment.