Skip to content

Commit

Permalink
chore: remove presentationContextProvider from tvOS and watchOS
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev committed Apr 11, 2024
1 parent 5797feb commit bdc757a
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions Sources/Auth/AuthClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -706,10 +706,12 @@ public final class AuthClient: @unchecked Sendable {

configure(session)

if session.presentationContextProvider == nil {
presentationContextProvider = DefaultPresentationContextProvider()
session.presentationContextProvider = presentationContextProvider
}
#if !os(tvOS) && !os(watchOS)
if session.presentationContextProvider == nil {
presentationContextProvider = DefaultPresentationContextProvider()
session.presentationContextProvider = presentationContextProvider
}
#endif

session.start()
}
Expand Down Expand Up @@ -1255,11 +1257,13 @@ extension AuthClient {
public static let authChangeSessionInfoKey = "AuthClient.authChangeSession"
}

@MainActor
final class DefaultPresentationContextProvider: NSObject,
ASWebAuthenticationPresentationContextProviding
{
func presentationAnchor(for _: ASWebAuthenticationSession) -> ASPresentationAnchor {
ASPresentationAnchor()
#if !os(tvOS) && !os(watchOS)
@MainActor
final class DefaultPresentationContextProvider: NSObject,
ASWebAuthenticationPresentationContextProviding
{
func presentationAnchor(for _: ASWebAuthenticationSession) -> ASPresentationAnchor {
ASPresentationAnchor()
}
}
}
#endif

0 comments on commit bdc757a

Please sign in to comment.