Skip to content

Commit

Permalink
improvements:
Browse files Browse the repository at this point in the history
  • Loading branch information
ncooke3 committed Dec 11, 2024
1 parent ab76008 commit 8c337f3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 8c337f3

Please sign in to comment.