Procházet zdrojové kódy

Revert "Revert "Temporarily revert breaking API changes for 6.2.3 patch release (#200)" (#201)"

This reverts commit 8345fcc43c38cefb67f1ad0d5dcd51a1d036e460.
Peter Andrews před 3 roky
rodič
revize
9c9b36af86

+ 7 - 7
GoogleSignIn/Sources/GIDAuthentication.m

@@ -228,17 +228,17 @@ static NSString *const kNewIOSSystemName = @"iOS";
   return authorization;
 }
 
-- (void)doWithFreshTokens:(GIDAuthenticationCompletion)completion {
+- (void)doWithFreshTokens:(GIDAuthenticationAction)action {
   if (!([self.accessTokenExpirationDate timeIntervalSinceNow] < kMinimalTimeToExpire ||
       (self.idToken && [self.idTokenExpirationDate timeIntervalSinceNow] < kMinimalTimeToExpire))) {
     dispatch_async(dispatch_get_main_queue(), ^{
-      completion(self, nil);
+      action(self, nil);
     });
     return;
   }
   @synchronized (_authenticationHandlerQueue) {
     // Push the handler into the callback queue.
-    [_authenticationHandlerQueue addObject:[completion copy]];
+    [_authenticationHandlerQueue addObject:[action copy]];
     if (_authenticationHandlerQueue.count > 1) {
       // This is not the first handler in the queue, no fetch is needed.
       return;
@@ -286,9 +286,9 @@ static NSString *const kNewIOSSystemName = @"iOS";
         authenticationHandlerQueue = [self->_authenticationHandlerQueue copy];
         [self->_authenticationHandlerQueue removeAllObjects];
       }
-      for (GIDAuthenticationCompletion completion in authenticationHandlerQueue) {
+      for (GIDAuthenticationAction action in authenticationHandlerQueue) {
         dispatch_async(dispatch_get_main_queue(), ^{
-          completion(error ? nil : self, error);
+          action(error ? nil : self, error);
         });
       }
     }];
@@ -298,9 +298,9 @@ static NSString *const kNewIOSSystemName = @"iOS";
       authenticationHandlerQueue = [self->_authenticationHandlerQueue copy];
       [self->_authenticationHandlerQueue removeAllObjects];
     }
-    for (GIDAuthenticationCompletion completion in authenticationHandlerQueue) {
+    for (GIDAuthenticationAction action in authenticationHandlerQueue) {
       dispatch_async(dispatch_get_main_queue(), ^{
-        completion(error ? nil : self, error);
+        action(error ? nil : self, error);
       });
     }
 #endif // TARGET_OS_IOS && !TARGET_OS_MACCATALYST

+ 41 - 41
GoogleSignIn/Sources/GIDSignIn.m

@@ -187,8 +187,8 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
   return [authState isAuthorized];
 }
 
-- (void)restorePreviousSignInWithCompletion:(nullable GIDSignInCompletion)completion {
-  [self signInWithOptions:[GIDSignInInternalOptions silentOptionsWithCompletion:completion]];
+- (void)restorePreviousSignInWithCallback:(nullable GIDSignInCallback)callback {
+  [self signInWithOptions:[GIDSignInInternalOptions silentOptionsWithCallback:callback]];
 }
 
 - (BOOL)restorePreviousSignInNoRefresh {
@@ -217,13 +217,13 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
 - (void)signInWithConfiguration:(GIDConfiguration *)configuration
        presentingViewController:(UIViewController *)presentingViewController
                            hint:(nullable NSString *)hint
-                     completion:(nullable GIDSignInCompletion)completion {
+                       callback:(nullable GIDSignInCallback)callback {
   GIDSignInInternalOptions *options =
       [GIDSignInInternalOptions defaultOptionsWithConfiguration:configuration
                                        presentingViewController:presentingViewController
                                                       loginHint:hint
-                                                  addScopesFlow:NO
-                                                     completion:completion];
+                                                   addScopesFlow:NO
+                                                       callback:callback];
   [self signInWithOptions:options];
 }
 
@@ -231,38 +231,38 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
        presentingViewController:(UIViewController *)presentingViewController
                            hint:(nullable NSString *)hint
                additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
-                     completion:(nullable GIDSignInCompletion)completion {
+                       callback:(nullable GIDSignInCallback)callback {
   GIDSignInInternalOptions *options =
     [GIDSignInInternalOptions defaultOptionsWithConfiguration:configuration
                                      presentingViewController:presentingViewController
                                                     loginHint:hint
                                                 addScopesFlow:NO
                                                        scopes:additionalScopes
-                                                   completion:completion];
+                                                     callback:callback];
   [self signInWithOptions:options];
 }
 
 - (void)signInWithConfiguration:(GIDConfiguration *)configuration
        presentingViewController:(UIViewController *)presentingViewController
-                     completion:(nullable GIDSignInCompletion)completion {
+                       callback:(nullable GIDSignInCallback)callback {
   [self signInWithConfiguration:configuration
        presentingViewController:presentingViewController
                            hint:nil
-                     completion:completion];
+                       callback:callback];
 }
 
 - (void)addScopes:(NSArray<NSString *> *)scopes
     presentingViewController:(UIViewController *)presentingViewController
-                  completion:(nullable GIDSignInCompletion)completion {
+                    callback:(nullable GIDSignInCallback)callback {
   // A currentUser must be available in order to complete this flow.
   if (!self.currentUser) {
     // No currentUser is set, notify callback of failure.
     NSError *error = [NSError errorWithDomain:kGIDSignInErrorDomain
                                          code:kGIDSignInErrorCodeNoCurrentUser
                                      userInfo:nil];
-    if (completion) {
+    if (callback) {
       dispatch_async(dispatch_get_main_queue(), ^{
-        completion(nil, error);
+        callback(nil, error);
       });
     }
     return;
@@ -278,7 +278,7 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
                                        presentingViewController:presentingViewController
                                                       loginHint:self.currentUser.profile.email
                                                   addScopesFlow:YES
-                                                     completion:completion];
+                                                       callback:callback];
 
   NSSet<NSString *> *requestedScopes = [NSSet setWithArray:scopes];
   NSMutableSet<NSString *> *grantedScopes =
@@ -290,9 +290,9 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
     NSError *error = [NSError errorWithDomain:kGIDSignInErrorDomain
                                          code:kGIDSignInErrorCodeScopesAlreadyGranted
                                      userInfo:nil];
-    if (completion) {
+    if (callback) {
       dispatch_async(dispatch_get_main_queue(), ^{
-        completion(nil, error);
+        callback(nil, error);
       });
     }
     return;
@@ -310,52 +310,52 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
 - (void)signInWithConfiguration:(GIDConfiguration *)configuration
                presentingWindow:(NSWindow *)presentingWindow
                            hint:(nullable NSString *)hint
-                     completion:(nullable GIDSignInCompletion)completion {
+                       callback:(nullable GIDSignInCallback)callback {
   GIDSignInInternalOptions *options =
       [GIDSignInInternalOptions defaultOptionsWithConfiguration:configuration
                                                presentingWindow:presentingWindow
                                                       loginHint:hint
-                                                  addScopesFlow:NO
-                                                     completion:completion];
+                                                   addScopesFlow:NO
+                                                       callback:callback];
   [self signInWithOptions:options];
 }
 
 - (void)signInWithConfiguration:(GIDConfiguration *)configuration
                presentingWindow:(NSWindow *)presentingWindow
-                     completion:(nullable GIDSignInCompletion)completion {
+                       callback:(nullable GIDSignInCallback)callback {
   [self signInWithConfiguration:configuration
                presentingWindow:presentingWindow
                            hint:nil
-                     completion:completion];
+                       callback:callback];
 }
 
 - (void)signInWithConfiguration:(GIDConfiguration *)configuration
                presentingWindow:(NSWindow *)presentingWindow
                            hint:(nullable NSString *)hint
                additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
-                     completion:(nullable GIDSignInCompletion)completion {
+                       callback:(nullable GIDSignInCallback)callback {
   GIDSignInInternalOptions *options =
     [GIDSignInInternalOptions defaultOptionsWithConfiguration:configuration
                                              presentingWindow:presentingWindow
                                                     loginHint:hint
                                                 addScopesFlow:NO
                                                        scopes:additionalScopes
-                                                   completion:completion];
+                                                     callback:callback];
   [self signInWithOptions:options];
 }
 
 - (void)addScopes:(NSArray<NSString *> *)scopes
- presentingWindow:(NSWindow *)presentingWindow
-       completion:(nullable GIDSignInCompletion)completion {
+            presentingWindow:(NSWindow *)presentingWindow
+                    callback:(nullable GIDSignInCallback)callback {
   // A currentUser must be available in order to complete this flow.
   if (!self.currentUser) {
     // No currentUser is set, notify callback of failure.
     NSError *error = [NSError errorWithDomain:kGIDSignInErrorDomain
                                          code:kGIDSignInErrorCodeNoCurrentUser
                                      userInfo:nil];
-    if (completion) {
+    if (callback) {
       dispatch_async(dispatch_get_main_queue(), ^{
-        completion(nil, error);
+        callback(nil, error);
       });
     }
     return;
@@ -371,7 +371,7 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
                                                presentingWindow:presentingWindow
                                                       loginHint:self.currentUser.profile.email
                                                   addScopesFlow:YES
-                                                     completion:completion];
+                                                       callback:callback];
 
   NSSet<NSString *> *requestedScopes = [NSSet setWithArray:scopes];
   NSMutableSet<NSString *> *grantedScopes =
@@ -383,9 +383,9 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
     NSError *error = [NSError errorWithDomain:kGIDSignInErrorDomain
                                          code:kGIDSignInErrorCodeScopesAlreadyGranted
                                      userInfo:nil];
-    if (completion) {
+    if (callback) {
       dispatch_async(dispatch_get_main_queue(), ^{
-        completion(nil, error);
+        callback(nil, error);
       });
     }
     return;
@@ -411,7 +411,7 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
   [self removeAllKeychainEntries];
 }
 
-- (void)disconnectWithCompletion:(nullable GIDDisconnectCompletion)completion {
+- (void)disconnectWithCallback:(nullable GIDDisconnectCallback)callback {
   GIDGoogleUser *user = _currentUser;
   OIDAuthState *authState = user.authentication.authState;
   if (!authState) {
@@ -428,9 +428,9 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
   if (!token) {
     [self signOut];
     // Nothing to do here, consider the operation successful.
-    if (completion) {
+    if (callback) {
       dispatch_async(dispatch_get_main_queue(), ^{
-        completion(nil);
+        callback(nil);
       });
     }
     return;
@@ -453,9 +453,9 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
     if (!error) {
       [self signOut];
     }
-    if (completion) {
+    if (callback) {
       dispatch_async(dispatch_get_main_queue(), ^{
-        completion(error);
+        callback(error);
       });
     }
   }];
@@ -538,10 +538,10 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
       if (error) {
         [self authenticateWithOptions:options];
       } else {
-        if (options.completion) {
+        if (options.callback) {
           self->_currentOptions = nil;
           dispatch_async(dispatch_get_main_queue(), ^{
-            options.completion(self->_currentUser, nil);
+            options.callback(self->_currentUser, nil);
           });
         }
       }
@@ -707,10 +707,10 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
     NSError *error = [NSError errorWithDomain:kGIDSignInErrorDomain
                                          code:kGIDSignInErrorCodeHasNoAuthInKeychain
                                      userInfo:nil];
-    if (options.completion) {
+    if (options.callback) {
       _currentOptions = nil;
       dispatch_async(dispatch_get_main_queue(), ^{
-        options.completion(nil, error);
+        options.callback(nil, error);
       });
     }
     return;
@@ -881,11 +881,11 @@ static const NSTimeInterval kMinimumRestoredAccessTokenTimeToExpire = 600.0;
   __weak GIDAuthFlow *weakAuthFlow = authFlow;
   [authFlow addCallback:^() {
     GIDAuthFlow *handlerAuthFlow = weakAuthFlow;
-    if (self->_currentOptions.completion) {
-      GIDSignInCompletion completion = self->_currentOptions.completion;
+    if (self->_currentOptions.callback) {
+      GIDSignInCallback callback = self->_currentOptions.callback;
       self->_currentOptions = nil;
       dispatch_async(dispatch_get_main_queue(), ^{
-        completion(self->_currentUser, handlerAuthFlow.error);
+        callback(self->_currentUser, handlerAuthFlow.error);
       });
     }
   }];

+ 7 - 7
GoogleSignIn/Sources/GIDSignInInternalOptions.h

@@ -54,8 +54,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property(nonatomic, readonly, weak, nullable) NSWindow *presentingWindow;
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
 
-/// The completion block to be called at the completion of the flow.
-@property(nonatomic, readonly, nullable) GIDSignInCompletion completion;
+/// The callback block to be called at the completion of the flow.
+@property(nonatomic, readonly, nullable) GIDSignInCallback callback;
 
 /// The scopes to be used during the flow.
 @property(nonatomic, copy, nullable) NSArray<NSString *> *scopes;
@@ -69,32 +69,32 @@ NS_ASSUME_NONNULL_BEGIN
                        presentingViewController:(nullable UIViewController *)presentingViewController
                                       loginHint:(nullable NSString *)loginHint
                                   addScopesFlow:(BOOL)addScopesFlow
-                                     completion:(nullable GIDSignInCompletion)completion;
+                                       callback:(nullable GIDSignInCallback)callback;
 
 + (instancetype)defaultOptionsWithConfiguration:(nullable GIDConfiguration *)configuration
                        presentingViewController:(nullable UIViewController *)presentingViewController
                                       loginHint:(nullable NSString *)loginHint
                                   addScopesFlow:(BOOL)addScopesFlow
                                          scopes:(nullable NSArray *)scopes
-                                     completion:(nullable GIDSignInCompletion)completion;
+                                       callback:(nullable GIDSignInCallback)callback;
 
 #elif TARGET_OS_OSX
 + (instancetype)defaultOptionsWithConfiguration:(nullable GIDConfiguration *)configuration
                                presentingWindow:(nullable NSWindow *)presentingWindow
                                       loginHint:(nullable NSString *)loginHint
                                   addScopesFlow:(BOOL)addScopesFlow
-                                     completion:(nullable GIDSignInCompletion)completion;
+                                       callback:(nullable GIDSignInCallback)callback;
 
 + (instancetype)defaultOptionsWithConfiguration:(nullable GIDConfiguration *)configuration
                                presentingWindow:(nullable NSWindow *)presentingWindow
                                       loginHint:(nullable NSString *)loginHint
                                   addScopesFlow:(BOOL)addScopesFlow
                                          scopes:(nullable NSArray *)scopes
-                                     completion:(nullable GIDSignInCompletion)completion;
+                                       callback:(nullable GIDSignInCallback)callback;
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
 
 /// Creates the options to sign in silently.
-+ (instancetype)silentOptionsWithCompletion:(GIDSignInCompletion)completion;
++ (instancetype)silentOptionsWithCallback:(GIDSignInCallback)callback;
 
 /// Creates options with the same values as the receiver, except for the "extra parameters", and
 /// continuation flag, which are replaced by the arguments passed to this method.

+ 10 - 10
GoogleSignIn/Sources/GIDSignInInternalOptions.m

@@ -31,14 +31,14 @@ NS_ASSUME_NONNULL_BEGIN
                                       loginHint:(nullable NSString *)loginHint
                                   addScopesFlow:(BOOL)addScopesFlow
                                          scopes:(nullable NSArray *)scopes
-                                     completion:(nullable GIDSignInCompletion)completion {
+                                       callback:(nullable GIDSignInCallback)callback {
 #elif TARGET_OS_OSX
 + (instancetype)defaultOptionsWithConfiguration:(nullable GIDConfiguration *)configuration
                                presentingWindow:(nullable NSWindow *)presentingWindow
                                       loginHint:(nullable NSString *)loginHint
                                   addScopesFlow:(BOOL)addScopesFlow
                                          scopes:(nullable NSArray *)scopes
-                                     completion:(nullable GIDSignInCompletion)completion {
+                                       callback:(nullable GIDSignInCallback)callback {
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
   
   GIDSignInInternalOptions *options = [[GIDSignInInternalOptions alloc] init];
@@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
     options->_presentingWindow = presentingWindow;
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
     options->_loginHint = loginHint;
-    options->_completion = completion;
+    options->_callback = callback;
     options->_scopes = [GIDScopes scopesWithBasicProfile:scopes];
   }
   return options;
@@ -64,13 +64,13 @@ NS_ASSUME_NONNULL_BEGIN
                        presentingViewController:(nullable UIViewController *)presentingViewController
                                       loginHint:(nullable NSString *)loginHint
                                   addScopesFlow:(BOOL)addScopesFlow
-                                     completion:(nullable GIDSignInCompletion)completion {
+                                       callback:(nullable GIDSignInCallback)callback {
 #elif TARGET_OS_OSX
 + (instancetype)defaultOptionsWithConfiguration:(nullable GIDConfiguration *)configuration
                                presentingWindow:(nullable NSWindow *)presentingWindow
                                       loginHint:(nullable NSString *)loginHint
                                   addScopesFlow:(BOOL)addScopesFlow
-                                     completion:(nullable GIDSignInCompletion)completion {
+                                       callback:(nullable GIDSignInCallback)callback {
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
     GIDSignInInternalOptions *options = [self defaultOptionsWithConfiguration:configuration
 #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
@@ -81,11 +81,11 @@ NS_ASSUME_NONNULL_BEGIN
                                                                     loginHint:loginHint
                                                                 addScopesFlow:addScopesFlow
                                                                        scopes:@[]
-                                                                   completion:completion];
+                                                                     callback:callback];
   return options;
 }
 
-+ (instancetype)silentOptionsWithCompletion:(GIDSignInCompletion)completion {
++ (instancetype)silentOptionsWithCallback:(GIDSignInCallback)callback {
   GIDSignInInternalOptions *options = [self defaultOptionsWithConfiguration:nil
 #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
                                                    presentingViewController:nil
@@ -93,8 +93,8 @@ NS_ASSUME_NONNULL_BEGIN
                                                            presentingWindow:nil
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
                                                                   loginHint:nil
-                                                              addScopesFlow:NO
-                                                                 completion:completion];
+                                                               addScopesFlow:NO
+                                                                   callback:callback];
   if (options) {
     options->_interactive = NO;
   }
@@ -115,7 +115,7 @@ NS_ASSUME_NONNULL_BEGIN
     options->_presentingWindow = _presentingWindow;
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
     options->_loginHint = _loginHint;
-    options->_completion = _completion;
+    options->_callback = _callback;
     options->_scopes = _scopes;
     options->_extraParams = [extraParams copy];
   }

+ 6 - 7
GoogleSignIn/Sources/Public/GoogleSignIn/GIDAuthentication.h

@@ -28,10 +28,10 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-/// A completion block that takes a `GIDAuthentication` or an error if the attempt to refresh tokens
+/// A callback block that takes a `GIDAuthentication` or an error if the attempt to refresh tokens
 /// was unsuccessful.
-typedef void (^GIDAuthenticationCompletion)(GIDAuthentication *_Nullable authentication,
-                                            NSError *_Nullable error);
+typedef void (^GIDAuthenticationAction)(GIDAuthentication *_Nullable authentication,
+                                        NSError *_Nullable error);
 
 /// This class represents the OAuth 2.0 entities needed for sign-in.
 @interface GIDAuthentication : NSObject <NSSecureCoding>
@@ -67,10 +67,9 @@ typedef void (^GIDAuthenticationCompletion)(GIDAuthentication *_Nullable authent
 /// Get a valid access token and a valid ID token, refreshing them first if they have expired or are
 /// about to expire.
 ///
-/// @param completion A completion block that takes a `GIDAuthentication` or an error if the attempt
-///     to refresh tokens was unsuccessful.  The block will be called asynchronously on the main
-///     queue.
-- (void)doWithFreshTokens:(GIDAuthenticationCompletion)completion;
+/// @param action A callback block that takes a `GIDAuthentication` or an error if the attempt to
+///     refresh tokens was unsuccessful.  The block will be called asynchronously on the main queue.
+- (void)doWithFreshTokens:(GIDAuthenticationAction)action;
 
 @end
 

+ 50 - 50
GoogleSignIn/Sources/Public/GoogleSignIn/GIDSignIn.h

@@ -50,12 +50,12 @@ typedef NS_ERROR_ENUM(kGIDSignInErrorDomain, GIDSignInErrorCode) {
   kGIDSignInErrorCodeScopesAlreadyGranted = -8,
 };
 
-/// Represents a completion block that takes a `GIDGoogleUser` on success or an error if the operation
+/// Represents a callback block that takes a `GIDGoogleUser` on success or an error if the operation
 /// was unsuccessful.
-typedef void (^GIDSignInCompletion)(GIDGoogleUser *_Nullable user, NSError *_Nullable error);
+typedef void (^GIDSignInCallback)(GIDGoogleUser *_Nullable user, NSError *_Nullable error);
 
-/// Represents a completion block that takes an error if the operation was unsuccessful.
-typedef void (^GIDDisconnectCompletion)(NSError *_Nullable error);
+/// Represents a callback block that takes an error if the operation was unsuccessful.
+typedef void (^GIDDisconnectCallback)(NSError *_Nullable error);
 
 /// This class signs the user in with Google.
 ///
@@ -91,9 +91,9 @@ typedef void (^GIDDisconnectCompletion)(NSError *_Nullable error);
 
 /// Attempts to restore a previously authenticated user without interaction.
 ///
-/// @param completion The `GIDSignInCompletion` block that is called on completion.  This block will
-///     be called asynchronously on the main queue.
-- (void)restorePreviousSignInWithCompletion:(nullable GIDSignInCompletion)completion;
+/// @param callback The `GIDSignInCallback` block that is called on completion.  This block will be
+///     called asynchronously on the main queue.
+- (void)restorePreviousSignInWithCallback:(nullable GIDSignInCallback)callback;
 
 /// Marks current user as being in the signed out state.
 - (void)signOut;
@@ -101,35 +101,35 @@ typedef void (^GIDDisconnectCompletion)(NSError *_Nullable error);
 /// Disconnects the current user from the app and revokes previous authentication. If the operation
 /// succeeds, the OAuth 2.0 token is also removed from keychain.
 ///
-/// @param completion The optional `GIDDisconnectCompletion` block that is called on completion.
-///     This block will be called asynchronously on the main queue.
-- (void)disconnectWithCompletion:(nullable GIDDisconnectCompletion)completion;
+/// @param callback The optional `GIDDisconnectCallback` block that is called on completion.  This
+///     block will be called asynchronously on the main queue.
+- (void)disconnectWithCallback:(nullable GIDDisconnectCallback)callback;
 
 #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
 /// Starts an interactive sign-in flow on iOS using the provided configuration.
 ///
-/// The completion will be called at the end of this process.  Any saved sign-in state will be
+/// The callback will be called at the end of this process.  Any saved sign-in state will be
 /// replaced by the result of this flow.  Note that this method should not be called when the app is
 /// starting up, (e.g in `application:didFinishLaunchingWithOptions:`); instead use the
-/// `restorePreviousSignInWithCompletion:` method to restore a previous sign-in.
+/// `restorePreviousSignInWithCallback:` method to restore a previous sign-in.
 ///
 /// @param configuration The configuration properties to be used for this flow.
 /// @param presentingViewController The view controller used to present `SFSafariViewContoller` on
 ///     iOS 9 and 10 and to supply `presentationContextProvider` for `ASWebAuthenticationSession` on
 ///     iOS 13+.
-/// @param completion The `GIDSignInCompletion` block that is called on completion.  This block will
-///     be called asynchronously on the main queue.
+/// @param callback The `GIDSignInCallback` block that is called on completion.  This block will be
+///     called asynchronously on the main queue.
 - (void)signInWithConfiguration:(GIDConfiguration *)configuration
        presentingViewController:(UIViewController *)presentingViewController
-                     completion:(nullable GIDSignInCompletion)completion
+                       callback:(nullable GIDSignInCallback)callback
     NS_EXTENSION_UNAVAILABLE("The sign-in flow is not supported in App Extensions.");
 
-/// Starts an interactive sign-in flow on iOS using the provided configuration and a login hint.
+/// Starts an interactive sign-in flow  on iOS using the provided configuration and a login hint.
 ///
-/// The completion will be called at the end of this process.  Any saved sign-in state will be
+/// The callback will be called at the end of this process.  Any saved sign-in state will be
 /// replaced by the result of this flow.  Note that this method should not be called when the app is
 /// starting up, (e.g in `application:didFinishLaunchingWithOptions:`); instead use the
-/// `restorePreviousSignInWithCompletion:` method to restore a previous sign-in.
+/// `restorePreviousSignInWithCallback:` method to restore a previous sign-in.
 ///
 /// @param configuration The configuration properties to be used for this flow.
 /// @param presentingViewController The view controller used to present `SFSafariViewContoller` on
@@ -137,20 +137,20 @@ typedef void (^GIDDisconnectCompletion)(NSError *_Nullable error);
 ///     iOS 13+.
 /// @param hint An optional hint for the authorization server, for example the user's ID or email
 ///     address, to be prefilled if possible.
-/// @param completion The `GIDSignInCompletion` block that is called on completion.  This block will
-///     be called asynchronously on the main queue.
+/// @param callback The `GIDSignInCallback` block that is called on completion.  This block will be
+///     called asynchronously on the main queue.
 - (void)signInWithConfiguration:(GIDConfiguration *)configuration
        presentingViewController:(UIViewController *)presentingViewController
                            hint:(nullable NSString *)hint
-                     completion:(nullable GIDSignInCompletion)completion
+                       callback:(nullable GIDSignInCallback)callback
     NS_EXTENSION_UNAVAILABLE("The sign-in flow is not supported in App Extensions.");
 
 /// Starts an interactive sign-in flow on iOS using the provided configuration and a login hint.
 ///
-/// The completion will be called at the end of this process.  Any saved sign-in state will be
+/// The callback will be called at the end of this process.  Any saved sign-in state will be
 /// replaced by the result of this flow.  Note that this method should not be called when the app is
 /// starting up, (e.g in `application:didFinishLaunchingWithOptions:`); instead use the
-/// `restorePreviousSignInWithCompletion:` method to restore a previous sign-in.
+/// `restorePreviousSignInWithCallback:` method to restore a previous sign-in.
 ///
 /// @param configuration The configuration properties to be used for this flow.
 /// @param presentingViewController The view controller used to present `SFSafariViewContoller` on
@@ -158,98 +158,98 @@ typedef void (^GIDDisconnectCompletion)(NSError *_Nullable error);
 /// @param hint An optional hint for the authorization server, for example the user's ID or email
 ///     address, to be prefilled if possible.
 /// @param additionalScopes An optional array of scopes to request in addition to the basic profile scopes.
-/// @param completion The `GIDSignInCompletion` block that is called on completion.  This block will
-///     be called asynchronously on the main queue.
+/// @param callback The `GIDSignInCallback` block that is called on completion.  This block will be
+///     called asynchronously on the main queue.
 
 - (void)signInWithConfiguration:(GIDConfiguration *)configuration
        presentingViewController:(UIViewController *)presentingViewController
                            hint:(nullable NSString *)hint
                additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
-                     completion:(nullable GIDSignInCompletion)completion;
+                       callback:(nullable GIDSignInCallback)callback;
 
 /// Starts an interactive consent flow on iOS to add scopes to the current user's grants.
 ///
-/// The completion will be called at the end of this process.  If successful, a new `GIDGoogleUser`
+/// The callback will be called at the end of this process.  If successful, a new `GIDGoogleUser`
 /// instance will be returned reflecting the new scopes and saved sign-in state will be updated.
 ///
 /// @param scopes The scopes to ask the user to consent to.
 /// @param presentingViewController The view controller used to present `SFSafariViewContoller` on
 ///     iOS 9 and 10 and to supply `presentationContextProvider` for `ASWebAuthenticationSession` on
 ///     iOS 13+.
-/// @param completion The `GIDSignInCompletion` block that is called on completion.  This block will
-///     be called asynchronously on the main queue.
+/// @param callback The `GIDSignInCallback` block that is called on completion.  This block will be
+///     called asynchronously on the main queue.
 - (void)addScopes:(NSArray<NSString *> *)scopes
     presentingViewController:(UIViewController *)presentingViewController
-                  completion:(nullable GIDSignInCompletion)completion
+                    callback:(nullable GIDSignInCallback)callback
     NS_EXTENSION_UNAVAILABLE("The add scopes flow is not supported in App Extensions."); 
 
 #elif TARGET_OS_OSX
 /// Starts an interactive sign-in flow on macOS using the provided configuration.
 ///
-/// The completion will be called at the end of this process.  Any saved sign-in state will be
+/// The callback will be called at the end of this process.  Any saved sign-in state will be
 /// replaced by the result of this flow.  Note that this method should not be called when the app is
 /// starting up, (e.g in `application:didFinishLaunchingWithOptions:`); instead use the
-/// `restorePreviousSignInWithCompletion:` method to restore a previous sign-in.
+/// `restorePreviousSignInWithCallback:` method to restore a previous sign-in.
 ///
 /// @param configuration The configuration properties to be used for this flow.
 /// @param presentingWindow The window used to supply `presentationContextProvider` for `ASWebAuthenticationSession`.
-/// @param completion The `GIDSignInCompletion` block that is called on completion.  This block will
-///     be called asynchronously on the main queue.
+/// @param callback The `GIDSignInCallback` block that is called on completion.  This block will be
+///     called asynchronously on the main queue.
 - (void)signInWithConfiguration:(GIDConfiguration *)configuration
                presentingWindow:(NSWindow *)presentingWindow
-                     completion:(nullable GIDSignInCompletion)completion;
+                       callback:(nullable GIDSignInCallback)callback;
 
 /// Starts an interactive sign-in flow on macOS using the provided configuration and a login hint.
 ///
-/// The completion will be called at the end of this process.  Any saved sign-in state will be
+/// The callback will be called at the end of this process.  Any saved sign-in state will be
 /// replaced by the result of this flow.  Note that this method should not be called when the app is
 /// starting up, (e.g in `application:didFinishLaunchingWithOptions:`); instead use the
-/// `restorePreviousSignInWithCompletion:` method to restore a previous sign-in.
+/// `restorePreviousSignInWithCallback:` method to restore a previous sign-in.
 ///
 /// @param configuration The configuration properties to be used for this flow.
 /// @param presentingWindow The window used to supply `presentationContextProvider` for `ASWebAuthenticationSession`.
 /// @param hint An optional hint for the authorization server, for example the user's ID or email
 ///     address, to be prefilled if possible.
-/// @param completion The `GIDSignInCompletion` block that is called on completion.  This block will
-///     be called asynchronously on the main queue.
+/// @param callback The `GIDSignInCallback` block that is called on completion.  This block will be
+///     called asynchronously on the main queue.
 - (void)signInWithConfiguration:(GIDConfiguration *)configuration
                presentingWindow:(NSWindow *)presentingWindow
                            hint:(nullable NSString *)hint
-                     completion:(nullable GIDSignInCompletion)completion;
+                       callback:(nullable GIDSignInCallback)callback;
 
 /// Starts an interactive sign-in flow on macOS using the provided configuration and a login hint.
 ///
-/// The completion will be called at the end of this process.  Any saved sign-in state will be
+/// The callback will be called at the end of this process.  Any saved sign-in state will be
 /// replaced by the result of this flow.  Note that this method should not be called when the app is
 /// starting up, (e.g in `application:didFinishLaunchingWithOptions:`); instead use the
-/// `restorePreviousSignInWithCompletion:` method to restore a previous sign-in.
+/// `restorePreviousSignInWithCallback:` method to restore a previous sign-in.
 ///
 /// @param configuration The configuration properties to be used for this flow.
 /// @param presentingWindow The window used to supply `presentationContextProvider` for `ASWebAuthenticationSession`.
 /// @param hint An optional hint for the authorization server, for example the user's ID or email
 ///     address, to be prefilled if possible.
 /// @param additionalScopes An optional array of scopes to request in addition to the basic profile scopes.
-/// @param completion The `GIDSignInCompletion` block that is called on completion.  This block will
-///     be called asynchronously on the main queue.
+/// @param callback The `GIDSignInCallback` block that is called on completion.  This block will be
+///     called asynchronously on the main queue.
 
 - (void)signInWithConfiguration:(GIDConfiguration *)configuration
                presentingWindow:(NSWindow *)presentingWindow
                            hint:(nullable NSString *)hint
                additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
-                     completion:(nullable GIDSignInCompletion)completion;
+                       callback:(nullable GIDSignInCallback)callback;
 
 /// Starts an interactive consent flow on macOS to add scopes to the current user's grants.
 ///
-/// The completion will be called at the end of this process.  If successful, a new `GIDGoogleUser`
+/// The callback will be called at the end of this process.  If successful, a new `GIDGoogleUser`
 /// instance will be returned reflecting the new scopes and saved sign-in state will be updated.
 ///
 /// @param scopes An array of scopes to ask the user to consent to.
 /// @param presentingWindow The window used to supply `presentationContextProvider` for `ASWebAuthenticationSession`.
-/// @param completion The `GIDSignInCompletion` block that is called on completion.  This block will
-///     be called asynchronously on the main queue.
+/// @param callback The `GIDSignInCallback` block that is called on completion.  This block will be
+///     called asynchronously on the main queue.
 - (void)addScopes:(NSArray<NSString *> *)scopes
- presentingWindow:(NSWindow *)presentingWindow
-       completion:(nullable GIDSignInCompletion)completion;
+       presentingWindow:(NSWindow *)presentingWindow
+               callback:(nullable GIDSignInCallback)callback;
 
 #endif
 

+ 6 - 7
GoogleSignIn/Tests/Unit/GIDSignInInternalOptionsTest.m

@@ -37,7 +37,7 @@
   id presentingWindow = OCMStrictClassMock([NSWindow class]);
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
   NSString *loginHint = @"login_hint";
-  GIDSignInCompletion completion = ^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) {};
+  GIDSignInCallback callback = ^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) {};
   
   GIDSignInInternalOptions *options =
       [GIDSignInInternalOptions defaultOptionsWithConfiguration:configuration
@@ -47,8 +47,8 @@
                                                presentingWindow:presentingWindow
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
                                                       loginHint:loginHint
-                                                  addScopesFlow:NO
-                                                     completion:completion];
+                                                   addScopesFlow:NO
+                                                       callback:callback];
   XCTAssertTrue(options.interactive);
   XCTAssertFalse(options.continuation);
   XCTAssertFalse(options.addScopesFlow);
@@ -63,13 +63,12 @@
 }
 
 - (void)testSilentOptions {
-  GIDSignInCompletion completion = ^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) {};
-  GIDSignInInternalOptions *options = [GIDSignInInternalOptions
-                                       silentOptionsWithCompletion:completion];
+  GIDSignInCallback callback = ^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) {};
+  GIDSignInInternalOptions *options = [GIDSignInInternalOptions silentOptionsWithCallback:callback];
   XCTAssertFalse(options.interactive);
   XCTAssertFalse(options.continuation);
   XCTAssertNil(options.extraParams);
-  XCTAssertEqual(options.completion, completion);
+  XCTAssertEqual(options.callback, callback);
 }
 
 @end

+ 45 - 45
GoogleSignIn/Tests/Unit/GIDSignInTest.m

@@ -217,7 +217,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   NSError *_authError;
 
   // Whether callback block has been called.
-  BOOL _completionCalled;
+  BOOL _callbackCalled;
 
   // Fake fetcher service to emulate network requests.
   GIDFakeFetcherService *_fetcherService;
@@ -240,8 +240,8 @@ static void *kTestObserverContext = &kTestObserverContext;
   // The login hint to be used when testing |GIDSignIn|.
   NSString *_hint;
 
-  // The completion to be used when testing |GIDSignIn|.
-  GIDSignInCompletion _completion;
+  // The callback to be used when testing |GIDSignIn|.
+  GIDSignInCallback _callback;
 
   // The saved authorization request.
   OIDAuthorizationRequest *_savedAuthorizationRequest;
@@ -283,7 +283,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   _saveAuthorizationReturnValue = YES;
 
   // States
-  _completionCalled = NO;
+  _callbackCalled = NO;
   _keychainSaved = NO;
   _keychainRemoved = NO;
   _changedKeyPaths = [[NSMutableSet alloc] init];
@@ -346,13 +346,13 @@ static void *kTestObserverContext = &kTestObserverContext;
   _hint = nil;
 
   __weak GIDSignInTest *weakSelf = self;
-  _completion = ^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) {
+  _callback = ^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) {
     GIDSignInTest *strongSelf = weakSelf;
     if (!user) {
       XCTAssertNotNil(error, @"should have an error if user is nil");
     }
-    XCTAssertFalse(strongSelf->_completionCalled, @"callback already called");
-    strongSelf->_completionCalled = YES;
+    XCTAssertFalse(strongSelf->_callbackCalled, @"callback already called");
+    strongSelf->_callbackCalled = YES;
     strongSelf->_authError = error;
   };
 
@@ -434,7 +434,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   [_authorization verify];
   [_authState verify];
   XCTAssertFalse(_keychainRemoved, @"should not remove keychain");
-  XCTAssertFalse(_completionCalled, @"should not call delegate");
+  XCTAssertFalse(_callbackCalled, @"should not call delegate");
   XCTAssertNil(_authError, @"should have no error");
 }
 
@@ -445,19 +445,19 @@ static void *kTestObserverContext = &kTestObserverContext;
   [_authorization verify];
   [_authState verify];
   XCTAssertFalse(_keychainRemoved, @"should not remove keychain");
-  XCTAssertFalse(_completionCalled, @"should not call delegate");
+  XCTAssertFalse(_callbackCalled, @"should not call delegate");
 }
 
 - (void)testRestorePreviousSignInWhenSignedOut {
   [[[_authorization expect] andReturn:_authState] authState];
   [[[_authState expect] andReturnValue:[NSNumber numberWithBool:NO]] isAuthorized];
-  _completionCalled = NO;
+  _callbackCalled = NO;
   _authError = nil;
 
   XCTestExpectation *expectation = [self expectationWithDescription:@"Callback should be called."];
 
-  [_signIn restorePreviousSignInWithCompletion:^(GIDGoogleUser * _Nullable user,
-                                                 NSError * _Nullable error) {
+  [_signIn restorePreviousSignInWithCallback:^(GIDGoogleUser * _Nullable user,
+                                               NSError * _Nullable error) {
     [expectation fulfill];
     XCTAssertNotNil(error, @"error should not have been nil");
     XCTAssertEqual(error.domain,
@@ -670,7 +670,7 @@ static void *kTestObserverContext = &kTestObserverContext;
                      oldAccessToken:NO
                         modalCancel:NO];
   [self waitForExpectationsWithTimeout:1 handler:nil];
-  XCTAssertTrue(_completionCalled, @"should call delegate");
+  XCTAssertTrue(_callbackCalled, @"should call delegate");
   XCTAssertEqual(_authError.code, kGIDSignInErrorCodeCanceled);
 }
 
@@ -684,7 +684,7 @@ static void *kTestObserverContext = &kTestObserverContext;
                      oldAccessToken:NO
                         modalCancel:YES];
   [self waitForExpectationsWithTimeout:1 handler:nil];
-  XCTAssertTrue(_completionCalled, @"should call delegate");
+  XCTAssertTrue(_callbackCalled, @"should call delegate");
   XCTAssertEqual(_authError.code, kGIDSignInErrorCodeCanceled);
 }
 
@@ -699,7 +699,7 @@ static void *kTestObserverContext = &kTestObserverContext;
                         modalCancel:NO];
   [self waitForExpectationsWithTimeout:1 handler:nil];
   XCTAssertFalse(_keychainSaved, @"should save to keychain");
-  XCTAssertTrue(_completionCalled, @"should call delegate");
+  XCTAssertTrue(_callbackCalled, @"should call delegate");
   XCTAssertEqualObjects(_authError.domain, kGIDSignInErrorDomain);
   XCTAssertEqual(_authError.code, kGIDSignInErrorCodeKeychain);
 }
@@ -731,13 +731,13 @@ static void *kTestObserverContext = &kTestObserverContext;
   XCTAssertFalse([_signIn handleURL:[NSURL URLWithString:kWrongSchemeURL]],
                  @"should not handle URL");
   XCTAssertFalse(_keychainSaved, @"should not save to keychain");
-  XCTAssertFalse(_completionCalled, @"should not call delegate");
+  XCTAssertFalse(_callbackCalled, @"should not call delegate");
 }
 
 - (void)testNotHandleWrongPath {
   XCTAssertFalse([_signIn handleURL:[NSURL URLWithString:kWrongPathURL]], @"should not handle URL");
   XCTAssertFalse(_keychainSaved, @"should not save to keychain");
-  XCTAssertFalse(_completionCalled, @"should not call delegate");
+  XCTAssertFalse(_callbackCalled, @"should not call delegate");
 }
 
 #pragma mark - Tests - disconnectWithCallback:
@@ -750,7 +750,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   [[[_authorization expect] andReturn:_fetcherService] fetcherService];
   XCTestExpectation *expectation =
       [self expectationWithDescription:@"Callback called with nil error"];
-  [_signIn disconnectWithCompletion:^(NSError * _Nullable error) {
+  [_signIn disconnectWithCallback:^(NSError * _Nullable error) {
     if (error == nil) {
       [expectation fulfill];
     }
@@ -767,7 +767,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   [[[_authState expect] andReturn:_tokenResponse] lastTokenResponse];
   [[[_tokenResponse expect] andReturn:kAccessToken] accessToken];
   [[[_authorization expect] andReturn:_fetcherService] fetcherService];
-  [_signIn disconnectWithCompletion:nil];
+  [_signIn disconnectWithCallback:nil];
   [self verifyAndRevokeToken:kAccessToken hasCallback:NO];
   [_authorization verify];
   [_authState verify];
@@ -784,7 +784,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   [[[_authorization expect] andReturn:_fetcherService] fetcherService];
   XCTestExpectation *expectation =
       [self expectationWithDescription:@"Callback called with nil error"];
-  [_signIn disconnectWithCompletion:^(NSError * _Nullable error) {
+  [_signIn disconnectWithCallback:^(NSError * _Nullable error) {
     if (error == nil) {
       [expectation fulfill];
     }
@@ -803,7 +803,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   [[[_authorization expect] andReturn:_fetcherService] fetcherService];
   XCTestExpectation *expectation =
       [self expectationWithDescription:@"Callback called with an error"];
-  [_signIn disconnectWithCompletion:^(NSError * _Nullable error) {
+  [_signIn disconnectWithCallback:^(NSError * _Nullable error) {
     if (error != nil) {
       [expectation fulfill];
     }
@@ -824,7 +824,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   [[[_authState expect] andReturn:_tokenResponse] lastTokenResponse];
   [[[_tokenResponse expect] andReturn:kAccessToken] accessToken];
   [[[_authorization expect] andReturn:_fetcherService] fetcherService];
-  [_signIn disconnectWithCompletion:nil];
+  [_signIn disconnectWithCallback:nil];
   XCTAssertTrue([self isFetcherStarted], @"should start fetching");
   // Emulate result back from server.
   NSError *error = [self error];
@@ -844,7 +844,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   [[[_tokenResponse expect] andReturn:nil] refreshToken];
   XCTestExpectation *expectation =
       [self expectationWithDescription:@"Callback called with nil error"];
-  [_signIn disconnectWithCompletion:^(NSError * _Nullable error) {
+  [_signIn disconnectWithCallback:^(NSError * _Nullable error) {
     if (error == nil) {
       [expectation fulfill];
     }
@@ -864,7 +864,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   [[[_tokenResponse expect] andReturn:nil] accessToken];
   [[[_authState expect] andReturn:_tokenResponse] lastTokenResponse];
   [[[_tokenResponse expect] andReturn:nil] refreshToken];
-  [_signIn disconnectWithCompletion:nil];
+  [_signIn disconnectWithCallback:nil];
   XCTAssertFalse([self isFetcherStarted], @"should not fetch");
   XCTAssertTrue(_keychainRemoved, @"keychain should be removed");
   [_authorization verify];
@@ -887,7 +887,7 @@ static void *kTestObserverContext = &kTestObserverContext;
                                   presentingWindow:_presentingWindow
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
                                               hint:_hint
-                                        completion:_completion]);
+                                          callback:_callback]);
 }
 
 - (void)testClientIDMissingException {
@@ -903,7 +903,7 @@ static void *kTestObserverContext = &kTestObserverContext;
 #elif TARGET_OS_OSX
                     presentingWindow:_presentingWindow
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
-                          completion:nil];
+                            callback:nil];
   } @catch (NSException *exception) {
     threw = YES;
     XCTAssertEqualObjects(exception.description,
@@ -924,7 +924,7 @@ static void *kTestObserverContext = &kTestObserverContext;
                     presentingWindow:_presentingWindow
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
                                 hint:_hint
-                          completion:_completion];
+                            callback:_callback];
   } @catch (NSException *exception) {
     threw = YES;
     XCTAssertEqualObjects(exception.description,
@@ -1040,7 +1040,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   [self waitForExpectationsWithTimeout:1 handler:nil];
 
   XCTAssertFalse(_keychainSaved, @"should not save to keychain");
-  XCTAssertTrue(_completionCalled, @"should call delegate");
+  XCTAssertTrue(_callbackCalled, @"should call delegate");
   XCTAssertNotNil(_authError, @"should have error");
   XCTAssertEqualObjects(_authError.domain, kGIDSignInErrorDomain);
   XCTAssertEqual(_authError.code, kGIDSignInErrorCodeEMM);
@@ -1079,7 +1079,7 @@ static void *kTestObserverContext = &kTestObserverContext;
 
   [_authentication verify];
   XCTAssertFalse(_keychainSaved, @"should not save to keychain");
-  XCTAssertTrue(_completionCalled, @"should call delegate");
+  XCTAssertTrue(_callbackCalled, @"should call delegate");
   XCTAssertNotNil(_authError, @"should have error");
   XCTAssertEqualObjects(_authError.domain, kGIDSignInErrorDomain);
   XCTAssertEqual(_authError.code, kGIDSignInErrorCodeEMM);
@@ -1220,13 +1220,13 @@ static void *kTestObserverContext = &kTestObserverContext;
     }
   } else {
     XCTestExpectation *expectation = [self expectationWithDescription:@"Callback called"];
-    GIDSignInCompletion completion = ^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) {
+    GIDSignInCallback callback = ^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) {
       [expectation fulfill];
       if (!user) {
         XCTAssertNotNil(error, @"should have an error if user is nil");
       }
-      XCTAssertFalse(self->_completionCalled, @"callback already called");
-      self->_completionCalled = YES;
+      XCTAssertFalse(self->_callbackCalled, @"callback already called");
+      self->_callbackCalled = YES;
       self->_authError = error;
     };
     if (addScopesFlow) {
@@ -1236,7 +1236,7 @@ static void *kTestObserverContext = &kTestObserverContext;
 #elif TARGET_OS_OSX
         presentingWindow:_presentingWindow
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
-              completion:completion];
+                callback:callback];
     } else {
       if (useAdditionalScopes) {
         [_signIn signInWithConfiguration:_configuration
@@ -1247,7 +1247,7 @@ static void *kTestObserverContext = &kTestObserverContext;
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
                                     hint:_hint
                         additionalScopes:additionalScopes
-                              completion:completion];
+                                callback:callback];
       } else {
         [_signIn signInWithConfiguration:_configuration
 #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
@@ -1256,7 +1256,7 @@ static void *kTestObserverContext = &kTestObserverContext;
                         presentingWindow:_presentingWindow
 #endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
                                     hint:_hint
-                              completion:completion];
+                                callback:callback];
       }
     }
 
@@ -1305,8 +1305,8 @@ static void *kTestObserverContext = &kTestObserverContext;
 
   if (restoredSignIn && oldAccessToken) {
     XCTestExpectation *expectation = [self expectationWithDescription:@"Callback should be called"];
-    [_signIn restorePreviousSignInWithCompletion:^(GIDGoogleUser * _Nullable user,
-                                                   NSError * _Nullable error) {
+    [_signIn restorePreviousSignInWithCallback:^(GIDGoogleUser * _Nullable user,
+                                                 NSError * _Nullable error) {
       [expectation fulfill];
       XCTAssertNil(error, @"should have no error");
     }];
@@ -1351,8 +1351,8 @@ static void *kTestObserverContext = &kTestObserverContext;
 
   if (restoredSignIn && !oldAccessToken) {
     XCTestExpectation *expectation = [self expectationWithDescription:@"Callback should be called"];
-    [_signIn restorePreviousSignInWithCompletion:^(GIDGoogleUser * _Nullable user,
-                                                   NSError * _Nullable error) {
+    [_signIn restorePreviousSignInWithCallback:^(GIDGoogleUser * _Nullable user,
+                                                 NSError * _Nullable error) {
       [expectation fulfill];
       XCTAssertNil(error, @"should have no error");
     }];
@@ -1375,7 +1375,7 @@ static void *kTestObserverContext = &kTestObserverContext;
   XCTAssertTrue(profileData.hasImage);
 
   // If attempt to authenticate again, will reuse existing auth object.
-  _completionCalled = NO;
+  _callbackCalled = NO;
   _keychainRemoved = NO;
   _keychainSaved = NO;
   _authError = nil;
@@ -1385,18 +1385,18 @@ static void *kTestObserverContext = &kTestObserverContext;
     [[[_user expect] andReturn:_authentication] authentication];
   }
 
-  __block GIDAuthenticationCompletion completion;
-  [[_authentication expect] doWithFreshTokens:SAVE_TO_ARG_BLOCK(completion)];
+  __block GIDAuthenticationAction action;
+  [[_authentication expect] doWithFreshTokens:SAVE_TO_ARG_BLOCK(action)];
 
   XCTestExpectation *expectation = [self expectationWithDescription:@"Callback should be called"];
 
-  [_signIn restorePreviousSignInWithCompletion:^(GIDGoogleUser * _Nullable user,
-                                                 NSError * _Nullable error) {
+  [_signIn restorePreviousSignInWithCallback:^(GIDGoogleUser * _Nullable user,
+                                               NSError * _Nullable error) {
     [expectation fulfill];
     XCTAssertNil(error, @"should have no error");
   }];
 
-  completion(_authentication, nil);
+  action(_authentication, nil);
 
   [self waitForExpectationsWithTimeout:1 handler:nil];
   XCTAssertFalse(_keychainRemoved, @"should not remove keychain");

+ 2 - 2
Samples/ObjC/SignInSample/Source/AppDelegate.m

@@ -30,8 +30,8 @@
   // succeeds, we'll have a currentUser and the view will be able to draw its UI for the signed-in
   // state.  If the restore fails, currentUser will be nil and we'll draw the signed-out state
   // prompting the user to sign in.
-  [GIDSignIn.sharedInstance restorePreviousSignInWithCompletion:^(GIDGoogleUser *user,
-                                                                  NSError *error) {
+  [GIDSignIn.sharedInstance restorePreviousSignInWithCallback:^(GIDGoogleUser * _Nullable user,
+                                                                NSError * _Nullable error) {
     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
     SignInViewController *masterViewController =
         [[SignInViewController alloc] initWithNibName:@"SignInViewController" bundle:nil];

+ 5 - 3
Samples/ObjC/SignInSample/Source/SignInViewController.m

@@ -259,7 +259,8 @@ static NSString * const kClientID =
 - (IBAction)signIn:(id)sender {
   [GIDSignIn.sharedInstance signInWithConfiguration:_configuration
                            presentingViewController:self
-                                         completion:^(GIDGoogleUser *user, NSError *error) {
+                                           callback:^(GIDGoogleUser * _Nullable user,
+                                                      NSError * _Nullable error) {
     if (error) {
       self->_signInAuthStatus.text =
           [NSString stringWithFormat:@"Status: Authentication error: %@", error];
@@ -277,7 +278,7 @@ static NSString * const kClientID =
 }
 
 - (IBAction)disconnect:(id)sender {
-  [GIDSignIn.sharedInstance disconnectWithCompletion:^(NSError *error) {
+  [GIDSignIn.sharedInstance disconnectWithCallback:^(NSError * _Nullable error) {
     if (error) {
       self->_signInAuthStatus.text = [NSString stringWithFormat:@"Status: Failed to disconnect: %@",
                                       error];
@@ -292,7 +293,8 @@ static NSString * const kClientID =
 - (IBAction)addScopes:(id)sender {
   [GIDSignIn.sharedInstance addScopes:@[ @"https://www.googleapis.com/auth/user.birthday.read" ]
              presentingViewController:self
-                           completion:^(GIDGoogleUser *user, NSError *error) {
+                             callback:^(GIDGoogleUser * _Nullable user,
+                                        NSError * _Nullable error) {
     if (error) {
       self->_signInAuthStatus.text = [NSString stringWithFormat:@"Status: Failed to add scopes: %@",
                                       error];