Răsfoiți Sursa

Fix indentation in DaysUntilBirthday sample

Matthew Mathias 3 ani în urmă
părinte
comite
aa43f12e08

+ 24 - 25
Samples/Swift/DaysUntilBirthday/Shared/Services/GoogleSignInAuthenticator.swift

@@ -41,38 +41,37 @@ final class GoogleSignInAuthenticator: ObservableObject {
   /// Signs in the user based upon the selected account.'
   /// - note: Successful calls to this will set the `authViewModel`'s `state` property.
   func signIn() {
-      #if os(iOS)
-      guard let rootViewController = UIApplication.shared.windows.first?.rootViewController else {
-        print("There is no root view controller!")
+#if os(iOS)
+    guard let rootViewController = UIApplication.shared.windows.first?.rootViewController else {
+      print("There is no root view controller!")
+      return
+    }
+
+    GIDSignIn.sharedInstance.signIn(with: configuration,
+                                    presenting: rootViewController) { user, error in
+      guard let user = user else {
+        print("Error! \(String(describing: error))")
         return
       }
+      self.authViewModel.state = .signedIn(user)
+    }
 
-      GIDSignIn.sharedInstance.signIn(with: configuration,
-                                      presenting: rootViewController) { user, error in
-        guard let user = user else {
-          print("Error! \(String(describing: error))")
-          return
-        }
-        self.authViewModel.state = .signedIn(user)
-      }
+#elseif os(macOS)
+    guard let presentingWindow = NSApplication.shared.windows.first else {
+      print("There is no presenting window!")
+      return
+    }
 
-      #elseif os(macOS)
-      guard let presentingWindow = NSApplication.shared.windows.first else {
-        print("There is no presenting window!")
+    GIDSignIn.sharedInstance.signIn(with: configuration,
+                                    presenting: presentingWindow) { user, error in
+      guard let user = user else {
+        print("Error! \(String(describing: error))")
         return
       }
-
-      GIDSignIn.sharedInstance.signIn(with: configuration,
-                                      presenting: presentingWindow) { user, error in
-        guard let user = user else {
-          print("Error! \(String(describing: error))")
-          return
-        }
-        self.authViewModel.state = .signedIn(user)
-      }
-      #endif
-
+      self.authViewModel.state = .signedIn(user)
     }
+#endif
+  }
 
   /// Signs out the current user.
   func signOut() {