Skip to content

Commit ac9cd9e

Browse files
authored
Fix indentation in DaysUntilBirthday sample (google#136)
1 parent 21b8c78 commit ac9cd9e

1 file changed

Lines changed: 24 additions & 25 deletions

File tree

Samples/Swift/DaysUntilBirthday/Shared/Services/GoogleSignInAuthenticator.swift

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,38 +41,37 @@ final class GoogleSignInAuthenticator: ObservableObject {
4141
/// Signs in the user based upon the selected account.'
4242
/// - note: Successful calls to this will set the `authViewModel`'s `state` property.
4343
func signIn() {
44-
#if os(iOS)
45-
guard let rootViewController = UIApplication.shared.windows.first?.rootViewController else {
46-
print("There is no root view controller!")
44+
#if os(iOS)
45+
guard let rootViewController = UIApplication.shared.windows.first?.rootViewController else {
46+
print("There is no root view controller!")
47+
return
48+
}
49+
50+
GIDSignIn.sharedInstance.signIn(with: configuration,
51+
presenting: rootViewController) { user, error in
52+
guard let user = user else {
53+
print("Error! \(String(describing: error))")
4754
return
4855
}
56+
self.authViewModel.state = .signedIn(user)
57+
}
4958

50-
GIDSignIn.sharedInstance.signIn(with: configuration,
51-
presenting: rootViewController) { user, error in
52-
guard let user = user else {
53-
print("Error! \(String(describing: error))")
54-
return
55-
}
56-
self.authViewModel.state = .signedIn(user)
57-
}
59+
#elseif os(macOS)
60+
guard let presentingWindow = NSApplication.shared.windows.first else {
61+
print("There is no presenting window!")
62+
return
63+
}
5864

59-
#elseif os(macOS)
60-
guard let presentingWindow = NSApplication.shared.windows.first else {
61-
print("There is no presenting window!")
65+
GIDSignIn.sharedInstance.signIn(with: configuration,
66+
presenting: presentingWindow) { user, error in
67+
guard let user = user else {
68+
print("Error! \(String(describing: error))")
6269
return
6370
}
64-
65-
GIDSignIn.sharedInstance.signIn(with: configuration,
66-
presenting: presentingWindow) { user, error in
67-
guard let user = user else {
68-
print("Error! \(String(describing: error))")
69-
return
70-
}
71-
self.authViewModel.state = .signedIn(user)
72-
}
73-
#endif
74-
71+
self.authViewModel.state = .signedIn(user)
7572
}
73+
#endif
74+
}
7675

7776
/// Signs out the current user.
7877
func signOut() {

0 commit comments

Comments
 (0)