|
|
@@ -83,14 +83,15 @@ final class GoogleSignInAuthenticator: ObservableObject {
|
|
|
/// - note: Successful requests will update the `authViewModel.state` with a new current user that
|
|
|
/// has the granted scope.
|
|
|
func addBirthdayReadScope(completion: @escaping () -> Void) {
|
|
|
+ let currentUser = GIDSignIn.sharedInstance.currentUser
|
|
|
+
|
|
|
#if os(iOS)
|
|
|
guard let rootViewController = UIApplication.shared.windows.first?.rootViewController else {
|
|
|
fatalError("No root view controller!")
|
|
|
}
|
|
|
|
|
|
- GIDSignIn.sharedInstance.currentUser?.addScopes(
|
|
|
- [BirthdayLoader.birthdayReadScope], presenting: rootViewController)
|
|
|
- { userAuth, error in
|
|
|
+ currentUser?.addScopes([BirthdayLoader.birthdayReadScope],
|
|
|
+ presenting: rootViewController) { userAuth, error in
|
|
|
if let error = error {
|
|
|
print("Found error while adding birthday read scope: \(error).")
|
|
|
return
|
|
|
@@ -106,8 +107,8 @@ final class GoogleSignInAuthenticator: ObservableObject {
|
|
|
fatalError("No presenting window!")
|
|
|
}
|
|
|
|
|
|
- GIDSignIn.sharedInstance.addScopes([BirthdayLoader.birthdayReadScope],
|
|
|
- presenting: presentingWindow) { userAuth, error in
|
|
|
+ currentUser?.addScopes([BirthdayLoader.birthdayReadScope],
|
|
|
+ presenting: presentingWindow) { userAuth, error in
|
|
|
if let error = error {
|
|
|
print("Found error while adding birthday read scope: \(error).")
|
|
|
return
|