Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 committed Nov 20, 2023
1 parent 8dbf4e4 commit 47e2ba9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ import Foundation
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
@objc(FIRFederatedAuthProvider) public protocol FederatedAuthProvider: NSObjectProtocol {
#if os(iOS)
/** @fn getCredentialWithUIDelegate:completion:
@brief Used to obtain an auth credential via a mobile web flow.
This method is available on iOS only.
@param UIDelegate An optional UI delegate used to present the mobile web flow.
@param completion Optionally; a block which is invoked asynchronously on the main thread when
the mobile web flow is completed.
*/
@objc optional
func getCredentialWith(_ UIDelegate: AuthUIDelegate?,
completion: ((AuthCredential?, Error?) -> Void)?)

/** @fn getCredentialWithUIDelegate:completion:
@brief Used to obtain an auth credential via a mobile web flow.
This method is available on iOS only.
Expand Down
10 changes: 2 additions & 8 deletions FirebaseAuth/Tests/Unit/AuthTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -846,19 +846,13 @@ class AuthTests: RPCBaseTests {
#if os(iOS)
class FakeProvider: NSObject, FederatedAuthProvider {
@available(iOS 13, tvOS 13, macOS 10.15, watchOS 8, *)
func credential(with UIDelegate: FirebaseAuth.AuthUIDelegate?) async throws ->
FirebaseAuth.AuthCredential {
fatalError("Should not use this async method yet")
}

func getCredentialWith(_ UIDelegate: FirebaseAuth.AuthUIDelegate?,
completion: ((FirebaseAuth.AuthCredential?, Error?) -> Void)?) {
func credential(with UIDelegate: FirebaseAuth.AuthUIDelegate?) async throws -> AuthCredential {
let credential = OAuthCredential(withProviderID: GoogleAuthProvider.id,
sessionID: kOAuthSessionID,
OAuthResponseURLString: kOAuthRequestURI)
XCTAssertEqual(credential.OAuthResponseURLString, kOAuthRequestURI)
XCTAssertEqual(credential.sessionID, kOAuthSessionID)
completion?(credential, nil)
return credential
}
}

Expand Down
23 changes: 2 additions & 21 deletions FirebaseAuth/Tests/Unit/SwiftAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -349,25 +349,11 @@ class AuthAPI_hOnlyTests: XCTestCase {
}

#if os(iOS)
func FIRFederatedAuthProvider_hO() {
class FederatedAuthImplementation: NSObject, FederatedAuthProvider {
// TODO: Document this API breakage - needing to add this functon for classes implementing
// FederatedAuthProvider.
func credential(with UIDelegate: FirebaseAuth
.AuthUIDelegate?) async throws -> AuthCredential {
return FacebookAuthProvider.credential(withAccessToken: "token")
}
func getCredentialWith(_ UIDelegate: AuthUIDelegate?,
completion: ((AuthCredential?, Error?) -> Void)? = nil) {}
}
let obj = FederatedAuthImplementation()
obj.getCredentialWith(nil) { _, _ in
}
}

@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
func FIRFedederatedAuthProvider_hAsync() async throws {
class FederatedAuthImplementation: NSObject, FederatedAuthProvider {
// TODO: Document this API breakage - needing to add this functon for classes implementing
// FederatedAuthProvider.
func credential(with UIDelegate: AuthUIDelegate?) async throws -> AuthCredential {
return FacebookAuthProvider.credential(withAccessToken: "token")
}
Expand All @@ -381,13 +367,8 @@ class AuthAPI_hOnlyTests: XCTestCase {
func credential(with UIDelegate: AuthUIDelegate?) async throws -> AuthCredential {
return FacebookAuthProvider.credential(withAccessToken: "token")
}

func getCredentialWith(_ UIDelegate: AuthUIDelegate?,
completion: ((AuthCredential?, Error?) -> Void)? = nil) {}
}
let obj = FederatedAuthImplementation()
obj.getCredentialWith(nil) { _, _ in
}
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
func FIRFedederatedAuthProvider_hAsync() async throws {
let obj = FederatedAuthImplementation()
Expand Down
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ let package = Package(
// TODO: these tests rely on a non-zero UIApplication.shared. They run from CocoaPods.
"PhoneAuthProviderTests.swift",
"AuthNotificationManagerTests.swift",
"ObjCAPITests.m", // Only builds via CocoaPods until mixed language or its own target.
]
),
.target(
Expand Down

0 comments on commit 47e2ba9

Please sign in to comment.