Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions GoogleSignIn/Sources/GIDSignIn.m
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,21 @@ - (void)signInWithConfiguration:(GIDConfiguration *)configuration
[self signInWithOptions:options];
}

- (void)signInWithConfiguration:(GIDConfiguration *)configuration

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

000IOEC. P [email protected] omreceipt.here

presentingViewController:(UIViewController *)presentingViewController
hint:(nullable NSString *)hint
scopes:(nullable NSArray *)scopes
callback:(nullable GIDSignInCallback)callback {
GIDSignInInternalOptions *options =
[GIDSignInInternalOptions defaultOptionsWithConfiguration:configuration
presentingViewController:presentingViewController
loginHint:hint
addScopesFlow:NO
scopes:scopes
callback:callback];
[self signInWithOptions:options];
}

- (void)signInWithConfiguration:(GIDConfiguration *)configuration
presentingViewController:(UIViewController *)presentingViewController
callback:(nullable GIDSignInCallback)callback {
Expand Down
7 changes: 7 additions & 0 deletions GoogleSignIn/Sources/GIDSignInInternalOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ NS_ASSUME_NONNULL_BEGIN
addScopesFlow:(BOOL)addScopesFlow
callback:(nullable GIDSignInCallback)callback;

+ (instancetype)defaultOptionsWithConfiguration:(nullable GIDConfiguration *)configuration
presentingViewController:(nullable UIViewController *)presentingViewController
loginHint:(nullable NSString *)loginHint
addScopesFlow:(BOOL)addScopesFlow
scopes:(nullable NSArray *)scopes
callback:(nullable GIDSignInCallback)callback;

/// Creates the options to sign in silently.
+ (instancetype)silentOptionsWithCallback:(GIDSignInCallback)callback;

Expand Down
17 changes: 16 additions & 1 deletion GoogleSignIn/Sources/GIDSignInInternalOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ + (instancetype)defaultOptionsWithConfiguration:(nullable GIDConfiguration *)con
(nullable UIViewController *)presentingViewController
loginHint:(nullable NSString *)loginHint
addScopesFlow:(BOOL)addScopesFlow
scopes:(nullable NSArray *)scopes
callback:(nullable GIDSignInCallback)callback {
GIDSignInInternalOptions *options = [[GIDSignInInternalOptions alloc] init];
if (options) {
Expand All @@ -35,11 +36,25 @@ + (instancetype)defaultOptionsWithConfiguration:(nullable GIDConfiguration *)con
options->_presentingViewController = presentingViewController;
options->_loginHint = loginHint;
options->_callback = callback;
options->_scopes = [GIDScopes scopesWithBasicProfile:@[]];
options->_scopes = [GIDScopes scopesWithBasicProfile:scopes];
}
return options;
}

+ (instancetype)defaultOptionsWithConfiguration:(nullable GIDConfiguration *)configuration
presentingViewController:(nullable UIViewController *)presentingViewController
loginHint:(nullable NSString *)loginHint
addScopesFlow:(BOOL)addScopesFlow
callback:(nullable GIDSignInCallback)callback {
GIDSignInInternalOptions *options = [self defaultOptionsWithConfiguration:configuration
presentingViewController:presentingViewController
loginHint:loginHint
addScopesFlow:addScopesFlow
scopes:@[]
callback:callback];
return options;
}

+ (instancetype)silentOptionsWithCallback:(GIDSignInCallback)callback {
GIDSignInInternalOptions *options = [self defaultOptionsWithConfiguration:nil
presentingViewController:nil
Expand Down
22 changes: 22 additions & 0 deletions GoogleSignIn/Sources/Public/GoogleSignIn/GIDSignIn.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,28 @@ typedef void (^GIDDisconnectCallback)(NSError *_Nullable error);
callback:(nullable GIDSignInCallback)callback
NS_EXTENSION_UNAVAILABLE("The sign-in flow is not supported in App Extensions.");

/// Starts an interactive sign-in flow using the provided configuration and a login hint.
///
/// 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
/// `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.
/// @param hint An optional hint for the authorization server, for example the user's ID or email
/// address, to be prefilled if possible.
/// @param scopes a list of initial scopes
/// @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
scopes:(nullable NSArray *)scopes
callback:(nullable GIDSignInCallback)callback;

/// Starts an interactive consent flow to add scopes to the current user's grants.
///
/// The callback will be called at the end of this process. If successful, a new `GIDGoogleUser`
Expand Down