From 4e81afe18081544fdd484c8663b257786e0df8c5 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Tue, 1 Jul 2025 18:02:42 -0400 Subject: [PATCH 1/2] [Auth] Remove wrapper API that uses deprecated Auth API --- .../Sources/Auth/Auth+Combine.swift | 25 ----- .../Unit/Auth/FetchSignInMethodsTests.swift | 93 ------------------- 2 files changed, 118 deletions(-) delete mode 100644 FirebaseCombineSwift/Tests/Unit/Auth/FetchSignInMethodsTests.swift diff --git a/FirebaseCombineSwift/Sources/Auth/Auth+Combine.swift b/FirebaseCombineSwift/Sources/Auth/Auth+Combine.swift index 96f7c776c64..bfd56be4111 100644 --- a/FirebaseCombineSwift/Sources/Auth/Auth+Combine.swift +++ b/FirebaseCombineSwift/Sources/Auth/Auth+Combine.swift @@ -259,31 +259,6 @@ public extension Auth { } } - // MARK: - Email-based Authentication Helpers - - /// Fetches the list of all sign-in methods previously used for the provided email address. - /// - /// The publisher will emit events on the **main** thread. - /// - /// - Parameter email: The email address for which to obtain a list of sign-in methods. - /// - Returns: A publisher that emits a list of sign-in methods for the specified email - /// address, or an error if one occurred. The publisher will emit on the *main* thread. - /// - Remark: Possible error codes: - /// - `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed. - /// - /// See `AuthErrors` for a list of error codes that are common to all API methods - func fetchSignInMethods(forEmail email: String) -> Future<[String], Error> { - Future<[String], Error> { promise in - self.fetchSignInMethods(forEmail: email) { signInMethods, error in - if let error { - promise(.failure(error)) - } else if let signInMethods { - promise(.success(signInMethods)) - } - } - } - } - // MARK: - Password Reset /// Resets the password given a code sent to the user outside of the app and a new password for diff --git a/FirebaseCombineSwift/Tests/Unit/Auth/FetchSignInMethodsTests.swift b/FirebaseCombineSwift/Tests/Unit/Auth/FetchSignInMethodsTests.swift deleted file mode 100644 index e287cf5445b..00000000000 --- a/FirebaseCombineSwift/Tests/Unit/Auth/FetchSignInMethodsTests.swift +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import Combine -import FirebaseAuth -import Foundation -import XCTest - -class FetchSignInMethodsTests: XCTestCase { - override class func setUp() { - FirebaseApp.configureForTests() - } - - override class func tearDown() { - FirebaseApp.app()?.delete { success in - if success { - print("Shut down app successfully.") - } else { - print("💥 There was a problem when shutting down the app..") - } - } - } - - override func setUp() { - do { - try Auth.auth().signOut() - } catch {} - } - - static let apiKey = Credentials.apiKey - static let email = "johnnyappleseed@apple.com" - - static let emailLinkAuthSignInMethod = "emailLink" - static let facebookAuthSignInMethod = "facebook.com" - - static let allSignInMethods = [ - FetchSignInMethodsTests.emailLinkAuthSignInMethod, - FetchSignInMethodsTests.facebookAuthSignInMethod, - ] - - class MockCreateAuthURIResponse: FIRCreateAuthURIResponse { - override var signinMethods: [String]? { return FetchSignInMethodsTests.allSignInMethods } - } - - class MockAuthBackend: AuthBackendImplementationMock { - override func createAuthURI(_ request: FIRCreateAuthURIRequest, - callback: @escaping FIRCreateAuthURIResponseCallback) { - XCTAssertEqual(request.identifier, FetchSignInMethodsTests.email) - XCTAssertNotNil(request.endpoint) - XCTAssertEqual(request.apiKey, FetchSignInMethodsTests.apiKey) - - callback(MockCreateAuthURIResponse(), nil) - } - } - - func testFetchSignInMethodsForEmail() { - // given - FIRAuthBackend.setBackendImplementation(MockAuthBackend()) - var cancellables = Set() - let fetchSignInMethodsExpectation = expectation(description: "Fetched Sign-in methods") - - // when - Auth.auth() - .fetchSignInMethods(forEmail: FetchSignInMethodsTests.email) - .sink { completion in - switch completion { - case .finished: - print("Finished") - case let .failure(error): - XCTFail("💥 Something went wrong: \(error)") - } - } receiveValue: { signInMethods in - XCTAssertEqual(signInMethods, FetchSignInMethodsTests.allSignInMethods) - - fetchSignInMethodsExpectation.fulfill() - } - .store(in: &cancellables) - - // then - wait(for: [fetchSignInMethodsExpectation], timeout: expectationTimeout) - } -} From e1d0125c8a435a8c454a64d348d5fe47328ded7b Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Tue, 1 Jul 2025 18:24:37 -0400 Subject: [PATCH 2/2] add changelog entry --- FirebaseCombineSwift/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FirebaseCombineSwift/CHANGELOG.md b/FirebaseCombineSwift/CHANGELOG.md index eca4cc9be7c..0a00eff70ca 100644 --- a/FirebaseCombineSwift/CHANGELOG.md +++ b/FirebaseCombineSwift/CHANGELOG.md @@ -1,3 +1,7 @@ +# 12.0.0 +- [removed] Removed `fetchSignInMethods` Combine wrapper as the underlying API + is deprecated. + # 10.8.0 - [fixed] Use caller's encoder when setting document data (#11033).