From 3725921400631977c5fac483b18d25d10da84347 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Mon, 1 Aug 2022 16:14:49 +0100 Subject: [PATCH] using injectable dispatchers instead of direct usage --- .../java/im/vector/app/features/start/StartAppViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/start/StartAppViewModel.kt b/vector/src/main/java/im/vector/app/features/start/StartAppViewModel.kt index e4ddf647c8..4b2e7bef98 100644 --- a/vector/src/main/java/im/vector/app/features/start/StartAppViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/start/StartAppViewModel.kt @@ -23,6 +23,7 @@ import dagger.assisted.AssistedInject import im.vector.app.core.di.ActiveSessionHolder import im.vector.app.core.di.MavericksAssistedViewModelFactory import im.vector.app.core.di.hiltMavericksViewModelFactory +import im.vector.app.core.dispatchers.CoroutineDispatchers import im.vector.app.core.platform.VectorViewModel import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay @@ -32,6 +33,7 @@ import kotlin.time.Duration.Companion.seconds class StartAppViewModel @AssistedInject constructor( @Assisted val initialState: StartAppViewState, private val sessionHolder: ActiveSessionHolder, + private val dispatchers: CoroutineDispatchers, ) : VectorViewModel(initialState) { @AssistedFactory @@ -53,7 +55,7 @@ class StartAppViewModel @AssistedInject constructor( private fun handleStartApp() { handleLongProcessing() - viewModelScope.launch(Dispatchers.IO) { + viewModelScope.launch(dispatchers.io) { // This can take time because of DB migration(s), so do it in a background task. eagerlyInitializeSession() _viewEvents.post(StartAppViewEvent.AppStarted)