diff --git a/FirebaseAuth/Sources/Swift/Auth/Auth.swift b/FirebaseAuth/Sources/Swift/Auth/Auth.swift index 171db121e62..e5ccdaafac7 100644 --- a/FirebaseAuth/Sources/Swift/Auth/Auth.swift +++ b/FirebaseAuth/Sources/Swift/Auth/Auth.swift @@ -219,8 +219,7 @@ extension Auth: AuthInterop { /// - user: The user object to be set as the current user of the calling Auth instance. /// - completion: Optionally; a block invoked after the user of the calling Auth instance has /// been updated or an error was encountered. - @objc open func updateCurrentUser(_ user: User?, - completion: (@Sendable (Error?) -> Void)? = nil) { + @objc open func updateCurrentUser(_ user: User?, completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { guard let user else { let error = AuthErrorUtils.nullUserError(message: nil) @@ -287,7 +286,7 @@ extension Auth: AuthInterop { ) #endif // !FIREBASE_CI @objc open func fetchSignInMethods(forEmail email: String, - completion: (@Sendable ([String]?, Error?) -> Void)? = nil) { + completion: (([String]?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { let request = CreateAuthURIRequest(identifier: email, continueURI: "http://www.google.com/", @@ -351,7 +350,7 @@ extension Auth: AuthInterop { /// or is canceled. Invoked asynchronously on the main thread in the future. @objc open func signIn(withEmail email: String, password: String, - completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) { + completion: ((AuthDataResult?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion) Task { @@ -450,7 +449,7 @@ extension Auth: AuthInterop { /// or is canceled. Invoked asynchronously on the main thread in the future. @objc open func signIn(withEmail email: String, link: String, - completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) { + completion: ((AuthDataResult?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion) let credential = EmailAuthCredential(withEmail: email, link: link) @@ -529,7 +528,7 @@ extension Auth: AuthInterop { @objc(signInWithProvider:UIDelegate:completion:) open func signIn(with provider: FederatedAuthProvider, uiDelegate: AuthUIDelegate?, - completion: (@Sendable (AuthDataResult?, Error?) -> Void)?) { + completion: ((AuthDataResult?, Error?) -> Void)?) { kAuthGlobalWorkQueue.async { Task { let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion) @@ -630,7 +629,7 @@ extension Auth: AuthInterop { /// or is canceled. Invoked asynchronously on the main thread in the future. @objc(signInWithCredential:completion:) open func signIn(with credential: AuthCredential, - completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) { + completion: ((AuthDataResult?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion) Task { @@ -700,8 +699,7 @@ extension Auth: AuthInterop { /// not enabled. Enable them in the Auth section of the Firebase console. /// - Parameter completion: Optionally; a block which is invoked when the sign in finishes, or is /// canceled. Invoked asynchronously on the main thread in the future. - @objc open func signInAnonymously(completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = - nil) { + @objc open func signInAnonymously(completion: ((AuthDataResult?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion) if let currentUser = self.currentUser, currentUser.isAnonymous { @@ -767,7 +765,7 @@ extension Auth: AuthInterop { /// - Parameter completion: Optionally; a block which is invoked when the sign in finishes, or is /// canceled. Invoked asynchronously on the main thread in the future. @objc open func signIn(withCustomToken token: String, - completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) { + completion: ((AuthDataResult?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion) let request = VerifyCustomTokenRequest(token: token, @@ -836,7 +834,7 @@ extension Auth: AuthInterop { /// or is canceled. Invoked asynchronously on the main thread in the future. @objc open func createUser(withEmail email: String, password: String, - completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) { + completion: ((AuthDataResult?, Error?) -> Void)? = nil) { guard password.count > 0 else { if let completion { completion(nil, AuthErrorUtils.weakPasswordError(serverResponseReason: "Missing password")) @@ -949,7 +947,7 @@ extension Auth: AuthInterop { /// - Parameter completion: Optionally; a block which is invoked when the request finishes. /// Invoked asynchronously on the main thread in the future. @objc open func confirmPasswordReset(withCode code: String, newPassword: String, - completion: @Sendable @escaping (Error?) -> Void) { + completion: @escaping (Error?) -> Void) { kAuthGlobalWorkQueue.async { let request = ResetPasswordRequest(oobCode: code, newPassword: newPassword, @@ -989,8 +987,7 @@ extension Auth: AuthInterop { /// Invoked /// asynchronously on the main thread in the future. @objc open func checkActionCode(_ code: String, - completion: @Sendable @escaping (ActionCodeInfo?, Error?) - -> Void) { + completion: @escaping (ActionCodeInfo?, Error?) -> Void) { kAuthGlobalWorkQueue.async { let request = ResetPasswordRequest(oobCode: code, newPassword: nil, @@ -1035,8 +1032,7 @@ extension Auth: AuthInterop { /// - Parameter completion: Optionally; a block which is invoked when the request finishes. /// Invoked asynchronously on the main thread in the future. @objc open func verifyPasswordResetCode(_ code: String, - completion: @Sendable @escaping (String?, Error?) - -> Void) { + completion: @escaping (String?, Error?) -> Void) { checkActionCode(code) { info, error in if let error { completion(nil, error) @@ -1069,8 +1065,7 @@ extension Auth: AuthInterop { /// - Parameter code: The out of band code to be applied. /// - Parameter completion: Optionally; a block which is invoked when the request finishes. /// Invoked asynchronously on the main thread in the future. - @objc open func applyActionCode(_ code: String, - completion: @Sendable @escaping (Error?) -> Void) { + @objc open func applyActionCode(_ code: String, completion: @escaping (Error?) -> Void) { kAuthGlobalWorkQueue.async { let request = SetAccountInfoRequest(requestConfiguration: self.requestConfiguration) request.oobCode = code @@ -1115,7 +1110,7 @@ extension Auth: AuthInterop { /// Invoked /// asynchronously on the main thread in the future. @objc open func sendPasswordReset(withEmail email: String, - completion: (@Sendable (Error?) -> Void)? = nil) { + completion: ((Error?) -> Void)? = nil) { sendPasswordReset(withEmail: email, actionCodeSettings: nil, completion: completion) } @@ -1148,7 +1143,7 @@ extension Auth: AuthInterop { /// Invoked asynchronously on the main thread in the future. @objc open func sendPasswordReset(withEmail email: String, actionCodeSettings: ActionCodeSettings?, - completion: (@Sendable (Error?) -> Void)? = nil) { + completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { let request = GetOOBConfirmationCodeRequest.passwordResetRequest( email: email, @@ -1217,7 +1212,7 @@ extension Auth: AuthInterop { /// Invoked asynchronously on the main thread in the future. @objc open func sendSignInLink(toEmail email: String, actionCodeSettings: ActionCodeSettings, - completion: (@Sendable (Error?) -> Void)? = nil) { + completion: ((Error?) -> Void)? = nil) { if !actionCodeSettings.handleCodeInApp { fatalError("The handleCodeInApp flag in ActionCodeSettings must be true for Email-link " + "Authentication.") diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift index e74743fa9a5..b8cca1f5fca 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift @@ -268,7 +268,7 @@ import Foundation /// - Parameter completion: Optionally; a block which is invoked asynchronously on the main /// thread when the mobile web flow is completed. open func getCredentialWith(_ uiDelegate: AuthUIDelegate?, - completion: (@Sendable (AuthCredential?, Error?) -> Void)? = nil) { + completion: ((AuthCredential?, Error?) -> Void)? = nil) { guard let urlTypes = auth.mainBundleUrlTypes, AuthWebUtils.isCallbackSchemeRegistered(forCustomURLScheme: callbackScheme, urlTypes: urlTypes) else { diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift index 92e1a722e20..2a1de385aa4 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift @@ -52,7 +52,7 @@ import Foundation @objc(verifyPhoneNumber:UIDelegate:completion:) open func verifyPhoneNumber(_ phoneNumber: String, uiDelegate: AuthUIDelegate? = nil, - completion: (@Sendable (_: String?, _: Error?) -> Void)?) { + completion: ((_: String?, _: Error?) -> Void)?) { verifyPhoneNumber(phoneNumber, uiDelegate: uiDelegate, multiFactorSession: nil, @@ -71,7 +71,7 @@ import Foundation open func verifyPhoneNumber(_ phoneNumber: String, uiDelegate: AuthUIDelegate? = nil, multiFactorSession: MultiFactorSession? = nil, - completion: (@Sendable (_: String?, _: Error?) -> Void)?) { + completion: ((_: String?, _: Error?) -> Void)?) { guard AuthWebUtils.isCallbackSchemeRegistered(forCustomURLScheme: callbackScheme, urlTypes: auth.mainBundleUrlTypes) else { fatalError( @@ -132,7 +132,7 @@ import Foundation open func verifyPhoneNumber(with multiFactorInfo: PhoneMultiFactorInfo, uiDelegate: AuthUIDelegate? = nil, multiFactorSession: MultiFactorSession?, - completion: (@Sendable (_: String?, _: Error?) -> Void)?) { + completion: ((_: String?, _: Error?) -> Void)?) { multiFactorSession?.multiFactorInfo = multiFactorInfo verifyPhoneNumber(multiFactorInfo.phoneNumber, uiDelegate: uiDelegate, diff --git a/FirebaseAuth/Sources/Swift/User/User.swift b/FirebaseAuth/Sources/Swift/User/User.swift index 098d21fa83f..fccd96ab088 100644 --- a/FirebaseAuth/Sources/Swift/User/User.swift +++ b/FirebaseAuth/Sources/Swift/User/User.swift @@ -101,7 +101,7 @@ extension User: NSSecureCoding {} ) #endif // !FIREBASE_CI @objc(updateEmail:completion:) - open func updateEmail(to email: String, completion: (@Sendable (Error?) -> Void)? = nil) { + open func updateEmail(to email: String, completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { self.updateEmail(email: email, password: nil) { error in User.callInMainThreadWithError(callback: completion, error: error) @@ -173,7 +173,7 @@ extension User: NSSecureCoding {} /// - Parameter completion: Optionally; the block invoked when the user profile change has /// finished. @objc(updatePassword:completion:) - open func updatePassword(to password: String, completion: (@Sendable (Error?) -> Void)? = nil) { + open func updatePassword(to password: String, completion: ((Error?) -> Void)? = nil) { guard password.count > 0 else { if let completion { completion(AuthErrorUtils.weakPasswordError(serverResponseReason: "Missing Password")) @@ -234,7 +234,7 @@ extension User: NSSecureCoding {} /// finished. @objc(updatePhoneNumberCredential:completion:) open func updatePhoneNumber(_ credential: PhoneAuthCredential, - completion: (@Sendable (Error?) -> Void)? = nil) { + completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { self.internalUpdateOrLinkPhoneNumber(credential: credential, isLinkOperation: false) { error in @@ -303,7 +303,7 @@ extension User: NSSecureCoding {} /// `updateEmail(to:)`. /// - Parameter completion: Optionally; the block invoked when the reload has finished. Invoked /// asynchronously on the main thread in the future. - @objc open func reload(completion: (@Sendable (Error?) -> Void)? = nil) { + @objc open func reload(completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { self.getAccountInfoRefreshingCache { user, error in User.callInMainThreadWithError(callback: completion, error: error) @@ -361,7 +361,7 @@ extension User: NSSecureCoding {} /// finished. Invoked asynchronously on the main thread in the future. @objc(reauthenticateWithCredential:completion:) open func reauthenticate(with credential: AuthCredential, - completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) { + completion: ((AuthDataResult?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { Task { do { @@ -463,7 +463,7 @@ extension User: NSSecureCoding {} @objc(reauthenticateWithProvider:UIDelegate:completion:) open func reauthenticate(with provider: FederatedAuthProvider, uiDelegate: AuthUIDelegate?, - completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) { + completion: ((AuthDataResult?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { Task { do { @@ -507,7 +507,7 @@ extension User: NSSecureCoding {} /// - Parameter completion: Optionally; the block invoked when the token is available. Invoked /// asynchronously on the main thread in the future. @objc(getIDTokenWithCompletion:) - open func getIDToken(completion: (@Sendable (String?, Error?) -> Void)?) { + open func getIDToken(completion: ((String?, Error?) -> Void)?) { // |getIDTokenForcingRefresh:completion:| is also a public API so there is no need to dispatch to // global work queue here. getIDTokenForcingRefresh(false, completion: completion) @@ -523,7 +523,7 @@ extension User: NSSecureCoding {} /// asynchronously on the main thread in the future. @objc(getIDTokenForcingRefresh:completion:) open func getIDTokenForcingRefresh(_ forceRefresh: Bool, - completion: (@Sendable (String?, Error?) -> Void)?) { + completion: ((String?, Error?) -> Void)?) { getIDTokenResult(forcingRefresh: forceRefresh) { tokenResult, error in if let completion { DispatchQueue.main.async { @@ -563,7 +563,7 @@ extension User: NSSecureCoding {} /// - Parameter completion: Optionally; the block invoked when the token is available. Invoked /// asynchronously on the main thread in the future. @objc(getIDTokenResultWithCompletion:) - open func getIDTokenResult(completion: (@Sendable (AuthTokenResult?, Error?) -> Void)?) { + open func getIDTokenResult(completion: ((AuthTokenResult?, Error?) -> Void)?) { getIDTokenResult(forcingRefresh: false) { tokenResult, error in if let completion { DispatchQueue.main.async { @@ -584,7 +584,7 @@ extension User: NSSecureCoding {} /// asynchronously on the main thread in the future. @objc(getIDTokenResultForcingRefresh:completion:) open func getIDTokenResult(forcingRefresh: Bool, - completion: (@Sendable (AuthTokenResult?, Error?) -> Void)?) { + completion: ((AuthTokenResult?, Error?) -> Void)?) { kAuthGlobalWorkQueue.async { self.internalGetToken(forceRefresh: forcingRefresh, backend: self.backend) { token, error in var tokenResult: AuthTokenResult? @@ -660,7 +660,7 @@ extension User: NSSecureCoding {} /// fails. @objc(linkWithCredential:completion:) open func link(with credential: AuthCredential, - completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) { + completion: ((AuthDataResult?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { if self.providerDataRaw[credential.provider] != nil { User.callInMainThreadWithAuthDataResultAndError( @@ -747,7 +747,7 @@ extension User: NSSecureCoding {} @objc(linkWithProvider:UIDelegate:completion:) open func link(with provider: FederatedAuthProvider, uiDelegate: AuthUIDelegate?, - completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) { + completion: ((AuthDataResult?, Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { Task { do { @@ -847,7 +847,7 @@ extension User: NSSecureCoding {} /// - Parameter completion: Optionally; the block invoked when the request to send an email /// verification is complete, or fails. Invoked asynchronously on the main thread in the future. @objc(sendEmailVerificationWithCompletion:) - open func __sendEmailVerification(withCompletion completion: (@Sendable (Error?) -> Void)?) { + open func __sendEmailVerification(withCompletion completion: ((Error?) -> Void)?) { sendEmailVerification(completion: completion) } @@ -867,7 +867,7 @@ extension User: NSSecureCoding {} /// verification is complete, or fails. Invoked asynchronously on the main thread in the future. @objc(sendEmailVerificationWithActionCodeSettings:completion:) open func sendEmailVerification(with actionCodeSettings: ActionCodeSettings? = nil, - completion: (@Sendable (Error?) -> Void)? = nil) { + completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { self.internalGetToken(backend: self.backend) { accessToken, error in if let error { @@ -932,7 +932,7 @@ extension User: NSSecureCoding {} /// `reauthenticate(with:)`. /// - Parameter completion: Optionally; the block invoked when the request to delete the account /// is complete, or fails. Invoked asynchronously on the main thread in the future. - @objc open func delete(completion: (@Sendable (Error?) -> Void)? = nil) { + @objc open func delete(completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { self.internalGetToken(backend: self.backend) { accessToken, error in if let error { @@ -985,8 +985,7 @@ extension User: NSSecureCoding {} /// - Parameter completion: Optionally; the block invoked when the request to send the /// verification email is complete, or fails. @objc(sendEmailVerificationBeforeUpdatingEmail:completion:) - open func __sendEmailVerificationBeforeUpdating(email: String, - completion: (@Sendable (Error?) -> Void)?) { + open func __sendEmailVerificationBeforeUpdating(email: String, completion: ((Error?) -> Void)?) { sendEmailVerification(beforeUpdatingEmail: email, completion: completion) } @@ -998,7 +997,7 @@ extension User: NSSecureCoding {} /// verification email is complete, or fails. @objc open func sendEmailVerification(beforeUpdatingEmail email: String, actionCodeSettings: ActionCodeSettings? = nil, - completion: (@Sendable (Error?) -> Void)? = nil) { + completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { self.internalGetToken(backend: self.backend) { accessToken, error in if let error { diff --git a/FirebaseAuth/Sources/Swift/User/UserProfileChangeRequest.swift b/FirebaseAuth/Sources/Swift/User/UserProfileChangeRequest.swift index f7a5c67702b..493f3d80f92 100644 --- a/FirebaseAuth/Sources/Swift/User/UserProfileChangeRequest.swift +++ b/FirebaseAuth/Sources/Swift/User/UserProfileChangeRequest.swift @@ -59,7 +59,7 @@ import Foundation /// This method should only be called once.Once called, property values should not be changed. /// - Parameter completion: Optionally; the block invoked when the user profile change has been /// applied. - @objc open func commitChanges(completion: (@Sendable (Error?) -> Void)? = nil) { + @objc open func commitChanges(completion: ((Error?) -> Void)? = nil) { kAuthGlobalWorkQueue.async { if self.consumed { fatalError("Internal Auth Error: commitChanges should only be called once.")