Skip to content

Commit

Permalink
feat: tvOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbrentkelly committed Aug 20, 2024
1 parent 2c1b008 commit e2a0e60
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ios/NativeBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class NativeBridge: NSObject {
self.domain = domain
self.credentialsManager = CredentialsManager(authentication: auth0)
super.init()

#if os(iOS)
if let localAuthenticationOptions = localAuthenticationOptions {
if let title = localAuthenticationOptions["title"] as? String {
var evaluationPolicy = LAPolicy.deviceOwnerAuthenticationWithBiometrics
Expand All @@ -51,6 +53,8 @@ public class NativeBridge: NSObject {
return
}
}
#endif

resolve(true)
}

Expand Down Expand Up @@ -106,7 +110,7 @@ public class NativeBridge: NSObject {
reject(error.reactNativeErrorCode(), error.errorDescription, error)
}
}
#endif
#endif
}

@objc public func webAuthLogout(federated: Bool, redirectUri: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
Expand Down Expand Up @@ -242,6 +246,7 @@ extension Credentials {
}
}

#if os(iOS)
extension WebAuthError {
func reactNativeErrorCode() -> String {
var code: String
Expand All @@ -262,6 +267,7 @@ extension WebAuthError {
return code
}
}
#endif

extension CredentialsManagerError {
func reactNativeErrorCode() -> String {
Expand All @@ -280,7 +286,7 @@ extension CredentialsManagerError {
code = cause.code
} else {
code = "REVOKE_FAILED"
}
}
case .largeMinTTL: code = "LARGE_MIN_TTL"
default: code = "UNKNOWN"
}
Expand Down

0 comments on commit e2a0e60

Please sign in to comment.