Skip to content

Commit d614ad4

Browse files
authored
Code sanitization (#417)
* Code sanitization - Aligns colons - Removes uncessary nil check - documents internal method - Fixes minor typos * Addresses comments
1 parent b1e7ea3 commit d614ad4

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

FirebaseAuthUI/FUIAuth.m

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ - (void)signInWithProviderUI:(id<FUIAuthProvider>)providerUI
158158
// Sign out first to make sure sign in starts with a clean state.
159159
[providerUI signOut];
160160
[providerUI signInWithDefaultValue:defaultValue
161-
presentingViewController:presentingViewController
162-
completion:^(FIRAuthCredential *_Nullable credential,
163-
NSError *_Nullable error,
164-
_Nullable FIRAuthResultCallback result) {
161+
presentingViewController:presentingViewController
162+
completion:^(FIRAuthCredential *_Nullable credential,
163+
NSError *_Nullable error,
164+
_Nullable FIRAuthResultCallback result) {
165165
BOOL isAuthPickerShown =
166166
[presentingViewController isKindOfClass:[FUIAuthPickerViewController class]];
167167
if (error) {
@@ -177,12 +177,12 @@ - (void)signInWithProviderUI:(id<FUIAuthProvider>)providerUI
177177
[self.auth signInAndRetrieveDataWithCredential:credential
178178
completion:^(FIRAuthDataResult *_Nullable authResult,
179179
NSError *_Nullable error) {
180-
if (error && error.code == FIRAuthErrorCodeAccountExistsWithDifferentCredential) {
180+
if (error.code == FIRAuthErrorCodeAccountExistsWithDifferentCredential) {
181181
NSString *email = error.userInfo[kErrorUserInfoEmailKey];
182182
[self handleAccountLinkingForEmail:email
183183
newCredential:credential
184184
presentingViewController:presentingViewController
185-
singInResult:result];
185+
signInResult:result];
186186
return;
187187
}
188188

@@ -208,10 +208,20 @@ - (void)signInWithProviderUI:(id<FUIAuthProvider>)providerUI
208208
}];
209209
}
210210

211+
/** @fn handleAccountLinkingForEmail:newCredential:presentingViewController:signInResult
212+
@brief Handles the account linking case after a user tries to sign-in which has a credential
213+
with an email which is already used by a different account.
214+
@param email The email address used by an existing account and and also the credential used in
215+
the sign-in attempt.
216+
@param newCredential The credential used in the lastest sign-in attempt.
217+
@param presentingViewController The view controller used to present the UI.
218+
@param signInResult block which takes the result of this method as a parameter; a nullable
219+
AuthResult indicating success or a nullable Error indicating failure.
220+
*/
211221
- (void)handleAccountLinkingForEmail:(NSString *)email
212222
newCredential:(FIRAuthCredential *)newCredential
213223
presentingViewController:(UIViewController *)presentingViewController
214-
singInResult:(_Nullable FIRAuthResultCallback) result {
224+
signInResult:(_Nullable FIRAuthResultCallback)result {
215225

216226
[self.auth fetchProvidersForEmail:email
217227
completion:^(NSArray<NSString *> *_Nullable providers,

FirebaseAuthUI/FUIAuth_Internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
4848
@see FUIAuthDelegate.authUI:didSignInWithAuthDataResult:error: for method callback.
4949
@param providerUI The authentication provider used for signing in.
5050
@param presentingViewController The view controller used to present the UI.
51-
@param defaultValue The provider default initialization value (e g email or phone number)
51+
@param defaultValue The provider default initialization value (e.g. email or phone number)
5252
used for signing in.
5353
*/
5454
- (void)signInWithProviderUI:(id<FUIAuthProvider>)providerUI

0 commit comments

Comments
 (0)