Skip to content

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

Merged
merged 5 commits into from
Nov 22, 2017

Conversation

protocol86
Copy link
Contributor

No description provided.

isNewUser:NO];
FIRAuthDataResult *result = [[FIRAuthDataResult alloc] initWithUser:user
additionalUserInfo:additionalUserInfo];
decoratedCallback(result, nil);
Copy link

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks.

completion(nil, error);
return;
}
completion(response, error);
Copy link

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.

Copy link
Contributor Author

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 {
Copy link
Contributor

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:?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done thank!

- (void)signInAndRetrieveDataWithEmail:(NSString *)email
password:(NSString *)password
completion:(FIRAuthDataResultCallback)completion {
dispatch_async(FIRAuthGlobalWorkQueue(), ^{
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

[self internalSignInWithEmail:email
password:password
completion:^(FIRVerifyPasswordResponse *_Nullable response,
NSError * _Nullable error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove space: '*_Nullable'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -1151,6 +1177,30 @@ - (void)phoneNumberSignInWithRequest:(FIRVerifyPhoneNumberRequest *)request
}
#endif

/** @fn internalSignInWithEmail:password:callback:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with 'completion'

password:password
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
if (error) {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

[self signInFlowAuthDataResultCallbackByDecoratingCallback:completion];
[self internalSignInAndRetrieveDataWithEmail:email
password:password
completion:^(FIRAuthDataResult *_Nullable authResult,
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, done.

@@ -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]]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unintended extra indent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thank you.

@protocol86 protocol86 merged commit bc2d784 into master Nov 22, 2017
minafarid pushed a commit to minafarid/firebase-ios-sdk that referenced this pull request Jun 6, 2018
* Adds AuthDataResult to signInWithEmail:Password

* Addresses comments

* Addresses comments

* addresses more comments

* Fixes broken tests
@paulb777 paulb777 deleted the Add_AuthResult_to_SignInWithEmailPassword branch August 8, 2018 17:06
paulb777 added a commit that referenced this pull request Aug 19, 2019
@firebase firebase locked and limited conversation to collaborators Nov 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants