Skip to content

Commit f4ee160

Browse files
authored
Auth - no typedefs in public APIs (#6283)
1 parent 6e4bd10 commit f4ee160

File tree

7 files changed

+87
-58
lines changed

7 files changed

+87
-58
lines changed

FirebaseAuth/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# v6.9.0
22
- [added] Added support for multi-tenancy (#6142).
33
- [added] Added basic watchOS support. (#4621)
4+
- [channged] Improved Xcode completion of public API completion handlers in Swift. (#6283)
45

56
# v6.8.0
67
- [fixed] Fix bug where multiple keychain entries would result in user persistence failure. (#5906)

FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuth.h

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,16 @@ NS_SWIFT_NAME(Auth)
385385
@param completion Optionally; a block invoked after the user of the calling Auth instance has
386386
been updated or an error was encountered.
387387
*/
388-
- (void)updateCurrentUser:(FIRUser *)user completion:(nullable FIRUserUpdateCallback)completion;
388+
- (void)updateCurrentUser:(FIRUser *)user
389+
completion:(nullable void (^)(NSError *_Nullable error))completion;
389390

390391
/** @fn fetchProvidersForEmail:completion:
391392
@brief Please use fetchSignInMethodsForEmail:completion: for Objective-C or
392393
fetchSignInMethods(forEmail:completion:) for Swift instead.
393394
*/
394395
- (void)fetchProvidersForEmail:(NSString *)email
395-
completion:(nullable FIRProviderQueryCallback)completion
396+
completion:(nullable void (^)(NSArray<NSString *> *_Nullable providers,
397+
NSError *_Nullable error))completion
396398
DEPRECATED_MSG_ATTRIBUTE("Please use fetchSignInMethodsForEmail:completion: for Objective-C or "
397399
"fetchSignInMethods(forEmail:completion:) for Swift instead.");
398400

@@ -412,7 +414,8 @@ NS_SWIFT_NAME(Auth)
412414
*/
413415

414416
- (void)fetchSignInMethodsForEmail:(NSString *)email
415-
completion:(nullable FIRSignInMethodQueryCallback)completion;
417+
completion:(nullable void (^)(NSArray<NSString *> *_Nullable,
418+
NSError *_Nullable))completion;
416419

417420
/** @fn signInWithEmail:password:completion:
418421
@brief Signs in using an email address and password.
@@ -437,7 +440,8 @@ NS_SWIFT_NAME(Auth)
437440
*/
438441
- (void)signInWithEmail:(NSString *)email
439442
password:(NSString *)password
440-
completion:(nullable FIRAuthDataResultCallback)completion;
443+
completion:(nullable void (^)(FIRAuthDataResult *_Nullable authResult,
444+
NSError *_Nullable error))completion;
441445

442446
/** @fn signInWithEmail:link:completion:
443447
@brief Signs in using an email address and email sign-in link.
@@ -461,7 +465,9 @@ NS_SWIFT_NAME(Auth)
461465

462466
- (void)signInWithEmail:(NSString *)email
463467
link:(NSString *)link
464-
completion:(nullable FIRAuthDataResultCallback)completion API_UNAVAILABLE(watchos);
468+
completion:(nullable void (^)(FIRAuthDataResult *_Nullable authResult,
469+
NSError *_Nullable error))completion
470+
API_UNAVAILABLE(watchos);
465471

466472
/** @fn signInWithProvider:UIDelegate:completion:
467473
@brief Signs in using the provided auth provider instance.
@@ -509,14 +515,18 @@ NS_SWIFT_NAME(Auth)
509515
*/
510516
- (void)signInWithProvider:(id<FIRFederatedAuthProvider>)provider
511517
UIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate
512-
completion:(nullable FIRAuthDataResultCallback)completion API_UNAVAILABLE(watchos);
518+
completion:(nullable void (^)(FIRAuthDataResult *_Nullable authResult,
519+
NSError *_Nullable error))completion
520+
API_UNAVAILABLE(watchos);
513521

514522
/** @fn signInAndRetrieveDataWithCredential:completion:
515523
@brief Please use signInWithCredential:completion: for Objective-C or "
516524
"signIn(with:completion:) for Swift instead.
517525
*/
518526
- (void)signInAndRetrieveDataWithCredential:(FIRAuthCredential *)credential
519-
completion:(nullable FIRAuthDataResultCallback)completion
527+
completion:
528+
(nullable void (^)(FIRAuthDataResult *_Nullable authResult,
529+
NSError *_Nullable error))completion
520530
DEPRECATED_MSG_ATTRIBUTE("Please use signInWithCredential:completion: for Objective-C or "
521531
"signIn(with:completion:) for Swift instead.");
522532

@@ -559,7 +569,8 @@ NS_SWIFT_NAME(Auth)
559569
@remarks See `FIRAuthErrors` for a list of error codes that are common to all API methods
560570
*/
561571
- (void)signInWithCredential:(FIRAuthCredential *)credential
562-
completion:(nullable FIRAuthDataResultCallback)completion;
572+
completion:(nullable void (^)(FIRAuthDataResult *_Nullable authResult,
573+
NSError *_Nullable error))completion;
563574

564575
/** @fn signInAnonymouslyWithCompletion:
565576
@brief Asynchronously creates and becomes an anonymous user.
@@ -576,7 +587,8 @@ NS_SWIFT_NAME(Auth)
576587
577588
@remarks See `FIRAuthErrors` for a list of error codes that are common to all API methods.
578589
*/
579-
- (void)signInAnonymouslyWithCompletion:(nullable FIRAuthDataResultCallback)completion;
590+
- (void)signInAnonymouslyWithCompletion:(nullable void (^)(FIRAuthDataResult *_Nullable authResult,
591+
NSError *_Nullable error))completion;
580592

581593
/** @fn signInWithCustomToken:completion:
582594
@brief Asynchronously signs in to Firebase with the given Auth token.
@@ -595,7 +607,8 @@ NS_SWIFT_NAME(Auth)
595607
@remarks See `FIRAuthErrors` for a list of error codes that are common to all API methods.
596608
*/
597609
- (void)signInWithCustomToken:(NSString *)token
598-
completion:(nullable FIRAuthDataResultCallback)completion;
610+
completion:(nullable void (^)(FIRAuthDataResult *_Nullable authResult,
611+
NSError *_Nullable error))completion;
599612

600613
/** @fn createUserWithEmail:password:completion:
601614
@brief Creates and, on success, signs in a user with the given email address and password.
@@ -621,7 +634,8 @@ NS_SWIFT_NAME(Auth)
621634
*/
622635
- (void)createUserWithEmail:(NSString *)email
623636
password:(NSString *)password
624-
completion:(nullable FIRAuthDataResultCallback)completion;
637+
completion:(nullable void (^)(FIRAuthDataResult *_Nullable authResult,
638+
NSError *_Nullable error))completion;
625639

626640
/** @fn confirmPasswordResetWithCode:newPassword:completion:
627641
@brief Resets the password given a code sent to the user outside of the app and a new password
@@ -644,7 +658,7 @@ NS_SWIFT_NAME(Auth)
644658
*/
645659
- (void)confirmPasswordResetWithCode:(NSString *)code
646660
newPassword:(NSString *)newPassword
647-
completion:(FIRConfirmPasswordResetCallback)completion;
661+
completion:(void (^)(NSError *_Nullable error))completion;
648662

649663
/** @fn checkActionCode:completion:
650664
@brief Checks the validity of an out of band code.
@@ -663,7 +677,8 @@ NS_SWIFT_NAME(Auth)
663677
asynchronously on the main thread in the future.
664678
*/
665679
- (void)verifyPasswordResetCode:(NSString *)code
666-
completion:(FIRVerifyPasswordResetCodeCallback)completion;
680+
completion:
681+
(void (^)(NSString *_Nullable email, NSError *_Nullable error))completion;
667682

668683
/** @fn applyActionCode:completion:
669684
@brief Applies out of band code.
@@ -675,7 +690,7 @@ NS_SWIFT_NAME(Auth)
675690
@remarks This method will not work for out of band codes which require an additional parameter,
676691
such as password reset code.
677692
*/
678-
- (void)applyActionCode:(NSString *)code completion:(FIRApplyActionCodeCallback)completion;
693+
- (void)applyActionCode:(NSString *)code completion:(void (^)(NSError *_Nullable error))completion;
679694

680695
/** @fn sendPasswordResetWithEmail:completion:
681696
@brief Initiates a password reset for the given email address.
@@ -696,7 +711,7 @@ NS_SWIFT_NAME(Auth)
696711
697712
*/
698713
- (void)sendPasswordResetWithEmail:(NSString *)email
699-
completion:(nullable FIRSendPasswordResetCallback)completion;
714+
completion:(nullable void (^)(NSError *_Nullable error))completion;
700715

701716
/** @fn sendPasswordResetWithEmail:actionCodeSetting:completion:
702717
@brief Initiates a password reset for the given email address and @FIRActionCodeSettings object.
@@ -728,7 +743,7 @@ NS_SWIFT_NAME(Auth)
728743
*/
729744
- (void)sendPasswordResetWithEmail:(NSString *)email
730745
actionCodeSettings:(FIRActionCodeSettings *)actionCodeSettings
731-
completion:(nullable FIRSendPasswordResetCallback)completion;
746+
completion:(nullable void (^)(NSError *_Nullable error))completion;
732747

733748
/** @fn sendSignInLinkToEmail:actionCodeSettings:completion:
734749
@brief Sends a sign in with email link to provided email address.
@@ -741,7 +756,7 @@ NS_SWIFT_NAME(Auth)
741756
*/
742757
- (void)sendSignInLinkToEmail:(NSString *)email
743758
actionCodeSettings:(FIRActionCodeSettings *)actionCodeSettings
744-
completion:(nullable FIRSendSignInLinkToEmailCallback)completion
759+
completion:(nullable void (^)(NSError *_Nullable error))completion
745760
API_UNAVAILABLE(watchos);
746761

747762
/** @fn signOut:
@@ -757,8 +772,6 @@ NS_SWIFT_NAME(Auth)
757772
keychain. The `NSLocalizedFailureReasonErrorKey` field in the `NSError.userInfo`
758773
dictionary will contain more information about the error encountered.
759774
760-
761-
762775
*/
763776
- (BOOL)signOut:(NSError *_Nullable *_Nullable)error;
764777

@@ -788,8 +801,9 @@ NS_SWIFT_NAME(Auth)
788801
789802
@return A handle useful for manually unregistering the block as a listener.
790803
*/
804+
791805
- (FIRAuthStateDidChangeListenerHandle)addAuthStateDidChangeListener:
792-
(FIRAuthStateDidChangeListenerBlock)listener;
806+
(void (^)(FIRAuth *auth, FIRUser *_Nullable user))listener;
793807

794808
/** @fn removeAuthStateDidChangeListener:
795809
@brief Unregisters a block as an "auth state did change" listener.
@@ -818,7 +832,7 @@ NS_SWIFT_NAME(Auth)
818832
@return A handle useful for manually unregistering the block as a listener.
819833
*/
820834
- (FIRIDTokenDidChangeListenerHandle)addIDTokenDidChangeListener:
821-
(FIRIDTokenDidChangeListenerBlock)listener;
835+
(void (^)(FIRAuth *auth, FIRUser *_Nullable user))listener;
822836

823837
/** @fn removeIDTokenDidChangeListener:
824838
@brief Unregisters a block as an "ID token did change" listener.

FirebaseAuth/Sources/Public/FirebaseAuth/FIRFederatedAuthProvider.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ typedef void (^FIRAuthCredentialCallback)(FIRAuthCredential *_Nullable credentia
4747
the mobile web flow is completed.
4848
*/
4949
- (void)getCredentialWithUIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate
50-
completion:(nullable FIRAuthCredentialCallback)completion;
50+
completion:(nullable void (^)(FIRAuthCredential *_Nullable credential,
51+
NSError *_Nullable error))completion;
5152
#endif // TARGET_OS_IOS
5253

5354
@end

FirebaseAuth/Sources/Public/FirebaseAuth/FIRGameCenterAuthProvider.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ NS_SWIFT_NAME(GameCenterAuthProvider)
5151
/** @fn getCredentialWithCompletion:
5252
@brief Creates a @c FIRAuthCredential for a Game Center sign in.
5353
*/
54-
+ (void)getCredentialWithCompletion:(FIRGameCenterCredentialCallback)completion
54+
+ (void)getCredentialWithCompletion:
55+
(void (^)(FIRAuthCredential *_Nullable credential, NSError *_Nullable error))completion
5556
NS_SWIFT_NAME(getCredential(completion:));
5657

5758
/** @fn init

FirebaseAuth/Sources/Public/FirebaseAuth/FIRMultiFactor.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ NS_SWIFT_NAME(MultiFactor)
5454
@param completion A block with the session identifier for a second factor enrollment operation.
5555
This is used to identify the current user trying to enroll a second factor.
5656
*/
57-
- (void)getSessionWithCompletion:(nullable FIRMultiFactorSessionCallback)completion;
57+
- (void)getSessionWithCompletion:(nullable void (^)(FIRMultiFactorSession *_Nullable credential,
58+
NSError *_Nullable error))completion;
5859

5960
/** @fn enrollWithAssertion:displayName:completion:
6061
@brief Enrolls a second factor as identified by the `FIRMultiFactorAssertion` parameter for the
@@ -64,23 +65,23 @@ NS_SWIFT_NAME(MultiFactor)
6465
*/
6566
- (void)enrollWithAssertion:(FIRMultiFactorAssertion *)assertion
6667
displayName:(nullable NSString *)displayName
67-
completion:(nullable FIRAuthVoidErrorCallback)completion;
68+
completion:(nullable void (^)(NSError *_Nullable error))completion;
6869

6970
/** @fn unenrollWithInfo:completion:
7071
@brief Unenroll the given multi factor.
7172
@param completion The block invoked when the request to send the verification email is complete,
7273
or fails.
7374
*/
7475
- (void)unenrollWithInfo:(FIRMultiFactorInfo *)factorInfo
75-
completion:(nullable FIRAuthVoidErrorCallback)completion;
76+
completion:(nullable void (^)(NSError *_Nullable error))completion;
7677

7778
/** @fn unenrollWithFactorUID:completion:
7879
@brief Unenroll the given multi factor.
7980
@param completion The block invoked when the request to send the verification email is complete,
8081
or fails.
8182
*/
8283
- (void)unenrollWithFactorUID:(NSString *)factorUID
83-
completion:(nullable FIRAuthVoidErrorCallback)completion;
84+
completion:(nullable void (^)(NSError *_Nullable error))completion;
8485

8586
@end
8687

FirebaseAuth/Sources/Public/FirebaseAuth/FIRPhoneAuthProvider.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ NS_SWIFT_NAME(PhoneAuthProvider)
113113
- (void)verifyPhoneNumberWithMultiFactorInfo:(FIRPhoneMultiFactorInfo *)phoneMultiFactorInfo
114114
UIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate
115115
multiFactorSession:(nullable FIRMultiFactorSession *)session
116-
completion:(nullable FIRVerificationResultCallback)completion;
116+
completion:
117+
(nullable void (^)(NSString *_Nullable verificationID,
118+
NSError *_Nullable error))completion;
117119

118120
/** @fn credentialWithVerificationID:verificationCode:
119121
@brief Creates an `FIRAuthCredential` for the phone number provider identified by the

0 commit comments

Comments
 (0)