File tree Expand file tree Collapse file tree
FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/FirebaseAuthSwiftUI/Services Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ public enum AuthenticationFlow {
2828public final class AuthEnvironment {
2929 public static let shared = AuthEnvironment ( )
3030
31+ // TODO: - need to know how we're configuring the below properties or if they should live on AuthEnvironment
32+ let auth : Auth = . auth( )
33+ let language : String = " en "
34+ let enableAutoAnonymousLogin : Bool = true
35+
3136 var currentUser : User ?
3237 var errorMessage = " "
3338
Original file line number Diff line number Diff line change @@ -3,14 +3,16 @@ import SwiftUI
33
44@MainActor
55public class EmailAuthProvider {
6- @ Environment ( AuthEnvironment . self ) private var authEnvironment
6+ private let authEnvironment : AuthEnvironment
77
8- public init ( ) { }
8+ public init ( authEnvironment: AuthEnvironment ) {
9+ self . authEnvironment = authEnvironment
10+ }
911
1012 func signIn( withEmail email: String , password: String ) async throws {
1113 authEnvironment. authenticationState = . authenticating
1214 do {
13- try await Auth . auth ( ) . createUser ( withEmail: email, password: password)
15+ try await authEnvironment . auth. createUser ( withEmail: email, password: password)
1416 } catch {
1517 authEnvironment. authenticationState = . unauthenticated
1618 throw error
@@ -20,7 +22,7 @@ public class EmailAuthProvider {
2022 func signUp( withEmail email: String , password: String ) async throws {
2123 authEnvironment. authenticationState = . authenticating
2224 do {
23- try await Auth . auth ( ) . createUser ( withEmail: email, password: password)
25+ try await authEnvironment . auth. createUser ( withEmail: email, password: password)
2426 } catch {
2527 authEnvironment. authenticationState = . unauthenticated
2628 throw error
You can’t perform that action at this time.
0 commit comments