Fixed order
This commit is contained in:
parent
abc9ceb29e
commit
3b72d95234
|
@ -31,23 +31,24 @@ fun App(repository: BankingRepository? = null) {
|
|||
val colors = MaterialTheme.colors.copy(primary = Colors.Primary, primaryVariant = Colors.PrimaryDark, onPrimary = Color.White,
|
||||
secondary = Colors.Accent, secondaryVariant = Colors.Accent, onSecondary = Color.White)
|
||||
|
||||
val appSettings = DI.uiState.appSettings.collectAsState().value
|
||||
|
||||
var isLoggedIn by remember(appSettings.authenticationMethod) { mutableStateOf(appSettings.authenticationMethod == AppAuthenticationMethod.None) }
|
||||
|
||||
var isInitialized by remember { mutableStateOf(false) }
|
||||
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
||||
try {
|
||||
if (isInitialized == false) {
|
||||
DI.setRepository(repository ?: SqliteBankingRepository())
|
||||
DI.setRepository(repository ?: SqliteBankingRepository()) // setting repository sets AppSettings, which is required below to determine if user needs to log in
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
Log.error(e) { "Could not set repository" }
|
||||
}
|
||||
|
||||
|
||||
val appSettings = DI.uiState.appSettings.collectAsState().value
|
||||
|
||||
var isLoggedIn by remember(appSettings.authenticationMethod) { mutableStateOf(appSettings.authenticationMethod == AppAuthenticationMethod.None) }
|
||||
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
||||
|
||||
MaterialTheme(colors = colors, typography = typography) {
|
||||
if (isLoggedIn == false) {
|
||||
LoginScreen(appSettings) {
|
||||
|
|
Loading…
Reference in New Issue