Skip to content

Commit

Permalink
Avoid using init {} in MainViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
Tweener committed Jul 19, 2024
1 parent 40094ec commit ac55873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import cafe.adriel.voyager.core.screen.Screen
Expand Down Expand Up @@ -59,5 +60,9 @@ class MainScreen : Screen {
}
}
}

LaunchedEffect(Unit) {
viewModel.initViewModel()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MainViewModel(

// endregion Observable properties

init {
fun initViewModel() {
viewModelScope.launch {
// Load all required app configuration
loadAppConfigUseCase.execute()
Expand Down

0 comments on commit ac55873

Please sign in to comment.