diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/AppDelegate.swift b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/AppDelegate.swift index 12efe53800d..50a4e11d04b 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/AppDelegate.swift +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/AppDelegate.swift @@ -71,5 +71,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { private func configureApplicationAppearance() { UINavigationBar.appearance().tintColor = .systemOrange UITabBar.appearance().tintColor = .systemOrange + // Handles iOS 15 behavior change where tab bar become translucent during transitions. + let appearance = UITabBarAppearance() + appearance.configureWithOpaqueBackground() + UITabBar.appearance().scrollEdgeAppearance = appearance } } diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/CustomViews/LoginView.swift b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/CustomViews/LoginView.swift index 4e702c5fa89..6f0751029fc 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/CustomViews/LoginView.swift +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/CustomViews/LoginView.swift @@ -29,51 +29,42 @@ struct LoginView: View { } var body: some View { - Group { - VStack { - Group { - HStack { - VStack { - Text("Email/Password Auth") - .font(.title) - .bold() - } - Spacer() - } - HStack { - Text( - "Login or create an account using the Email/Password auth " + - "provider.\n\nEnsure that the Email/Password provider is " + - "enabled on the Firebase console for the given project." - ) - .fixedSize(horizontal: false, vertical: true) - Spacer() - } - } - .padding(.vertical) - - Spacer() - TextField("Email", text: $email) - .textFieldStyle(SymbolTextField(symbolName: "person.crop.circle")) - TextField("Password", text: $password) - .textFieldStyle(SymbolTextField(symbolName: "lock.fill")) - Spacer() - Group { - LoginViewButton( - text: "Login", - accentColor: .white, - backgroundColor: .orange, - action: login - ) - LoginViewButton( - text: "Create Account", - accentColor: .orange, - backgroundColor: .primary, - action: createUser + VStack { + Group { + HStack { + Text( + "Login or create an account using the Email/Password auth " + + "provider.\n\nEnsure that the Email/Password provider is " + + "enabled on the Firebase console for the given project." ) + .fixedSize(horizontal: false, vertical: true) + Spacer() } - .disabled(email.isEmpty || password.isEmpty) } + .padding(.bottom) + + TextField("Email", text: $email) + .textFieldStyle(SymbolTextField(symbolName: "person.crop.circle")) + TextField("Password", text: $password) + .textFieldStyle(SymbolTextField(symbolName: "lock.fill")) + .padding(.bottom) + + Group { + LoginViewButton( + text: "Login", + accentColor: .white, + backgroundColor: .orange, + action: login + ) + LoginViewButton( + text: "Create Account", + accentColor: .orange, + backgroundColor: .primary, + action: createUser + ) + } + .disabled(email.isEmpty || password.isEmpty) + Spacer() } .padding() @@ -85,6 +76,10 @@ struct LoginView: View { _ = try await AppManager.shared .auth() .signIn(withEmail: email, password: password) + await MainActor.run { + dismiss() + delegate?.loginDidOccur(resolver: nil) + } // TODO(ncooke3): Investigate possible improvements. // } catch let error as AuthErrorCode // where error.code == .secondFactorRequired { diff --git a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/ViewControllers/AuthViewController.swift b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/ViewControllers/AuthViewController.swift index 64626d87b5a..9ed87073372 100644 --- a/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/ViewControllers/AuthViewController.swift +++ b/FirebaseAuth/Tests/SampleSwift/AuthenticationExample/ViewControllers/AuthViewController.swift @@ -340,6 +340,7 @@ class AuthViewController: UIViewController, DataSourceProviderDelegate { private func performDemoEmailPasswordLoginFlow() { let loginView = LoginView(delegate: self) let hostingController = UIHostingController(rootView: loginView) + hostingController.title = "Email/Password Auth" navigationController?.pushViewController(hostingController, animated: true) }