Skip to content

Commit

Permalink
Make sure FUIAuthDelegate methods get called for Firebase 11 (#1203)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Aug 19, 2024
1 parent f269cc1 commit 34a2a69
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion FirebaseAuthUI.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'FirebaseAuthUI'
s.version = '14.2.3'
s.version = '14.2.4'
s.summary = 'A prebuilt authentication UI flow for Firebase Auth.'
s.homepage = 'https://github.com/firebase/FirebaseUI-iOS'
s.license = { :type => 'Apache 2.0', :file => 'LICENSE' }
Expand Down
8 changes: 8 additions & 0 deletions FirebaseAuthUI/Sources/FUIAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ - (void)invokeResultCallbackWithAuthDataResult:(nullable FIRAuthDataResult *)aut
URL:(nullable NSURL *)url
error:(nullable NSError *)error {
dispatch_async(dispatch_get_main_queue(), ^{
// Firebase 10 signatures.
if ([self.delegate respondsToSelector:@selector(authUI:didSignInWithAuthDataResult:URL:error:)]) {
[self.delegate authUI:self
didSignInWithAuthDataResult:authDataResult
Expand All @@ -361,6 +362,13 @@ - (void)invokeResultCallbackWithAuthDataResult:(nullable FIRAuthDataResult *)aut
if ([self.delegate respondsToSelector:@selector(authUI:didSignInWithAuthDataResult:error:)]) {
[self.delegate authUI:self didSignInWithAuthDataResult:authDataResult error:error];
}
// Firebase 11+ signatures.
if ([self.delegate respondsToSelector:@selector(authUI:didSignInWith:URL:error:)]) {
[self.delegate authUI:self didSignInWith:authDataResult URL:url error:error];
}
if ([self.delegate respondsToSelector:@selector(authUI:didSignInWith:error:)]) {
[self.delegate authUI:self didSignInWith:authDataResult error:error];
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if ([self.delegate respondsToSelector:@selector(authUI:didSignInWithUser:error:)]) {
Expand Down
31 changes: 29 additions & 2 deletions FirebaseAuthUI/Sources/Public/FirebaseAuthUI/FUIAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ typedef void (^FUIAuthResultCallback)(FIRUser *_Nullable user, NSError *_Nullabl

/** @fn authUI:didSignInWithAuthDataResult:error:
@brief Message sent after the sign in process has completed to report the signed in user or
error encountered.
error encountered. Use this variation with Firebase 10 and earlier.
@param authUI The @c FUIAuth instance sending the message.
@param authDataResult The data result if the sign in attempt was successful.
@param url pass the deep link associated with an email link sign-in completion. It is useful
Expand All @@ -62,7 +62,22 @@ typedef void (^FUIAuthResultCallback)(FIRUser *_Nullable user, NSError *_Nullabl

/** @fn authUI:didSignInWithAuthDataResult:error:
@brief Message sent after the sign in process has completed to report the signed in user or
error encountered.
error encountered. Use this variation with Firebase 11 and later. Swift implementations
should be marked with `@objc`.
@param authUI The @c FUIAuth instance sending the message.
@param authDataResult The data result if the sign in attempt was successful.
@param url pass the deep link associated with an email link sign-in completion. It is useful
for the developer to access the state before the sign-in attempt was triggered.
@param error The error that occurred during sign in, if any.
*/
- (void)authUI:(FUIAuth *)authUI
didSignInWith:(nullable FIRAuthDataResult *)authDataResult
URL:(nullable NSURL *)url
error:(nullable NSError *)error;

/** @fn authUI:didSignInWithAuthDataResult:error:
@brief Message sent after the sign in process has completed to report the signed in user or
error encountered. Use this variation with Firebase 10 and earlier.
@param authUI The @c FUIAuth instance sending the message.
@param authDataResult The data result if the sign in attempt was successful.
@param error The error that occurred during sign in, if any.
Expand All @@ -71,6 +86,18 @@ typedef void (^FUIAuthResultCallback)(FIRUser *_Nullable user, NSError *_Nullabl
didSignInWithAuthDataResult:(nullable FIRAuthDataResult *)authDataResult
error:(nullable NSError *)error;

/** @fn authUI:didSignInWithAuthDataResult:error:
@brief Message sent after the sign in process has completed to report the signed in user or
error encountered. Use this variation with Firebase 11 and later. Swift implementations
should be marked with `@objc`.
@param authUI The @c FUIAuth instance sending the message.
@param authDataResult The data result if the sign in attempt was successful.
@param error The error that occurred during sign in, if any.
*/
- (void)authUI:(FUIAuth *)authUI
didSignInWith:(nullable FIRAuthDataResult *)authDataResult
error:(nullable NSError *)error;

/** @fn authUI:didSignInWithUser:error:
@brief This is deprecated API and will be removed in a future release.
Use @c authUI:didSignInWithAuthDataResult:error:
Expand Down

0 comments on commit 34a2a69

Please sign in to comment.