diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift index ea3359801d7..5fe10d023d5 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift @@ -186,7 +186,7 @@ import CommonCrypto the mobile web flow is completed. */ @objc(getCredentialWithUIDelegate:completion:) - public func getCredentialWith(_ UIDelegate: AuthUIDelegate?, + public func getCredentialWith(_ uiDelegate: AuthUIDelegate?, completion: ((AuthCredential?, Error?) -> Void)? = nil) { guard let urlTypes = auth.mainBundleUrlTypes, AuthWebUtils.isCallbackSchemeRegistered(forCustomURLScheme: callbackScheme, @@ -222,7 +222,7 @@ import CommonCrypto callbackScheme: self.callbackScheme) } self.auth.authURLPresenter.present(headfulLiteURL, - uiDelegate: UIDelegate, + uiDelegate: uiDelegate, callbackMatcher: callbackMatcher) { callbackURL, error in if let error { callbackOnMainThread(nil, error) @@ -260,9 +260,9 @@ import CommonCrypto @return An `AuthCredential`. */ @available(iOS 13, tvOS 13, macOS 10.15, watchOS 8, *) - public func credential(with UIDelegate: AuthUIDelegate?) async throws -> AuthCredential { + public func credential(with uiDelegate: AuthUIDelegate?) async throws -> AuthCredential { return try await withCheckedThrowingContinuation { continuation in - getCredentialWith(UIDelegate) { credential, error in + getCredentialWith(uiDelegate) { credential, error in if let credential = credential { continuation.resume(returning: credential) } else { diff --git a/FirebaseAuth/Tests/Unit/SwiftAPI.swift b/FirebaseAuth/Tests/Unit/SwiftAPI.swift index 5d8d22331e7..dcb362c31fc 100644 --- a/FirebaseAuth/Tests/Unit/SwiftAPI.swift +++ b/FirebaseAuth/Tests/Unit/SwiftAPI.swift @@ -32,6 +32,8 @@ class AuthAPI_hOnlyTests: XCTestCase { // Each function corresponds with a public header. func FIRActionCodeSettings_h() { let codeSettings = FirebaseAuth.ActionCodeSettings() + // Currently kept for backwards compatibility? + codeSettings.setIOSBundleID("abc") codeSettings.iOSBundleID = "abc" codeSettings.setAndroidPackageName("name", installIfNotAvailable: true, minimumVersion: "10.0") let _: Bool = codeSettings.handleCodeInApp @@ -107,10 +109,7 @@ class AuthAPI_hOnlyTests: XCTestCase { auth.signIn(withEmail: "abc@abc.com", link: "link") { result, error in } #if os(iOS) - let provider = OAuthProvider( - providerID: GoogleAuthProvider.id, - auth: FirebaseAuth.Auth.auth() - ) + let provider = OAuthProvider(providerID: "abc") auth.signIn(with: provider, uiDelegate: nil) { result, error in } provider.getCredentialWith(nil) { credential, error in @@ -172,15 +171,15 @@ class AuthAPI_hOnlyTests: XCTestCase { } @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) - func FIRAuth_hAsync() async throws { + func FIRAuth_hAsync(credential: AuthCredential) async throws { let auth = FirebaseAuth.Auth.auth() let user = auth.currentUser! try await auth.updateCurrentUser(user) _ = try await auth.fetchSignInMethods(forEmail: "abc@abc.com") _ = try await auth.signIn(withEmail: "abc@abc.com", password: "password") _ = try await auth.signIn(withEmail: "abc@abc.com", link: "link") - let provider = OAuthProvider(providerID: "abc") #if os(iOS) + let provider = OAuthProvider(providerID: "abc") let credential = try await provider.credential(with: nil) _ = try await auth.signIn(with: credential) _ = try await auth.signIn(with: OAuthProvider(providerID: "abc"), uiDelegate: nil) @@ -351,8 +350,8 @@ class AuthAPI_hOnlyTests: XCTestCase { _ = FacebookAuthProvider.credential(withAccessToken: "token") } - #if !os(macOS) && !os(watchOS) - func FIRFedederatedAuthProvider_h() { + #if os(iOS) + func FIRFederatedAuthProvider_h() { class FederatedAuthImplementation: NSObject, FederatedAuthProvider { @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) func credential(with UIDelegate: AuthUIDelegate?) async throws -> FirebaseAuth @@ -444,6 +443,7 @@ class AuthAPI_hOnlyTests: XCTestCase { let credential = provider.credential(withVerificationID: "id", verificationCode: "code") if let obj = error + // TODO: AuthErrorUserInfoMultiFactorResolverKey .userInfo[AuthErrors.userInfoMultiFactorResolverKey] as? MultiFactorResolver { obj.resolveSignIn(with: PhoneMultiFactorGenerator.assertion(with: credential)) { _, _ in } @@ -490,7 +490,7 @@ class AuthAPI_hOnlyTests: XCTestCase { @available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *) func FIROAuthProvider_h() async throws { - let provider = OAuthProvider(providerID: GoogleAuthProvider.id, auth: FirebaseAuth.Auth.auth()) + let provider = OAuthProvider(providerID: "abc") #if os(iOS) provider.getCredentialWith(provider as? AuthUIDelegate) { credential, error in }