Skip to content

Commit 79f8a5e

Browse files
authored
Improve doc comments (#266)
1 parent f434473 commit 79f8a5e

File tree

4 files changed

+35
-34
lines changed

4 files changed

+35
-34
lines changed

GoogleSignIn/Sources/Public/GoogleSignIn/GIDGoogleUser.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@
3838

3939
NS_ASSUME_NONNULL_BEGIN
4040

41-
/// This class represents a user account.
41+
/// This class represents a signed-in user.
4242
@interface GIDGoogleUser : NSObject <NSSecureCoding>
4343

4444
/// The Google user ID.
4545
@property(nonatomic, readonly, nullable) NSString *userID;
4646

47-
/// Representation of basic profile data for the user.
47+
/// The basic profile data for the user.
4848
@property(nonatomic, readonly, nullable) GIDProfileData *profile;
4949

50-
/// The API scopes granted to the app in an array of `NSString`.
50+
/// The OAuth2 scopes granted to the app in an array of `NSString`.
5151
@property(nonatomic, readonly, nullable) NSArray<NSString *> *grantedScopes;
5252

5353
/// The configuration that was used to sign in this user.
@@ -59,20 +59,19 @@ NS_ASSUME_NONNULL_BEGIN
5959
/// The OAuth2 refresh token to exchange for new access tokens.
6060
@property(nonatomic, readonly) GIDToken *refreshToken;
6161

62-
/// An OpenID Connect ID token that identifies the user.
62+
/// The OpenID Connect ID token that identifies the user.
6363
///
6464
/// Send this token to your server to authenticate the user there. For more information on this topic,
6565
/// see https://developers.google.com/identity/sign-in/ios/backend-auth.
6666
@property(nonatomic, readonly, nullable) GIDToken *idToken;
6767

68-
/// The authorizer for `GTLService`, `GTMSessionFetcher`, or `GTMHTTPFetcher`.
6968
#pragma clang diagnostic push
7069
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
70+
/// The authorizer for use with `GTLRService`, `GTMSessionFetcher`, or `GTMHTTPFetcher`.
7171
@property(nonatomic, readonly) id<GTMFetcherAuthorizationProtocol> fetcherAuthorizer;
7272
#pragma clang diagnostic pop
7373

74-
/// Get a valid access token and a valid ID token, refreshing them first if they have expired or
75-
/// are about to expire.
74+
/// Refresh the user's access and ID tokens if they have expired or are about to expire.
7675
///
7776
/// @param completion A completion block that takes a `GIDGoogleUser` or an error if the attempt to
7877
/// refresh tokens was unsuccessful. The block will be called asynchronously on the main queue.
@@ -81,7 +80,7 @@ NS_ASSUME_NONNULL_BEGIN
8180

8281
#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
8382

84-
/// Starts an interactive consent flow on iOS to add scopes to the current user's grants.
83+
/// Starts an interactive consent flow on iOS to add new scopes to the user's `grantedScopes`.
8584
///
8685
/// The completion will be called at the end of this process. If successful, a `GIDUserAuth`
8786
/// instance will be returned reflecting the new scopes and saved sign-in state will be updated.
@@ -90,8 +89,8 @@ NS_ASSUME_NONNULL_BEGIN
9089
/// @param presentingViewController The view controller used to present `SFSafariViewContoller` on
9190
/// iOS 9 and 10 and to supply `presentationContextProvider` for `ASWebAuthenticationSession` on
9291
/// iOS 13+.
93-
/// @param completion The block that is called on completion. This block will be called asynchronously
94-
/// on the main queue.
92+
/// @param completion The optional block that is called on completion. This block will be called
93+
/// asynchronously on the main queue.
9594
- (void)addScopes:(NSArray<NSString *> *)scopes
9695
presentingViewController:(UIViewController *)presentingViewController
9796
completion:(nullable void (^)(GIDUserAuth *_Nullable userAuth,
@@ -100,15 +99,16 @@ NS_ASSUME_NONNULL_BEGIN
10099

101100
#elif TARGET_OS_OSX
102101

103-
/// Starts an interactive consent flow on macOS to add scopes to the current user's grants.
102+
/// Starts an interactive consent flow on macOS to add new scopes to the user's `grantedScopes`.
104103
///
105104
/// The completion will be called at the end of this process. If successful, a `GIDUserAuth`
106105
/// instance will be returned reflecting the new scopes and saved sign-in state will be updated.
107106
///
108107
/// @param scopes An array of scopes to ask the user to consent to.
109-
/// @param presentingWindow The window used to supply `presentationContextProvider` for `ASWebAuthenticationSession`.
110-
/// @param completion The block that is called on completion. This block will be called asynchronously
111-
/// on the main queue.
108+
/// @param presentingWindow The window used to supply `presentationContextProvider` for
109+
/// `ASWebAuthenticationSession`.
110+
/// @param completion The optional block that is called on completion. This block will be called
111+
/// asynchronously on the main queue.
112112
- (void)addScopes:(NSArray<NSString *> *)scopes
113113
presentingWindow:(NSWindow *)presentingWindow
114114
completion:(nullable void (^)(GIDUserAuth *_Nullable userAuth,

GoogleSignIn/Sources/Public/GoogleSignIn/GIDSignIn.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ typedef NS_ERROR_ENUM(kGIDSignInErrorDomain, GIDSignInErrorCode) {
5151
kGIDSignInErrorCodeMismatchWithCurrentUser = -9,
5252
};
5353

54-
/// This class signs the user in with Google.
54+
/// This class is used to sign in users with their Google account and manage their session.
5555
///
56-
/// For reference, please see "Google Sign-In for iOS" at
56+
/// For reference, please see "Google Sign-In for iOS and macOS" at
5757
/// https://developers.google.com/identity/sign-in/ios
5858
@interface GIDSignIn : NSObject
5959

60-
/// A shared `GIDSignIn` instance.
60+
/// The shared `GIDSignIn` instance.
6161
@property(class, nonatomic, readonly) GIDSignIn *sharedInstance;
6262

6363
/// The `GIDGoogleUser` object representing the current user or `nil` if there is no signed-in user.
@@ -81,29 +81,29 @@ typedef NS_ERROR_ENUM(kGIDSignInErrorDomain, GIDSignInErrorCode) {
8181
/// @return `YES` if `GIDSignIn` handled this URL.
8282
- (BOOL)handleURL:(NSURL *)url;
8383

84-
/// Checks if there is a previously authenticated user saved in keychain.
84+
/// Checks if there is a previous user sign-in saved in keychain.
8585
///
86-
/// @return `YES` if there is a previously authenticated user saved in keychain.
86+
/// @return `YES` if there is a previous user sign-in saved in keychain.
8787
- (BOOL)hasPreviousSignIn;
8888

89-
/// Attempts to restore a previously authenticated user without interaction.
89+
/// Attempts to restore a previous user sign-in without interaction.
9090
///
9191
/// @param completion The block that is called on completion. This block will be called asynchronously
9292
/// on the main queue.
9393
- (void)restorePreviousSignInWithCompletion:(nullable void (^)(GIDGoogleUser *_Nullable user,
9494
NSError *_Nullable error))completion;
9595

96-
/// Marks current user as being in the signed out state.
96+
/// Signs out the `currentUser`, removing it from the keychain.
9797
- (void)signOut;
9898

99-
/// Disconnects the current user from the app and revokes previous authentication. If the operation
100-
/// succeeds, the OAuth 2.0 token is also removed from keychain.
99+
/// Disconnects the `currentUser` by signing them out and revoking all OAuth2 scope grants made to the app.
101100
///
102101
/// @param completion The optional block that is called on completion.
103102
/// This block will be called asynchronously on the main queue.
104103
- (void)disconnectWithCompletion:(nullable void (^)(NSError *_Nullable error))completion;
105104

106105
#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
106+
107107
/// Starts an interactive sign-in flow on iOS.
108108
///
109109
/// The completion will be called at the end of this process. Any saved sign-in state will be
@@ -114,7 +114,7 @@ typedef NS_ERROR_ENUM(kGIDSignInErrorDomain, GIDSignInErrorCode) {
114114
/// @param presentingViewController The view controller used to present `SFSafariViewContoller` on
115115
/// iOS 9 and 10 and to supply `presentationContextProvider` for `ASWebAuthenticationSession` on
116116
/// iOS 13+.
117-
/// @param completion The `GIDSignInCompletion` block that is called on completion. This block will
117+
/// @param completion The optional block that is called on completion. This block will
118118
/// be called asynchronously on the main queue.
119119
- (void)signInWithPresentingViewController:(UIViewController *)presentingViewController
120120
completion:(nullable void (^)(GIDUserAuth *_Nullable userAuth,
@@ -133,7 +133,7 @@ typedef NS_ERROR_ENUM(kGIDSignInErrorDomain, GIDSignInErrorCode) {
133133
/// iOS 13+.
134134
/// @param hint An optional hint for the authorization server, for example the user's ID or email
135135
/// address, to be prefilled if possible.
136-
/// @param completion The `GIDSignInCompletion` block that is called on completion. This block will
136+
/// @param completion The optional block that is called on completion. This block will
137137
/// be called asynchronously on the main queue.
138138
- (void)signInWithPresentingViewController:(UIViewController *)presentingViewController
139139
hint:(nullable NSString *)hint
@@ -153,7 +153,7 @@ typedef NS_ERROR_ENUM(kGIDSignInErrorDomain, GIDSignInErrorCode) {
153153
/// @param hint An optional hint for the authorization server, for example the user's ID or email
154154
/// address, to be prefilled if possible.
155155
/// @param additionalScopes An optional array of scopes to request in addition to the basic profile scopes.
156-
/// @param completion The `GIDSignInCompletion` block that is called on completion. This block will
156+
/// @param completion The optional block that is called on completion. This block will
157157
/// be called asynchronously on the main queue.
158158

159159
- (void)signInWithPresentingViewController:(UIViewController *)presentingViewController
@@ -164,6 +164,7 @@ typedef NS_ERROR_ENUM(kGIDSignInErrorDomain, GIDSignInErrorCode) {
164164
NS_EXTENSION_UNAVAILABLE("The sign-in flow is not supported in App Extensions.");
165165

166166
#elif TARGET_OS_OSX
167+
167168
/// Starts an interactive sign-in flow on macOS.
168169
///
169170
/// The completion will be called at the end of this process. Any saved sign-in state will be
@@ -172,7 +173,7 @@ typedef NS_ERROR_ENUM(kGIDSignInErrorDomain, GIDSignInErrorCode) {
172173
/// `restorePreviousSignInWithCompletion:` method to restore a previous sign-in.
173174
///
174175
/// @param presentingWindow The window used to supply `presentationContextProvider` for `ASWebAuthenticationSession`.
175-
/// @param completion The `GIDSignInCompletion` block that is called on completion. This block will
176+
/// @param completion The optional block that is called on completion. This block will
176177
/// be called asynchronously on the main queue.
177178
- (void)signInWithPresentingWindow:(NSWindow *)presentingWindow
178179
completion:(nullable void (^)(GIDUserAuth *_Nullable userAuth,
@@ -188,7 +189,7 @@ typedef NS_ERROR_ENUM(kGIDSignInErrorDomain, GIDSignInErrorCode) {
188189
/// @param presentingWindow The window used to supply `presentationContextProvider` for `ASWebAuthenticationSession`.
189190
/// @param hint An optional hint for the authorization server, for example the user's ID or email
190191
/// address, to be prefilled if possible.
191-
/// @param completion The `GIDSignInCompletion` block that is called on completion. This block will
192+
/// @param completion The optional block that is called on completion. This block will
192193
/// be called asynchronously on the main queue.
193194
- (void)signInWithPresentingWindow:(NSWindow *)presentingWindow
194195
hint:(nullable NSString *)hint
@@ -206,7 +207,7 @@ typedef NS_ERROR_ENUM(kGIDSignInErrorDomain, GIDSignInErrorCode) {
206207
/// @param hint An optional hint for the authorization server, for example the user's ID or email
207208
/// address, to be prefilled if possible.
208209
/// @param additionalScopes An optional array of scopes to request in addition to the basic profile scopes.
209-
/// @param completion The `GIDSignInCompletion` block that is called on completion. This block will
210+
/// @param completion The optional block that is called on completion. This block will
210211
/// be called asynchronously on the main queue.
211212
- (void)signInWithPresentingWindow:(NSWindow *)presentingWindow
212213
hint:(nullable NSString *)hint

GoogleSignIn/Sources/Public/GoogleSignIn/GIDSignInButton.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ typedef NS_ENUM(NSInteger, GIDSignInButtonColorScheme) {
4242

4343
/// This class provides the "Sign in with Google" button.
4444
///
45-
/// You can instantiate this class programmatically or from a NIB file. You
46-
/// should connect this control to an `IBAction`, or something similar, that
47-
/// calls signInWithConfiguration:presentingViewController:callback: on
48-
/// `GIDSignIn` and add it to your view hierarchy.
45+
/// You can instantiate this class programmatically or from a NIB file. You should connect this
46+
/// control to an `IBAction`, or something similar, that calls
47+
/// signInWithPresentingViewController:completion: on `GIDSignIn` and add it to your view
48+
/// hierarchy.
4949
@interface GIDSignInButton : UIControl
5050

5151
/// The layout style for the sign-in button.

GoogleSignIn/Sources/Public/GoogleSignIn/GIDToken.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
NS_ASSUME_NONNULL_BEGIN
2020

21-
/// This class represents the basic information of a token.
21+
/// This class represents an OAuth2 or OpenID Connect token.
2222
@interface GIDToken : NSObject <NSSecureCoding>
2323

2424
/// The token string.

0 commit comments

Comments
 (0)