Turn off app authentication for easier tests
This commit is contained in:
@@ -51,22 +51,24 @@ internal fun resolveRootRoute(
|
||||
@Preview
|
||||
fun App() {
|
||||
RecipeTheme {
|
||||
val authSession = koinInject<AuthSession>()
|
||||
val userRepository = koinInject<UserRepository>()
|
||||
val authState by authSession.state.collectAsStateWithLifecycle()
|
||||
val currentUser by userRepository.currentUser.collectAsStateWithLifecycle()
|
||||
|
||||
// Kick off the persisted-session restore once. AuthSession.initialize()
|
||||
// refreshes the stored AuthState (or transitions to Unauthenticated on
|
||||
// empty store / refresh failure) and the gate below recomposes accordingly.
|
||||
LaunchedEffect(authSession) {
|
||||
authSession.initialize()
|
||||
}
|
||||
|
||||
when (resolveRootRoute(authState, hasCurrentUser = currentUser != null)) {
|
||||
RootRoute.Splash -> SplashScreen()
|
||||
RootRoute.Login -> LoginScreen(viewModel = koinViewModel<LoginViewModel>())
|
||||
RootRoute.Shell -> AppShell()
|
||||
}
|
||||
// val authSession = koinInject<AuthSession>()
|
||||
// val userRepository = koinInject<UserRepository>()
|
||||
// val authState by authSession.state.collectAsStateWithLifecycle()
|
||||
// val currentUser by userRepository.currentUser.collectAsStateWithLifecycle()
|
||||
//
|
||||
// // Kick off the persisted-session restore once. AuthSession.initialize()
|
||||
// // refreshes the stored AuthState (or transitions to Unauthenticated on
|
||||
// // empty store / refresh failure) and the gate below recomposes accordingly.
|
||||
// LaunchedEffect(authSession) {
|
||||
// authSession.initialize()
|
||||
// }
|
||||
//
|
||||
// when (resolveRootRoute(authState, hasCurrentUser = currentUser != null)) {
|
||||
// RootRoute.Splash -> SplashScreen()
|
||||
// RootRoute.Login -> LoginScreen(viewModel = koinViewModel<LoginViewModel>())
|
||||
// RootRoute.Shell -> AppShell()
|
||||
// }
|
||||
//for easier tests authentication is turned off
|
||||
AppShell()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user