aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Auth/Source
diff options
context:
space:
mode:
authorGravatar Zsika Phillip <protocol86@users.noreply.github.com>2018-02-26 09:48:09 -0800
committerGravatar GitHub <noreply@github.com>2018-02-26 09:48:09 -0800
commitd4ec10577a40e8a913070cf40a29636c41aafbd2 (patch)
tree74267fbcdb2d4b7707a9989d31a47e9f309a5f28 /Firebase/Auth/Source
parent13e366738463739f0c21d4cedab4bafbfdb57c6f (diff)
Fixes clang warnings for Auth (#848)
* Fixes clang warnings for Auth * Addresses comments
Diffstat (limited to 'Firebase/Auth/Source')
-rw-r--r--Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m30
-rw-r--r--Firebase/Auth/Source/FIRAuth.m46
-rw-r--r--Firebase/Auth/Source/FIRAuthAPNSTokenManager.m8
-rw-r--r--Firebase/Auth/Source/FIRAuthNotificationManager.m8
-rw-r--r--Firebase/Auth/Source/FIRAuthSerialTaskQueue.m6
-rw-r--r--Firebase/Auth/Source/FIRAuthURLPresenter.m28
-rw-r--r--Firebase/Auth/Source/FIRSecureTokenService.m13
-rw-r--r--Firebase/Auth/Source/FIRUser.m101
8 files changed, 124 insertions, 116 deletions
diff --git a/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m b/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m
index 4a0120b..a44a340 100644
--- a/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m
+++ b/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m
@@ -166,11 +166,11 @@ NSString *const kReCAPTCHAURLStringFormat = @"https://%@/__/auth/handler?%@";
FIRAuthURLCallbackMatcher callbackMatcher = ^BOOL(NSURL *_Nullable callbackURL) {
return [self isVerifyAppURL:callbackURL eventID:eventID];
};
- [_auth.authURLPresenter presentURL:reCAPTCHAURL
- UIDelegate:UIDelegate
- callbackMatcher:callbackMatcher
- completion:^(NSURL *_Nullable callbackURL,
- NSError *_Nullable error) {
+ [self->_auth.authURLPresenter presentURL:reCAPTCHAURL
+ UIDelegate:UIDelegate
+ callbackMatcher:callbackMatcher
+ completion:^(NSURL *_Nullable callbackURL,
+ NSError *_Nullable error) {
if (error) {
callBackOnMainThread(nil, error);
return;
@@ -185,7 +185,8 @@ NSString *const kReCAPTCHAURLStringFormat = @"https://%@/__/auth/handler?%@";
[[FIRSendVerificationCodeRequest alloc] initWithPhoneNumber:phoneNumber
appCredential:nil
reCAPTCHAToken:reCAPTCHAToken
- requestConfiguration:_auth.requestConfiguration];
+ requestConfiguration:
+ self->_auth.requestConfiguration];
[FIRAuthBackend sendVerificationCode:request
callback:^(FIRSendVerificationCodeResponse
*_Nullable response, NSError *_Nullable error) {
@@ -361,14 +362,15 @@ NSString *const kReCAPTCHAURLStringFormat = @"https://%@/__/auth/handler?%@";
[[FIRSendVerificationCodeRequest alloc] initWithPhoneNumber:phoneNumber
appCredential:appCredential
reCAPTCHAToken:nil
- requestConfiguration:_auth.requestConfiguration];
+ requestConfiguration:
+ self->_auth.requestConfiguration];
[FIRAuthBackend sendVerificationCode:request
callback:^(FIRSendVerificationCodeResponse *_Nullable response,
NSError *_Nullable error) {
if (error) {
if (error.code == FIRAuthErrorCodeInvalidAppCredential) {
if (retryOnInvalidAppCredential) {
- [_auth.appCredentialManager clearCredential];
+ [self->_auth.appCredentialManager clearCredential];
[self verifyClientAndSendVerificationCodeToPhoneNumber:phoneNumber
retryOnInvalidAppCredential:NO
callback:callback];
@@ -404,7 +406,7 @@ NSString *const kReCAPTCHAURLStringFormat = @"https://%@/__/auth/handler?%@";
FIRVerifyClientRequest *request =
[[FIRVerifyClientRequest alloc] initWithAppToken:token.string
isSandbox:token.type == FIRAuthAPNSTokenTypeSandbox
- requestConfiguration:_auth.requestConfiguration];
+ requestConfiguration:self->_auth.requestConfiguration];
[FIRAuthBackend verifyClient:request callback:^(FIRVerifyClientResponse *_Nullable response,
NSError *_Nullable error) {
if (error) {
@@ -412,7 +414,7 @@ NSString *const kReCAPTCHAURLStringFormat = @"https://%@/__/auth/handler?%@";
return;
}
NSTimeInterval timeout = [response.suggestedTimeOutDate timeIntervalSinceNow];
- [_auth.appCredentialManager
+ [self->_auth.appCredentialManager
didStartVerificationWithReceipt:response.receipt
timeout:timeout
callback:^(FIRAuthAppCredential *credential) {
@@ -442,8 +444,8 @@ NSString *const kReCAPTCHAURLStringFormat = @"https://%@/__/auth/handler?%@";
return;
}
NSString *bundleID = [NSBundle mainBundle].bundleIdentifier;
- NSString *clienID = _auth.app.options.clientID;
- NSString *apiKey = _auth.requestConfiguration.APIKey;
+ NSString *clienID = self->_auth.app.options.clientID;
+ NSString *apiKey = self->_auth.requestConfiguration.APIKey;
NSMutableDictionary *urlArguments = [[NSMutableDictionary alloc] initWithDictionary: @{
@"apiKey" : apiKey,
@"authType" : kAuthTypeVerifyApp,
@@ -452,8 +454,8 @@ NSString *const kReCAPTCHAURLStringFormat = @"https://%@/__/auth/handler?%@";
@"v" : [FIRAuthBackend authUserAgent],
@"eventId" : eventID,
}];
- if (_auth.requestConfiguration.languageCode) {
- urlArguments[@"hl"] = _auth.requestConfiguration.languageCode;
+ if (self->_auth.requestConfiguration.languageCode) {
+ urlArguments[@"hl"] = self->_auth.requestConfiguration.languageCode;
}
NSString *argumentsString = [urlArguments gtm_httpArgumentsString];
NSString *URLString =
diff --git a/Firebase/Auth/Source/FIRAuth.m b/Firebase/Auth/Source/FIRAuth.m
index ebca6c8..0f3705f 100644
--- a/Firebase/Auth/Source/FIRAuth.m
+++ b/Firebase/Auth/Source/FIRAuth.m
@@ -436,7 +436,7 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
NSError *error;
if ([strongSelf getUser:&user error:&error]) {
[strongSelf updateCurrentUser:user byForce:NO savingToDisk:NO error:&error];
- _lastNotifiedUserToken = user.rawAccessToken;
+ self->_lastNotifiedUserToken = user.rawAccessToken;
} else {
FIRLogError(kFIRLoggerAuth, @"I-AUT000001",
@"Error loading saved user when starting up: %@", error);
@@ -486,7 +486,7 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
- (FIRUser *)currentUser {
__block FIRUser *result;
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- result = _currentUser;
+ result = self->_currentUser;
});
return result;
}
@@ -497,7 +497,7 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
FIRCreateAuthURIRequest *request =
[[FIRCreateAuthURIRequest alloc] initWithIdentifier:email
continueURI:@"http://www.google.com/"
- requestConfiguration:_requestConfiguration];
+ requestConfiguration:self->_requestConfiguration];
[FIRAuthBackend createAuthURI:request callback:^(FIRCreateAuthURIResponse *_Nullable response,
NSError *_Nullable error) {
if (completion) {
@@ -743,14 +743,14 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
dispatch_async(FIRAuthGlobalWorkQueue(), ^{
FIRAuthDataResultCallback decoratedCallback =
[self signInFlowAuthDataResultCallbackByDecoratingCallback:completion];
- if (_currentUser.anonymous) {
+ if (self->_currentUser.anonymous) {
FIRAdditionalUserInfo *additionalUserInfo =
[[FIRAdditionalUserInfo alloc] initWithProviderID:nil
profile:nil
username:nil
isNewUser:NO];
FIRAuthDataResult *authDataResult =
- [[FIRAuthDataResult alloc] initWithUser:_currentUser
+ [[FIRAuthDataResult alloc] initWithUser:self->_currentUser
additionalUserInfo:additionalUserInfo];
decoratedCallback(authDataResult, nil);
return;
@@ -784,8 +784,8 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
dispatch_async(FIRAuthGlobalWorkQueue(), ^{
FIRAuthResultCallback decoratedCallback =
[self signInFlowAuthResultCallbackByDecoratingCallback:completion];
- if (_currentUser.anonymous) {
- decoratedCallback(_currentUser, nil);
+ if (self->_currentUser.anonymous) {
+ decoratedCallback(self->_currentUser, nil);
return;
}
[self internalSignInAnonymouslyWithCompletion:^(FIRSignUpNewUserResponse *_Nullable response,
@@ -889,7 +889,7 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
FIRResetPasswordRequest *request =
[[FIRResetPasswordRequest alloc] initWithOobCode:code
newPassword:newPassword
- requestConfiguration:_requestConfiguration];
+ requestConfiguration:self->_requestConfiguration];
[FIRAuthBackend resetPassword:request callback:^(FIRResetPasswordResponse *_Nullable response,
NSError *_Nullable error) {
if (completion) {
@@ -910,7 +910,7 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
FIRResetPasswordRequest *request =
[[FIRResetPasswordRequest alloc] initWithOobCode:code
newPassword:nil
- requestConfiguration:_requestConfiguration];
+ requestConfiguration:self->_requestConfiguration];
[FIRAuthBackend resetPassword:request callback:^(FIRResetPasswordResponse *_Nullable response,
NSError *_Nullable error) {
if (completion) {
@@ -951,7 +951,7 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
- (void)applyActionCode:(NSString *)code completion:(FIRApplyActionCodeCallback)completion {
dispatch_async(FIRAuthGlobalWorkQueue(), ^ {
FIRSetAccountInfoRequest *request =
- [[FIRSetAccountInfoRequest alloc] initWithRequestConfiguration:_requestConfiguration];
+ [[FIRSetAccountInfoRequest alloc] initWithRequestConfiguration:self->_requestConfiguration];
request.OOBCode = code;
[FIRAuthBackend setAccountInfo:request callback:^(FIRSetAccountInfoResponse *_Nullable response,
NSError *_Nullable error) {
@@ -999,7 +999,8 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
FIRGetOOBConfirmationCodeRequest *request =
[FIRGetOOBConfirmationCodeRequest passwordResetRequestWithEmail:email
actionCodeSettings:actionCodeSettings
- requestConfiguration:_requestConfiguration];
+ requestConfiguration:self->_requestConfiguration
+ ];
[FIRAuthBackend getOOBConfirmationCode:request
callback:^(FIRGetOOBConfirmationCodeResponse *_Nullable response,
NSError *_Nullable error) {
@@ -1015,7 +1016,7 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
- (BOOL)signOut:(NSError *_Nullable __autoreleasing *_Nullable)error {
__block BOOL result = YES;
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- if (!_currentUser) {
+ if (!self->_currentUser) {
return;
}
result = [self updateCurrentUser:nil byForce:NO savingToDisk:YES error:error];
@@ -1068,7 +1069,7 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
[_listenerHandles addObject:handle];
}
dispatch_async(dispatch_get_main_queue(), ^{
- listener(self, self.currentUser);
+ listener(self, self->_currentUser);
});
return handle;
}
@@ -1082,7 +1083,8 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
- (void)useAppLanguage {
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- _requestConfiguration.languageCode = [NSBundle mainBundle].preferredLocalizations.firstObject;
+ self->_requestConfiguration.languageCode =
+ [NSBundle mainBundle].preferredLocalizations.firstObject;
});
}
@@ -1092,17 +1094,17 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
- (void)setLanguageCode:(nullable NSString *)languageCode {
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- _requestConfiguration.languageCode = [languageCode copy];
+ self->_requestConfiguration.languageCode = [languageCode copy];
});
}
- (NSString *)additionalFrameworkMarker {
- return _requestConfiguration.additionalFrameworkMarker;
+ return self->_requestConfiguration.additionalFrameworkMarker;
}
- (void)setAdditionalFrameworkMarker:(NSString *)additionalFrameworkMarker {
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- _requestConfiguration.additionalFrameworkMarker = [additionalFrameworkMarker copy];
+ self->_requestConfiguration.additionalFrameworkMarker = [additionalFrameworkMarker copy];
});
}
@@ -1110,7 +1112,7 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
- (NSData *)APNSToken {
__block NSData *result = nil;
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- result = _tokenManager.token.data;
+ result = self->_tokenManager.token.data;
});
return result;
}
@@ -1121,20 +1123,20 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
- (void)setAPNSToken:(NSData *)token type:(FIRAuthAPNSTokenType)type {
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- _tokenManager.token = [[FIRAuthAPNSToken alloc] initWithData:token type:type];
+ self->_tokenManager.token = [[FIRAuthAPNSToken alloc] initWithData:token type:type];
});
}
- (void)handleAPNSTokenError:(NSError *)error {
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- [_tokenManager cancelWithError:error];
+ [self->_tokenManager cancelWithError:error];
});
}
- (BOOL)canHandleNotification:(NSDictionary *)userInfo {
__block BOOL result = NO;
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- result = [_notificationManager canHandleNotification:userInfo];
+ result = [self->_notificationManager canHandleNotification:userInfo];
});
return result;
}
@@ -1142,7 +1144,7 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
- (BOOL)canHandleURL:(NSURL *)URL {
__block BOOL result = NO;
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- result = [_authURLPresenter canHandleURL:URL];
+ result = [self->_authURLPresenter canHandleURL:URL];
});
return result;
}
diff --git a/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m b/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m
index 215a391..2b39aef 100644
--- a/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m
+++ b/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m
@@ -68,13 +68,13 @@ static const NSTimeInterval kLegacyRegistrationTimeout = 30;
_pendingCallbacks =
[[NSMutableArray<FIRAuthAPNSTokenCallback> alloc] initWithObjects:callback, nil];
dispatch_async(dispatch_get_main_queue(), ^{
- if ([_application respondsToSelector:@selector(registerForRemoteNotifications)]) {
- [_application registerForRemoteNotifications];
+ if ([self->_application respondsToSelector:@selector(registerForRemoteNotifications)]) {
+ [self->_application registerForRemoteNotifications];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#if TARGET_OS_IOS
- [_application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert];
+ [self->_application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert];
#endif // TARGET_OS_IOS
#pragma clang diagnostic pop
}
@@ -83,7 +83,7 @@ static const NSTimeInterval kLegacyRegistrationTimeout = 30;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_timeout * NSEC_PER_SEC)),
FIRAuthGlobalWorkQueue(), ^{
// Only cancel if the pending callbacks remain the same, i.e., not triggered yet.
- if (applicableCallbacks == _pendingCallbacks) {
+ if (applicableCallbacks == self->_pendingCallbacks) {
[self callBackWithToken:nil error:nil];
}
});
diff --git a/Firebase/Auth/Source/FIRAuthNotificationManager.m b/Firebase/Auth/Source/FIRAuthNotificationManager.m
index b1dd34c..624de10 100644
--- a/Firebase/Auth/Source/FIRAuthNotificationManager.m
+++ b/Firebase/Auth/Source/FIRAuthNotificationManager.m
@@ -104,14 +104,14 @@ static const NSTimeInterval kProbingTimeout = 1;
kNotificationProberKey : @"This fake notification should be forwarded to Firebase Auth."
}
};
- if ([_application.delegate respondsToSelector:
+ if ([self->_application.delegate respondsToSelector:
@selector(application:didReceiveRemoteNotification:fetchCompletionHandler:)]) {
- [_application.delegate application:_application
+ [self->_application.delegate application:self->_application
didReceiveRemoteNotification:proberNotification
fetchCompletionHandler:^(UIBackgroundFetchResult result) {}];
- } else if ([_application.delegate respondsToSelector:
+ } else if ([self->_application.delegate respondsToSelector:
@selector(application:didReceiveRemoteNotification:)]) {
- [_application.delegate application:_application
+ [self->_application.delegate application:self->_application
didReceiveRemoteNotification:proberNotification];
} else {
FIRLogWarning(kFIRLoggerAuth, @"I-AUT000015",
diff --git a/Firebase/Auth/Source/FIRAuthSerialTaskQueue.m b/Firebase/Auth/Source/FIRAuthSerialTaskQueue.m
index 3be0f54..edceeec 100644
--- a/Firebase/Auth/Source/FIRAuthSerialTaskQueue.m
+++ b/Firebase/Auth/Source/FIRAuthSerialTaskQueue.m
@@ -37,14 +37,14 @@
- (void)enqueueTask:(FIRAuthSerialTask)task {
// This dispatch queue will run tasks serially in FIFO order, as long as it's not suspended.
- dispatch_async(_dispatchQueue, ^{
+ dispatch_async(self->_dispatchQueue, ^{
// But as soon as a task is started, stop other tasks from running until the task calls it's
// completion handler, which allows the queue to resume processing of tasks. This allows the
// task to perform other asyncronous actions on other dispatch queues and "get back to us" when
// all of their sub-tasks are complete.
- dispatch_suspend(_dispatchQueue);
+ dispatch_suspend(self->_dispatchQueue);
task(^{
- dispatch_resume(_dispatchQueue);
+ dispatch_resume(self->_dispatchQueue);
});
});
}
diff --git a/Firebase/Auth/Source/FIRAuthURLPresenter.m b/Firebase/Auth/Source/FIRAuthURLPresenter.m
index 5526a85..d8e3593 100644
--- a/Firebase/Auth/Source/FIRAuthURLPresenter.m
+++ b/Firebase/Auth/Source/FIRAuthURLPresenter.m
@@ -81,17 +81,19 @@ NS_ASSUME_NONNULL_BEGIN
_callbackMatcher = callbackMatcher;
_completion = completion;
dispatch_async(dispatch_get_main_queue(), ^() {
- _UIDelegate = UIDelegate ?: [FIRAuthDefaultUIDelegate defaultUIDelegate];
+ self->_UIDelegate = UIDelegate ?: [FIRAuthDefaultUIDelegate defaultUIDelegate];
if ([SFSafariViewController class]) {
- _safariViewController = [[SFSafariViewController alloc] initWithURL:URL];
- _safariViewController.delegate = self;
- [_UIDelegate presentViewController:_safariViewController animated:YES completion:nil];
+ self->_safariViewController = [[SFSafariViewController alloc] initWithURL:URL];
+ self->_safariViewController.delegate = self;
+ [self->_UIDelegate presentViewController:self->_safariViewController
+ animated:YES
+ completion:nil];
return;
} else {
- _webViewController = [[FIRAuthWebViewController alloc] initWithURL:URL delegate:self];
+ self->_webViewController = [[FIRAuthWebViewController alloc] initWithURL:URL delegate:self];
UINavigationController *navController =
- [[UINavigationController alloc] initWithRootViewController:_webViewController];
- [_UIDelegate presentViewController:navController animated:YES completion:nil];
+ [[UINavigationController alloc] initWithRootViewController:self->_webViewController];
+ [self->_UIDelegate presentViewController:navController animated:YES completion:nil];
}
});
}
@@ -108,8 +110,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
dispatch_async(FIRAuthGlobalWorkQueue(), ^() {
- if (controller == _safariViewController) {
- _safariViewController = nil;
+ if (controller == self->_safariViewController) {
+ self->_safariViewController = nil;
//TODO:Ensure that the SFSafariViewController is actually removed from the screen before
//invoking finishPresentationWithURL:error:
[self finishPresentationWithURL:nil
@@ -123,7 +125,7 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL)webViewController:(FIRAuthWebViewController *)webViewController canHandleURL:(NSURL *)URL {
__block BOOL result = NO;
dispatch_sync(FIRAuthGlobalWorkQueue(), ^() {
- if (webViewController == _webViewController) {
+ if (webViewController == self->_webViewController) {
result = [self canHandleURL:URL];
}
});
@@ -132,7 +134,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)webViewControllerDidCancel:(FIRAuthWebViewController *)webViewController {
dispatch_async(FIRAuthGlobalWorkQueue(), ^() {
- if (webViewController == _webViewController) {
+ if (webViewController == self->_webViewController) {
[self finishPresentationWithURL:nil
error:[FIRAuthErrorUtils webContextCancelledErrorWithMessage:nil]];
}
@@ -142,7 +144,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)webViewController:(FIRAuthWebViewController *)webViewController
didFailWithError:(NSError *)error {
dispatch_async(FIRAuthGlobalWorkQueue(), ^() {
- if (webViewController == _webViewController) {
+ if (webViewController == self->_webViewController) {
[self finishPresentationWithURL:nil error:error];
}
});
@@ -163,7 +165,7 @@ NS_ASSUME_NONNULL_BEGIN
FIRAuthURLPresentationCompletion completion = _completion;
_completion = nil;
void (^finishBlock)(void) = ^() {
- _isPresenting = NO;
+ self->_isPresenting = NO;
completion(URL, error);
};
SFSafariViewController *safariViewController = _safariViewController;
diff --git a/Firebase/Auth/Source/FIRSecureTokenService.m b/Firebase/Auth/Source/FIRSecureTokenService.m
index 8e37a05..69434ff 100644
--- a/Firebase/Auth/Source/FIRSecureTokenService.m
+++ b/Firebase/Auth/Source/FIRSecureTokenService.m
@@ -107,7 +107,7 @@ static const NSTimeInterval kFiveMinutes = 5 * 60;
[_taskQueue enqueueTask:^(FIRAuthSerialTaskCompletionBlock complete) {
if (!forceRefresh && [self hasValidAccessToken]) {
complete();
- callback(_accessToken, nil, NO);
+ callback(self->_accessToken, nil, NO);
} else {
[self requestAccessToken:^(NSString *_Nullable token,
NSError *_Nullable error,
@@ -184,14 +184,15 @@ static const NSTimeInterval kFiveMinutes = 5 * 60;
NSError *_Nullable error) {
BOOL tokenUpdated = NO;
NSString *newAccessToken = response.accessToken;
- if (newAccessToken.length && ![newAccessToken isEqualToString:_accessToken]) {
- _accessToken = [newAccessToken copy];
- _accessTokenExpirationDate = response.approximateExpirationDate;
+ if (newAccessToken.length && ![newAccessToken isEqualToString:self->_accessToken]) {
+ self->_accessToken = [newAccessToken copy];
+ self->_accessTokenExpirationDate = response.approximateExpirationDate;
tokenUpdated = YES;
}
NSString *newRefreshToken = response.refreshToken;
- if (newRefreshToken.length && ![newRefreshToken isEqualToString:_refreshToken]) {
- _refreshToken = [newRefreshToken copy];
+ if (newRefreshToken.length &&
+ ![newRefreshToken isEqualToString:self->_refreshToken]) {
+ self->_refreshToken = [newRefreshToken copy];
tokenUpdated = YES;
}
callback(newAccessToken, error, tokenUpdated);
diff --git a/Firebase/Auth/Source/FIRUser.m b/Firebase/Auth/Source/FIRUser.m
index 6af263d..a77db75 100644
--- a/Firebase/Auth/Source/FIRUser.m
+++ b/Firebase/Auth/Source/FIRUser.m
@@ -383,7 +383,7 @@ static void callInMainThreadWithAuthDataResultAndError(
}
FIRGetAccountInfoRequest *getAccountInfoRequest =
[[FIRGetAccountInfoRequest alloc] initWithAccessToken:accessToken
- requestConfiguration:_auth.requestConfiguration];
+ requestConfiguration:self->_auth.requestConfiguration];
[FIRAuthBackend getAccountInfo:getAccountInfoRequest
callback:^(FIRGetAccountInfoResponse *_Nullable response,
NSError *_Nullable error) {
@@ -451,7 +451,7 @@ static void callInMainThreadWithAuthDataResultAndError(
callback(error);
return;
}
- FIRAuthRequestConfiguration *configuration = _auth.requestConfiguration;
+ FIRAuthRequestConfiguration *configuration = self->_auth.requestConfiguration;
// Mutate setAccountInfoRequest in block:
FIRSetAccountInfoRequest *setAccountInfoRequest =
[[FIRSetAccountInfoRequest alloc] initWithRequestConfiguration:configuration];
@@ -513,7 +513,7 @@ static void callInMainThreadWithAuthDataResultAndError(
callback(error);
return;
}
- _tokenService = tokenService;
+ self->_tokenService = tokenService;
if (![self updateKeychain:&error]) {
callback(error);
return;
@@ -558,11 +558,11 @@ static void callInMainThreadWithAuthDataResultAndError(
return;
}
if (email) {
- _email = email;
+ self->_email = email;
}
- if (_email && password) {
- _anonymous = NO;
- _hasEmailPasswordCredential = YES;
+ if (self->_email && password) {
+ self->_anonymous = NO;
+ self->_hasEmailPasswordCredential = YES;
if (!hadEmailPasswordCredential) {
// The list of providers need to be updated for the newly added email-password provider.
[self internalGetTokenWithCallback:^(NSString *_Nullable accessToken,
@@ -571,7 +571,7 @@ static void callInMainThreadWithAuthDataResultAndError(
callback(error);
return;
}
- FIRAuthRequestConfiguration *requestConfiguration = _auth.requestConfiguration;
+ FIRAuthRequestConfiguration *requestConfiguration = self->_auth.requestConfiguration;
FIRGetAccountInfoRequest *getAccountInfoRequest =
[[FIRGetAccountInfoRequest alloc] initWithAccessToken:accessToken
requestConfiguration:requestConfiguration];
@@ -646,7 +646,7 @@ static void callInMainThreadWithAuthDataResultAndError(
initWithVerificationID:phoneAuthCredential.verificationID
verificationCode:phoneAuthCredential.verificationCode
operation:operation
- requestConfiguration:_auth.requestConfiguration];
+ requestConfiguration:self->_auth.requestConfiguration];
request.accessToken = accessToken;
[FIRAuthBackend verifyPhoneNumber:request
callback:^(FIRVerifyPhoneNumberResponse *_Nullable response,
@@ -664,7 +664,7 @@ static void callInMainThreadWithAuthDataResultAndError(
completion(error);
return;
}
- _anonymous = NO;
+ self->_anonymous = NO;
if (![self updateKeychain:&error]) {
completion(error);
return;
@@ -737,10 +737,11 @@ static void callInMainThreadWithAuthDataResultAndError(
reauthenticateAndRetrieveDataWithCredential:(FIRAuthCredential *) credential
completion:(nullable FIRAuthDataResultCallback) completion {
dispatch_async(FIRAuthGlobalWorkQueue(), ^{
- [_auth internalSignInAndRetrieveDataWithCredential:credential
- isReauthentication:YES
- callback:^(FIRAuthDataResult *_Nullable authResult,
- NSError *_Nullable error) {
+ [self->_auth internalSignInAndRetrieveDataWithCredential:credential
+ isReauthentication:YES
+ callback:^(FIRAuthDataResult *_Nullable
+ authResult,
+ NSError *_Nullable error) {
if (error) {
// If "user not found" error returned by backend, translate to user mismatch error which is
// more accurate.
@@ -750,7 +751,7 @@ static void callInMainThreadWithAuthDataResultAndError(
callInMainThreadWithAuthDataResultAndError(completion, authResult, error);
return;
}
- if (![authResult.user.uid isEqual:[_auth getUID]]) {
+ if (![authResult.user.uid isEqual:[self->_auth getUID]]) {
callInMainThreadWithAuthDataResultAndError(completion, authResult,
[FIRAuthErrorUtils userMismatchError]);
return;
@@ -766,7 +767,7 @@ static void callInMainThreadWithAuthDataResultAndError(
- (nullable NSString *)refreshToken {
__block NSString *result;
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- result = _tokenService.refreshToken;
+ result = self->_tokenService.refreshToken;
});
return result;
}
@@ -842,7 +843,7 @@ static void callInMainThreadWithAuthDataResultAndError(
- (void)linkAndRetrieveDataWithCredential:(FIRAuthCredential *)credential
completion:(nullable FIRAuthDataResultCallback)completion {
dispatch_async(FIRAuthGlobalWorkQueue(), ^{
- if (_providerData[credential.provider]) {
+ if (self->_providerData[credential.provider]) {
callInMainThreadWithAuthDataResultAndError(completion,
nil,
[FIRAuthErrorUtils providerAlreadyLinkedError]);
@@ -851,7 +852,7 @@ static void callInMainThreadWithAuthDataResultAndError(
FIRAuthDataResult *result =
[[FIRAuthDataResult alloc] initWithUser:self additionalUserInfo:nil];
if ([credential isKindOfClass:[FIREmailPasswordAuthCredential class]]) {
- if (_hasEmailPasswordCredential) {
+ if (self->_hasEmailPasswordCredential) {
callInMainThreadWithAuthDataResultAndError(completion,
nil,
[FIRAuthErrorUtils providerAlreadyLinkedError]);
@@ -887,7 +888,7 @@ static void callInMainThreadWithAuthDataResultAndError(
}
#endif
- [_taskQueue enqueueTask:^(FIRAuthSerialTaskCompletionBlock _Nonnull complete) {
+ [self->_taskQueue enqueueTask:^(FIRAuthSerialTaskCompletionBlock _Nonnull complete) {
CallbackWithAuthDataResultAndError completeWithError =
^(FIRAuthDataResult *result, NSError *error) {
complete();
@@ -899,7 +900,7 @@ static void callInMainThreadWithAuthDataResultAndError(
completeWithError(nil, error);
return;
}
- FIRAuthRequestConfiguration *requestConfiguration = _auth.requestConfiguration;
+ FIRAuthRequestConfiguration *requestConfiguration = self->_auth.requestConfiguration;
FIRVerifyAssertionRequest *request =
[[FIRVerifyAssertionRequest alloc] initWithProviderID:credential.provider
requestConfiguration:requestConfiguration];
@@ -917,7 +918,7 @@ static void callInMainThreadWithAuthDataResultAndError(
FIRAuthDataResult *result =
[[FIRAuthDataResult alloc] initWithUser:self additionalUserInfo:additionalUserInfo];
// Update the new token and refresh user info again.
- _tokenService = [[FIRSecureTokenService alloc]
+ self->_tokenService = [[FIRSecureTokenService alloc]
initWithRequestConfiguration:requestConfiguration
accessToken:response.IDToken
accessTokenExpirationDate:response.approximateExpirationDate
@@ -939,7 +940,7 @@ static void callInMainThreadWithAuthDataResultAndError(
completeWithError(nil, error);
return;
}
- _anonymous = NO;
+ self->_anonymous = NO;
[self updateWithGetAccountInfoResponse:response];
if (![self updateKeychain:&error]) {
completeWithError(nil, error);
@@ -967,19 +968,19 @@ static void callInMainThreadWithAuthDataResultAndError(
completeAndCallbackWithError(error);
return;
}
- FIRAuthRequestConfiguration *requestConfiguration = _auth.requestConfiguration;
+ FIRAuthRequestConfiguration *requestConfiguration = self->_auth.requestConfiguration;
FIRSetAccountInfoRequest *setAccountInfoRequest =
[[FIRSetAccountInfoRequest alloc] initWithRequestConfiguration:requestConfiguration];
setAccountInfoRequest.accessToken = accessToken;
BOOL isEmailPasswordProvider = [provider isEqualToString:FIREmailAuthProviderID];
if (isEmailPasswordProvider) {
- if (!_hasEmailPasswordCredential) {
+ if (!self->_hasEmailPasswordCredential) {
completeAndCallbackWithError([FIRAuthErrorUtils noSuchProviderError]);
return;
}
setAccountInfoRequest.deleteAttributes = @[ FIRSetAccountInfoUserAttributePassword ];
} else {
- if (!_providerData[provider]) {
+ if (!self->_providerData[provider]) {
completeAndCallbackWithError([FIRAuthErrorUtils noSuchProviderError]);
return;
}
@@ -994,19 +995,19 @@ static void callInMainThreadWithAuthDataResultAndError(
return;
}
if (isEmailPasswordProvider) {
- _hasEmailPasswordCredential = NO;
+ self->_hasEmailPasswordCredential = NO;
} else {
// We can't just use the provider info objects in FIRSetAcccountInfoResponse because they
// don't have localID and email fields. Remove the specific provider manually.
- NSMutableDictionary *mutableProviderData = [_providerData mutableCopy];
+ NSMutableDictionary *mutableProviderData = [self->_providerData mutableCopy];
[mutableProviderData removeObjectForKey:provider];
- _providerData = [mutableProviderData copy];
+ self->_providerData = [mutableProviderData copy];
#if TARGET_OS_IOS
// After successfully unlinking a phone auth provider, remove the phone number from the
// cached user info.
if ([provider isEqualToString:FIRPhoneAuthProviderID]) {
- _phoneNumber = nil;
+ self->_phoneNumber = nil;
}
#endif
}
@@ -1060,7 +1061,7 @@ static void callInMainThreadWithAuthDataResultAndError(
callInMainThreadWithError(completion, error);
return;
}
- FIRAuthRequestConfiguration *configuration = _auth.requestConfiguration;
+ FIRAuthRequestConfiguration *configuration = self->_auth.requestConfiguration;
FIRGetOOBConfirmationCodeRequest *request =
[FIRGetOOBConfirmationCodeRequest verifyEmailRequestWithAccessToken:accessToken
actionCodeSettings:actionCodeSettings
@@ -1085,15 +1086,15 @@ static void callInMainThreadWithAuthDataResultAndError(
return;
}
FIRDeleteAccountRequest *deleteUserRequest =
- [[FIRDeleteAccountRequest alloc] initWitLocalID:_userID
+ [[FIRDeleteAccountRequest alloc] initWitLocalID:self->_userID
accessToken:accessToken
- requestConfiguration:_auth.requestConfiguration];
+ requestConfiguration:self->_auth.requestConfiguration];
[FIRAuthBackend deleteAccount:deleteUserRequest callback:^(NSError *_Nullable error) {
if (error) {
callInMainThreadWithError(completion, error);
return;
}
- if (![_auth signOutByForceWithUserID:_userID error:&error]) {
+ if (![self->_auth signOutByForceWithUserID:self->_userID error:&error]) {
callInMainThreadWithError(completion, error);
return;
}
@@ -1167,14 +1168,14 @@ static void callInMainThreadWithAuthDataResultAndError(
- (void)setDisplayName:(nullable NSString *)displayName {
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- if (_consumed) {
+ if (self->_consumed) {
[NSException raise:NSInternalInconsistencyException
format:@"%@",
@"Invalid call to setDisplayName: after commitChangesWithCallback:."];
return;
}
- _displayNameSet = YES;
- _displayName = [displayName copy];
+ self->_displayNameSet = YES;
+ self->_displayName = [displayName copy];
});
}
@@ -1184,14 +1185,14 @@ static void callInMainThreadWithAuthDataResultAndError(
- (void)setPhotoURL:(nullable NSURL *)photoURL {
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- if (_consumed) {
+ if (self->_consumed) {
[NSException raise:NSInternalInconsistencyException
format:@"%@",
@"Invalid call to setPhotoURL: after commitChangesWithCallback:."];
return;
}
- _photoURLSet = YES;
- _photoURL = [photoURL copy];
+ self->_photoURLSet = YES;
+ self->_photoURL = [photoURL copy];
});
}
@@ -1204,24 +1205,24 @@ static void callInMainThreadWithAuthDataResultAndError(
- (void)commitChangesWithCompletion:(nullable FIRUserProfileChangeCallback)completion {
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
- if (_consumed) {
+ if (self->_consumed) {
[NSException raise:NSInternalInconsistencyException
format:@"%@",
@"commitChangesWithCallback: should only be called once."];
return;
}
- _consumed = YES;
+ self->_consumed = YES;
// Return fast if there is nothing to update:
if (![self hasUpdates]) {
callInMainThreadWithError(completion, nil);
return;
}
- NSString *displayName = [_displayName copy];
- BOOL displayNameWasSet = _displayNameSet;
- NSURL *photoURL = [_photoURL copy];
- BOOL photoURLWasSet = _photoURLSet;
- [_user executeUserUpdateWithChanges:^(FIRGetAccountInfoResponseUser *user,
- FIRSetAccountInfoRequest *request) {
+ NSString *displayName = [self->_displayName copy];
+ BOOL displayNameWasSet = self->_displayNameSet;
+ NSURL *photoURL = [self->_photoURL copy];
+ BOOL photoURLWasSet = self->_photoURLSet;
+ [self->_user executeUserUpdateWithChanges:^(FIRGetAccountInfoResponseUser *user,
+ FIRSetAccountInfoRequest *request) {
if (photoURLWasSet) {
request.photoURL = photoURL;
}
@@ -1235,12 +1236,12 @@ static void callInMainThreadWithAuthDataResultAndError(
return;
}
if (displayNameWasSet) {
- [_user setDisplayName:displayName];
+ [self->_user setDisplayName:displayName];
}
if (photoURLWasSet) {
- [_user setPhotoURL:photoURL];
+ [self->_user setPhotoURL:photoURL];
}
- if (![_user updateKeychain:&error]) {
+ if (![self->_user updateKeychain:&error]) {
callInMainThreadWithError(completion, error);
return;
}