-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Adds automated test for manual phone sign-in #376
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
@@ -428,6 +428,11 @@ | |||
*/ | |||
static NSString *const kAutoAccountLinking = @"Link with Google"; | |||
|
|||
/** @var kAutoPhoneNumberSignIn | |||
@brief The button title for automated account linking. |
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.
Will fix indentation on next push.
@@ -680,7 +685,7 @@ - (void)updateTable { | |||
action:^{ [weakSelf linkPhoneNumber]; }], | |||
[StaticContentTableViewCell cellWithTitle:kUnlinkPhoneNumber | |||
action:^{ | |||
[weakSelf unlinkFromProvider:FIRPhoneAuthProviderID]; | |||
[weakSelf unlinkFromProvider:FIRPhoneAuthProviderID completion: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.
no indentation is needed here.
@@ -428,6 +428,11 @@ | |||
*/ | |||
static NSString *const kAutoAccountLinking = @"Link with Google"; | |||
|
|||
/** @var kAutoPhoneNumberSignIn | |||
@brief The button title for automated account linking. |
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.
The "brief" should be related to Phone Number Sign In and not account linking.
[self logFailedTest:@"Could not update phone number."]; | ||
} | ||
[self logSuccess:@"update phone number test succeeded."]; | ||
[self unlinkFromProvider:FIRPhoneAuthProviderID 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.
remove space after "^"
@@ -2050,14 +2107,15 @@ - (void)showEmailPasswordDialogWithCompletion:(ShowEmailPasswordDialogCompletion | |||
@brief Unlinks the current user from the provider with the specified provider ID. | |||
@param provider The provider ID of the provider to unlink the current user's account from. |
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.
Please add "completion" parameter to this comment block, please make sure this is added to all the functions where you added a completion.
Example:
@param completion A completion block to be executed after the provider is unlinked.
@param phoneNumber Number pass in string for automation. | ||
*/ | ||
- (void)signInWithPhoneNumberRecaptchaWithString:(NSString *_Nullable)phoneNumber | ||
completion:(void(^)(NSError *_Nullable))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.
Please align ":" by indenting this line.
@brief Allows sign in with phone number using reCAPTCHA and completion. | ||
@param phoneNumber Number pass in string for automation. | ||
*/ | ||
- (void)signInWithPhoneNumberRecaptchaWithString:(NSString *_Nullable)phoneNumber |
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.
I'd prefer the name signInWithPhoneNumber:(NSString *_Nullable)phoneNumber
completion:(void(^)(NSError *_Nullable))completion...
The reasons are:
- ReCAPTCHA is now the correct way to sign in with phone number so it is no longer a special case.
- We try out best to make sure the last part of the function name is the name of the actual variable (starting with a lowercase character);
Example:
- (void) doSomethingWithSomethingElse:(NSString *)somethingElse;
Notice that the SomethingElse at the end of the function name matches the "somethingelse" which is the variable name.
Same for other functions (update, link).
@param phoneNumber Number pass in string for automation. | ||
*/ | ||
- (void)linkPhoneNumberWithString:(NSString *_Nullable)phoneNumber | ||
completion:(void(^)(void))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.
align ":"
@@ -2653,13 +2725,27 @@ - (void)linkPhoneNumber { | |||
return; | |||
} | |||
[self logSuccess:@"link phone number succeeded."]; | |||
if (completion) 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.
As convention we use curly braces for conditionals even when unnecessary.
if (completion) {
completion();
}
@param phoneNumber Number pass in string for automation. | ||
*/ | ||
- (void)linkPhoneNumberWithString:(NSString *_Nullable)phoneNumber | ||
completion:(void(^)(void))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.
The completion should take an error parameter just like signInWithPhoneNumberRecaptchaWithString.
[self hideSpinner:^{ | ||
if (error) { | ||
[self logFailure:@"failed to send verification code" error:error]; | ||
[self showMessagePrompt:error.localizedDescription]; |
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.
In case of error, you need to call the completion block with the error before returning.
Example:
completion(error);
return;
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.
In the future please reply to comment indicating that they are addressed, just the word "Done" is usually enough. :)
/** @fn signInWithPhoneNumberPrompt | ||
@brief Allows sign in with phone number via popup prompt. | ||
*/ | ||
- (void)signInWithPhoneNumberPrompt { |
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.
signInWithPhoneNumberWithPrompt sounds better. The current name makes the method sound like a it only shows a prompt for signing in with phone number but not actually doing the sign in. Same for other methods.
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.
…gnin Adds automated test for manual phone sign-in.
Added automation for phone manual test.