This is the entry point into the app from the Android side. It creates all the necessary viewmodels from the beginning, then initiates the app using a AppNavGraph so that navigation between pages is also controlled. The local storage location should also be declared.
val dataStore = settingsDataStore
val settingsRepository = SettingsRepository(dataStore)
val settingsViewModel = SettingsViewModel(settingsRepository)
setContent {
val uiState by settingsViewModel.uiState.collectAsStateWithLifecycle() // UI states
YourAppTheme (darkTheme = uiState.isDarkMode){ // App theme
AppNavGraph( // Main component
viewModel = mainViewModel,
settingsViewModel = settingsViewModel,
emailLoginViewModel = emailViewModel,
)
}
}