|
|
@@ -15,6 +15,13 @@
|
|
|
*/
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
+#import <TargetConditionals.h>
|
|
|
+
|
|
|
+#if __has_include(<UIKit/UIKit.h>)
|
|
|
+#import <UIKit/UIKit.h>
|
|
|
+#elif __has_include(<AppKit/AppKit.h>)
|
|
|
+#import <AppKit/AppKit.h>
|
|
|
+#endif
|
|
|
|
|
|
// We have to import GTMAppAuth because forward declaring the protocol does
|
|
|
// not generate the `fetcherAuthorizer` property below for Swift.
|
|
|
@@ -25,6 +32,7 @@
|
|
|
#endif
|
|
|
|
|
|
@class GIDConfiguration;
|
|
|
+@class GIDUserAuth;
|
|
|
@class GIDToken;
|
|
|
@class GIDProfileData;
|
|
|
|
|
|
@@ -71,6 +79,43 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
- (void)doWithFreshTokens:(void (^)(GIDGoogleUser *_Nullable user,
|
|
|
NSError *_Nullable error))completion;
|
|
|
|
|
|
+#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
|
|
|
+
|
|
|
+/// 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`
|
|
|
+/// 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 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 void (^)(GIDUserAuth *_Nullable userAuth,
|
|
|
+ NSError *_Nullable error))completion
|
|
|
+ NS_EXTENSION_UNAVAILABLE("The add scopes flow is not supported in App Extensions.");
|
|
|
+
|
|
|
+#elif TARGET_OS_OSX
|
|
|
+
|
|
|
+/// 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`
|
|
|
+/// 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 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 void (^)(GIDUserAuth *_Nullable userAuth,
|
|
|
+ NSError *_Nullable error))completion;
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|