Skip to content

Commit a7067b5

Browse files
committed
Revert "[Auth] First pass marking closures as Sendable"
This reverts commit 4ab30d6.
1 parent 21e9824 commit a7067b5

File tree

5 files changed

+36
-42
lines changed

5 files changed

+36
-42
lines changed

FirebaseAuth/Sources/Swift/Auth/Auth.swift

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ extension Auth: AuthInterop {
219219
/// - user: The user object to be set as the current user of the calling Auth instance.
220220
/// - completion: Optionally; a block invoked after the user of the calling Auth instance has
221221
/// been updated or an error was encountered.
222-
@objc open func updateCurrentUser(_ user: User?,
223-
completion: (@Sendable (Error?) -> Void)? = nil) {
222+
@objc open func updateCurrentUser(_ user: User?, completion: ((Error?) -> Void)? = nil) {
224223
kAuthGlobalWorkQueue.async {
225224
guard let user else {
226225
let error = AuthErrorUtils.nullUserError(message: nil)
@@ -287,7 +286,7 @@ extension Auth: AuthInterop {
287286
)
288287
#endif // !FIREBASE_CI
289288
@objc open func fetchSignInMethods(forEmail email: String,
290-
completion: (@Sendable ([String]?, Error?) -> Void)? = nil) {
289+
completion: (([String]?, Error?) -> Void)? = nil) {
291290
kAuthGlobalWorkQueue.async {
292291
let request = CreateAuthURIRequest(identifier: email,
293292
continueURI: "http://www.google.com/",
@@ -351,7 +350,7 @@ extension Auth: AuthInterop {
351350
/// or is canceled. Invoked asynchronously on the main thread in the future.
352351
@objc open func signIn(withEmail email: String,
353352
password: String,
354-
completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) {
353+
completion: ((AuthDataResult?, Error?) -> Void)? = nil) {
355354
kAuthGlobalWorkQueue.async {
356355
let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion)
357356
Task {
@@ -450,7 +449,7 @@ extension Auth: AuthInterop {
450449
/// or is canceled. Invoked asynchronously on the main thread in the future.
451450
@objc open func signIn(withEmail email: String,
452451
link: String,
453-
completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) {
452+
completion: ((AuthDataResult?, Error?) -> Void)? = nil) {
454453
kAuthGlobalWorkQueue.async {
455454
let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion)
456455
let credential = EmailAuthCredential(withEmail: email, link: link)
@@ -529,7 +528,7 @@ extension Auth: AuthInterop {
529528
@objc(signInWithProvider:UIDelegate:completion:)
530529
open func signIn(with provider: FederatedAuthProvider,
531530
uiDelegate: AuthUIDelegate?,
532-
completion: (@Sendable (AuthDataResult?, Error?) -> Void)?) {
531+
completion: ((AuthDataResult?, Error?) -> Void)?) {
533532
kAuthGlobalWorkQueue.async {
534533
Task {
535534
let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion)
@@ -630,7 +629,7 @@ extension Auth: AuthInterop {
630629
/// or is canceled. Invoked asynchronously on the main thread in the future.
631630
@objc(signInWithCredential:completion:)
632631
open func signIn(with credential: AuthCredential,
633-
completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) {
632+
completion: ((AuthDataResult?, Error?) -> Void)? = nil) {
634633
kAuthGlobalWorkQueue.async {
635634
let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion)
636635
Task {
@@ -700,8 +699,7 @@ extension Auth: AuthInterop {
700699
/// not enabled. Enable them in the Auth section of the Firebase console.
701700
/// - Parameter completion: Optionally; a block which is invoked when the sign in finishes, or is
702701
/// canceled. Invoked asynchronously on the main thread in the future.
703-
@objc open func signInAnonymously(completion: (@Sendable (AuthDataResult?, Error?) -> Void)? =
704-
nil) {
702+
@objc open func signInAnonymously(completion: ((AuthDataResult?, Error?) -> Void)? = nil) {
705703
kAuthGlobalWorkQueue.async {
706704
let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion)
707705
if let currentUser = self.currentUser, currentUser.isAnonymous {
@@ -767,7 +765,7 @@ extension Auth: AuthInterop {
767765
/// - Parameter completion: Optionally; a block which is invoked when the sign in finishes, or is
768766
/// canceled. Invoked asynchronously on the main thread in the future.
769767
@objc open func signIn(withCustomToken token: String,
770-
completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) {
768+
completion: ((AuthDataResult?, Error?) -> Void)? = nil) {
771769
kAuthGlobalWorkQueue.async {
772770
let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion)
773771
let request = VerifyCustomTokenRequest(token: token,
@@ -836,7 +834,7 @@ extension Auth: AuthInterop {
836834
/// or is canceled. Invoked asynchronously on the main thread in the future.
837835
@objc open func createUser(withEmail email: String,
838836
password: String,
839-
completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) {
837+
completion: ((AuthDataResult?, Error?) -> Void)? = nil) {
840838
guard password.count > 0 else {
841839
if let completion {
842840
completion(nil, AuthErrorUtils.weakPasswordError(serverResponseReason: "Missing password"))
@@ -949,7 +947,7 @@ extension Auth: AuthInterop {
949947
/// - Parameter completion: Optionally; a block which is invoked when the request finishes.
950948
/// Invoked asynchronously on the main thread in the future.
951949
@objc open func confirmPasswordReset(withCode code: String, newPassword: String,
952-
completion: @Sendable @escaping (Error?) -> Void) {
950+
completion: @escaping (Error?) -> Void) {
953951
kAuthGlobalWorkQueue.async {
954952
let request = ResetPasswordRequest(oobCode: code,
955953
newPassword: newPassword,
@@ -989,8 +987,7 @@ extension Auth: AuthInterop {
989987
/// Invoked
990988
/// asynchronously on the main thread in the future.
991989
@objc open func checkActionCode(_ code: String,
992-
completion: @Sendable @escaping (ActionCodeInfo?, Error?)
993-
-> Void) {
990+
completion: @escaping (ActionCodeInfo?, Error?) -> Void) {
994991
kAuthGlobalWorkQueue.async {
995992
let request = ResetPasswordRequest(oobCode: code,
996993
newPassword: nil,
@@ -1035,8 +1032,7 @@ extension Auth: AuthInterop {
10351032
/// - Parameter completion: Optionally; a block which is invoked when the request finishes.
10361033
/// Invoked asynchronously on the main thread in the future.
10371034
@objc open func verifyPasswordResetCode(_ code: String,
1038-
completion: @Sendable @escaping (String?, Error?)
1039-
-> Void) {
1035+
completion: @escaping (String?, Error?) -> Void) {
10401036
checkActionCode(code) { info, error in
10411037
if let error {
10421038
completion(nil, error)
@@ -1069,8 +1065,7 @@ extension Auth: AuthInterop {
10691065
/// - Parameter code: The out of band code to be applied.
10701066
/// - Parameter completion: Optionally; a block which is invoked when the request finishes.
10711067
/// Invoked asynchronously on the main thread in the future.
1072-
@objc open func applyActionCode(_ code: String,
1073-
completion: @Sendable @escaping (Error?) -> Void) {
1068+
@objc open func applyActionCode(_ code: String, completion: @escaping (Error?) -> Void) {
10741069
kAuthGlobalWorkQueue.async {
10751070
let request = SetAccountInfoRequest(requestConfiguration: self.requestConfiguration)
10761071
request.oobCode = code
@@ -1115,7 +1110,7 @@ extension Auth: AuthInterop {
11151110
/// Invoked
11161111
/// asynchronously on the main thread in the future.
11171112
@objc open func sendPasswordReset(withEmail email: String,
1118-
completion: (@Sendable (Error?) -> Void)? = nil) {
1113+
completion: ((Error?) -> Void)? = nil) {
11191114
sendPasswordReset(withEmail: email, actionCodeSettings: nil, completion: completion)
11201115
}
11211116

@@ -1148,7 +1143,7 @@ extension Auth: AuthInterop {
11481143
/// Invoked asynchronously on the main thread in the future.
11491144
@objc open func sendPasswordReset(withEmail email: String,
11501145
actionCodeSettings: ActionCodeSettings?,
1151-
completion: (@Sendable (Error?) -> Void)? = nil) {
1146+
completion: ((Error?) -> Void)? = nil) {
11521147
kAuthGlobalWorkQueue.async {
11531148
let request = GetOOBConfirmationCodeRequest.passwordResetRequest(
11541149
email: email,
@@ -1217,7 +1212,7 @@ extension Auth: AuthInterop {
12171212
/// Invoked asynchronously on the main thread in the future.
12181213
@objc open func sendSignInLink(toEmail email: String,
12191214
actionCodeSettings: ActionCodeSettings,
1220-
completion: (@Sendable (Error?) -> Void)? = nil) {
1215+
completion: ((Error?) -> Void)? = nil) {
12211216
if !actionCodeSettings.handleCodeInApp {
12221217
fatalError("The handleCodeInApp flag in ActionCodeSettings must be true for Email-link " +
12231218
"Authentication.")

FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ import Foundation
268268
/// - Parameter completion: Optionally; a block which is invoked asynchronously on the main
269269
/// thread when the mobile web flow is completed.
270270
open func getCredentialWith(_ uiDelegate: AuthUIDelegate?,
271-
completion: (@Sendable (AuthCredential?, Error?) -> Void)? = nil) {
271+
completion: ((AuthCredential?, Error?) -> Void)? = nil) {
272272
guard let urlTypes = auth.mainBundleUrlTypes,
273273
AuthWebUtils.isCallbackSchemeRegistered(forCustomURLScheme: callbackScheme,
274274
urlTypes: urlTypes) else {

FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ import Foundation
7171
open func verifyPhoneNumber(_ phoneNumber: String,
7272
uiDelegate: AuthUIDelegate? = nil,
7373
multiFactorSession: MultiFactorSession? = nil,
74-
completion: (@Sendable (_: String?, _: Error?) -> Void)?) {
74+
completion: ((_: String?, _: Error?) -> Void)?) {
7575
guard AuthWebUtils.isCallbackSchemeRegistered(forCustomURLScheme: callbackScheme,
7676
urlTypes: auth.mainBundleUrlTypes) else {
7777
fatalError(

FirebaseAuth/Sources/Swift/User/User.swift

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ extension User: NSSecureCoding {}
101101
)
102102
#endif // !FIREBASE_CI
103103
@objc(updateEmail:completion:)
104-
open func updateEmail(to email: String, completion: (@Sendable (Error?) -> Void)? = nil) {
104+
open func updateEmail(to email: String, completion: ((Error?) -> Void)? = nil) {
105105
kAuthGlobalWorkQueue.async {
106106
self.updateEmail(email: email, password: nil) { error in
107107
User.callInMainThreadWithError(callback: completion, error: error)
@@ -173,7 +173,7 @@ extension User: NSSecureCoding {}
173173
/// - Parameter completion: Optionally; the block invoked when the user profile change has
174174
/// finished.
175175
@objc(updatePassword:completion:)
176-
open func updatePassword(to password: String, completion: (@Sendable (Error?) -> Void)? = nil) {
176+
open func updatePassword(to password: String, completion: ((Error?) -> Void)? = nil) {
177177
guard password.count > 0 else {
178178
if let completion {
179179
completion(AuthErrorUtils.weakPasswordError(serverResponseReason: "Missing Password"))
@@ -234,7 +234,7 @@ extension User: NSSecureCoding {}
234234
/// finished.
235235
@objc(updatePhoneNumberCredential:completion:)
236236
open func updatePhoneNumber(_ credential: PhoneAuthCredential,
237-
completion: (@Sendable (Error?) -> Void)? = nil) {
237+
completion: ((Error?) -> Void)? = nil) {
238238
kAuthGlobalWorkQueue.async {
239239
self.internalUpdateOrLinkPhoneNumber(credential: credential,
240240
isLinkOperation: false) { error in
@@ -303,7 +303,7 @@ extension User: NSSecureCoding {}
303303
/// `updateEmail(to:)`.
304304
/// - Parameter completion: Optionally; the block invoked when the reload has finished. Invoked
305305
/// asynchronously on the main thread in the future.
306-
@objc open func reload(completion: (@Sendable (Error?) -> Void)? = nil) {
306+
@objc open func reload(completion: ((Error?) -> Void)? = nil) {
307307
kAuthGlobalWorkQueue.async {
308308
self.getAccountInfoRefreshingCache { user, error in
309309
User.callInMainThreadWithError(callback: completion, error: error)
@@ -361,7 +361,7 @@ extension User: NSSecureCoding {}
361361
/// finished. Invoked asynchronously on the main thread in the future.
362362
@objc(reauthenticateWithCredential:completion:)
363363
open func reauthenticate(with credential: AuthCredential,
364-
completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) {
364+
completion: ((AuthDataResult?, Error?) -> Void)? = nil) {
365365
kAuthGlobalWorkQueue.async {
366366
Task {
367367
do {
@@ -463,7 +463,7 @@ extension User: NSSecureCoding {}
463463
@objc(reauthenticateWithProvider:UIDelegate:completion:)
464464
open func reauthenticate(with provider: FederatedAuthProvider,
465465
uiDelegate: AuthUIDelegate?,
466-
completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) {
466+
completion: ((AuthDataResult?, Error?) -> Void)? = nil) {
467467
kAuthGlobalWorkQueue.async {
468468
Task {
469469
do {
@@ -507,7 +507,7 @@ extension User: NSSecureCoding {}
507507
/// - Parameter completion: Optionally; the block invoked when the token is available. Invoked
508508
/// asynchronously on the main thread in the future.
509509
@objc(getIDTokenWithCompletion:)
510-
open func getIDToken(completion: (@Sendable (String?, Error?) -> Void)?) {
510+
open func getIDToken(completion: ((String?, Error?) -> Void)?) {
511511
// |getIDTokenForcingRefresh:completion:| is also a public API so there is no need to dispatch to
512512
// global work queue here.
513513
getIDTokenForcingRefresh(false, completion: completion)
@@ -523,7 +523,7 @@ extension User: NSSecureCoding {}
523523
/// asynchronously on the main thread in the future.
524524
@objc(getIDTokenForcingRefresh:completion:)
525525
open func getIDTokenForcingRefresh(_ forceRefresh: Bool,
526-
completion: (@Sendable (String?, Error?) -> Void)?) {
526+
completion: ((String?, Error?) -> Void)?) {
527527
getIDTokenResult(forcingRefresh: forceRefresh) { tokenResult, error in
528528
if let completion {
529529
DispatchQueue.main.async {
@@ -563,7 +563,7 @@ extension User: NSSecureCoding {}
563563
/// - Parameter completion: Optionally; the block invoked when the token is available. Invoked
564564
/// asynchronously on the main thread in the future.
565565
@objc(getIDTokenResultWithCompletion:)
566-
open func getIDTokenResult(completion: (@Sendable (AuthTokenResult?, Error?) -> Void)?) {
566+
open func getIDTokenResult(completion: ((AuthTokenResult?, Error?) -> Void)?) {
567567
getIDTokenResult(forcingRefresh: false) { tokenResult, error in
568568
if let completion {
569569
DispatchQueue.main.async {
@@ -584,7 +584,7 @@ extension User: NSSecureCoding {}
584584
/// asynchronously on the main thread in the future.
585585
@objc(getIDTokenResultForcingRefresh:completion:)
586586
open func getIDTokenResult(forcingRefresh: Bool,
587-
completion: (@Sendable (AuthTokenResult?, Error?) -> Void)?) {
587+
completion: ((AuthTokenResult?, Error?) -> Void)?) {
588588
kAuthGlobalWorkQueue.async {
589589
self.internalGetToken(forceRefresh: forcingRefresh, backend: self.backend) { token, error in
590590
var tokenResult: AuthTokenResult?
@@ -660,7 +660,7 @@ extension User: NSSecureCoding {}
660660
/// fails.
661661
@objc(linkWithCredential:completion:)
662662
open func link(with credential: AuthCredential,
663-
completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) {
663+
completion: ((AuthDataResult?, Error?) -> Void)? = nil) {
664664
kAuthGlobalWorkQueue.async {
665665
if self.providerDataRaw[credential.provider] != nil {
666666
User.callInMainThreadWithAuthDataResultAndError(
@@ -747,7 +747,7 @@ extension User: NSSecureCoding {}
747747
@objc(linkWithProvider:UIDelegate:completion:)
748748
open func link(with provider: FederatedAuthProvider,
749749
uiDelegate: AuthUIDelegate?,
750-
completion: (@Sendable (AuthDataResult?, Error?) -> Void)? = nil) {
750+
completion: ((AuthDataResult?, Error?) -> Void)? = nil) {
751751
kAuthGlobalWorkQueue.async {
752752
Task {
753753
do {
@@ -847,7 +847,7 @@ extension User: NSSecureCoding {}
847847
/// - Parameter completion: Optionally; the block invoked when the request to send an email
848848
/// verification is complete, or fails. Invoked asynchronously on the main thread in the future.
849849
@objc(sendEmailVerificationWithCompletion:)
850-
open func __sendEmailVerification(withCompletion completion: (@Sendable (Error?) -> Void)?) {
850+
open func __sendEmailVerification(withCompletion completion: ((Error?) -> Void)?) {
851851
sendEmailVerification(completion: completion)
852852
}
853853

@@ -867,7 +867,7 @@ extension User: NSSecureCoding {}
867867
/// verification is complete, or fails. Invoked asynchronously on the main thread in the future.
868868
@objc(sendEmailVerificationWithActionCodeSettings:completion:)
869869
open func sendEmailVerification(with actionCodeSettings: ActionCodeSettings? = nil,
870-
completion: (@Sendable (Error?) -> Void)? = nil) {
870+
completion: ((Error?) -> Void)? = nil) {
871871
kAuthGlobalWorkQueue.async {
872872
self.internalGetToken(backend: self.backend) { accessToken, error in
873873
if let error {
@@ -932,7 +932,7 @@ extension User: NSSecureCoding {}
932932
/// `reauthenticate(with:)`.
933933
/// - Parameter completion: Optionally; the block invoked when the request to delete the account
934934
/// is complete, or fails. Invoked asynchronously on the main thread in the future.
935-
@objc open func delete(completion: (@Sendable (Error?) -> Void)? = nil) {
935+
@objc open func delete(completion: ((Error?) -> Void)? = nil) {
936936
kAuthGlobalWorkQueue.async {
937937
self.internalGetToken(backend: self.backend) { accessToken, error in
938938
if let error {
@@ -985,8 +985,7 @@ extension User: NSSecureCoding {}
985985
/// - Parameter completion: Optionally; the block invoked when the request to send the
986986
/// verification email is complete, or fails.
987987
@objc(sendEmailVerificationBeforeUpdatingEmail:completion:)
988-
open func __sendEmailVerificationBeforeUpdating(email: String,
989-
completion: (@Sendable (Error?) -> Void)?) {
988+
open func __sendEmailVerificationBeforeUpdating(email: String, completion: ((Error?) -> Void)?) {
990989
sendEmailVerification(beforeUpdatingEmail: email, completion: completion)
991990
}
992991

@@ -998,7 +997,7 @@ extension User: NSSecureCoding {}
998997
/// verification email is complete, or fails.
999998
@objc open func sendEmailVerification(beforeUpdatingEmail email: String,
1000999
actionCodeSettings: ActionCodeSettings? = nil,
1001-
completion: (@Sendable (Error?) -> Void)? = nil) {
1000+
completion: ((Error?) -> Void)? = nil) {
10021001
kAuthGlobalWorkQueue.async {
10031002
self.internalGetToken(backend: self.backend) { accessToken, error in
10041003
if let error {

FirebaseAuth/Sources/Swift/User/UserProfileChangeRequest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import Foundation
5959
/// This method should only be called once.Once called, property values should not be changed.
6060
/// - Parameter completion: Optionally; the block invoked when the user profile change has been
6161
/// applied.
62-
@objc open func commitChanges(completion: (@Sendable (Error?) -> Void)? = nil) {
62+
@objc open func commitChanges(completion: ((Error?) -> Void)? = nil) {
6363
kAuthGlobalWorkQueue.async {
6464
if self.consumed {
6565
fatalError("Internal Auth Error: commitChanges should only be called once.")

0 commit comments

Comments
 (0)