Skip to content

Commit

Permalink
One more try, including macCatalyst
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Mar 22, 2023
1 parent f1ef49b commit 9120bcc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions Sources/OAuthenticator/ASWebAuthenticationSession+Utility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ enum WebAuthenticationSessionError: Error {
case resultInvalid
}

@available(tvOS 16.0, *)
@available(tvOS 16.0, macCatalyst 13.0, *)
extension ASWebAuthenticationSession {
convenience init(url: URL, callbackURLScheme: String, completionHandler: @escaping (Result<URL, Error>) -> Void) {
self.init(url: url, callbackURLScheme: callbackURLScheme, completionHandler: { (resultURL, error) in
Expand All @@ -22,7 +22,7 @@ extension ASWebAuthenticationSession {
}


@available(tvOS 16.0, *)
@available(tvOS 16.0, macCatalyst 13.0, *)
extension ASWebAuthenticationSession {
#if os(iOS) || os(macOS)
@MainActor
Expand All @@ -32,7 +32,10 @@ extension ASWebAuthenticationSession {
continuation.resume(with: result)
})

session.prefersEphemeralWebBrowserSession = true
if #available(macCatalyst 13.1, *) {
session.prefersEphemeralWebBrowserSession = true
}

session.presentationContextProvider = contextProvider

session.start()
Expand All @@ -51,7 +54,9 @@ extension ASWebAuthenticationSession {
continuation.resume(with: result)
})

#if os(watchOS)
session.prefersEphemeralWebBrowserSession = true
#endif

session.start()
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/OAuthenticator/Authenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public final class Authenticator {
public let userAuthenticator: UserAuthenticator
public let mode: UserAuthenticationMode

@available(tvOS 16.0, *)
@available(tvOS 16.0, macCatalyst 13.0, *)
public init(appCredentials: AppCredentials,
loginStorage: LoginStorage? = nil,
tokenHandling: TokenHandling,
Expand Down

0 comments on commit 9120bcc

Please sign in to comment.