-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Adds AuthDataResult to signInWithEmailPassword Method #484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Firebase/Auth/Source/FIRAuth.m
Outdated
isNewUser:NO]; | ||
FIRAuthDataResult *result = [[FIRAuthDataResult alloc] initWithUser:user | ||
additionalUserInfo:additionalUserInfo]; | ||
decoratedCallback(result, nil); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last 3 lines are misaligned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks.
Firebase/Auth/Source/FIRAuth.m
Outdated
completion(nil, error); | ||
return; | ||
} | ||
completion(response, error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass completion to FIRAuthBackend verifiyPassword:callback:
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks
@@ -512,46 +512,59 @@ - (void)signInWithEmail:(NSString *)email | |||
password:(NSString *)password | |||
completion:(FIRAuthResultCallback)completion { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to call signInAndRetrieveDataWithEmail:password:completion:
, just like signInWithCredential:completion:
delegates to signInAndRetrieveDataWithCredential:completion:
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done thank!
Firebase/Auth/Source/FIRAuth.m
Outdated
- (void)signInAndRetrieveDataWithEmail:(NSString *)email | ||
password:(NSString *)password | ||
completion:(FIRAuthDataResultCallback)completion { | ||
dispatch_async(FIRAuthGlobalWorkQueue(), ^{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here: can we call signInAndRetriveDataWithCredential:completion:
to avoid repeated logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Firebase/Auth/Source/FIRAuth.m
Outdated
[self internalSignInWithEmail:email | ||
password:password | ||
completion:^(FIRVerifyPasswordResponse *_Nullable response, | ||
NSError * _Nullable error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove space: '*_Nullable'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Firebase/Auth/Source/FIRAuth.m
Outdated
@@ -1151,6 +1177,30 @@ - (void)phoneNumberSignInWithRequest:(FIRVerifyPhoneNumberRequest *)request | |||
} | |||
#endif | |||
|
|||
/** @fn internalSignInWithEmail:password:callback: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace with 'completion'
Firebase/Auth/Source/FIRAuth.m
Outdated
password:password | ||
completion:^(FIRAuthDataResult *_Nullable authResult, | ||
NSError *_Nullable error) { | ||
if (error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that checking for error
is unnecessary. Simply calling decoratedCallback(authResult.user, error);
should work for both cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Firebase/Auth/Source/FIRAuth.m
Outdated
[self signInFlowAuthDataResultCallbackByDecoratingCallback:completion]; | ||
[self internalSignInAndRetrieveDataWithEmail:email | ||
password:password | ||
completion:^(FIRAuthDataResult *_Nullable authResult, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to pass in decoratedCallback
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, done.
Firebase/Auth/Source/FIRAuth.m
Outdated
@@ -587,7 +630,7 @@ - (void)internalSignInWithCredential:(FIRAuthCredential *)credential | |||
- (void)internalSignInAndRetrieveDataWithCredential:(FIRAuthCredential *)credential | |||
isReauthentication:(BOOL)isReauthentication | |||
callback:(nullable FIRAuthDataResultCallback)callback { | |||
if ([credential isKindOfClass:[FIREmailPasswordAuthCredential class]]) { | |||
if ([credential isKindOfClass:[FIREmailPasswordAuthCredential class]]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unintended extra indent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thank you.
* Adds AuthDataResult to signInWithEmail:Password * Addresses comments * Addresses comments * addresses more comments * Fixes broken tests
No description provided.