diff --git a/app/src/main/java/foundation/e/apps/ui/MainActivity.kt b/app/src/main/java/foundation/e/apps/ui/MainActivity.kt index 65843485ce08243e241009d6f16699152c3c8ec1..e3dba9a5b8370776e5e498a22c6b5c4cf1dbbf79 100644 --- a/app/src/main/java/foundation/e/apps/ui/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/ui/MainActivity.kt @@ -61,6 +61,7 @@ import foundation.e.apps.ui.setup.signin.SignInViewModel import foundation.e.apps.utils.SystemInfoProvider import foundation.e.apps.utils.eventBus.AppEvent import foundation.e.apps.utils.eventBus.EventBus +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.filter @@ -547,7 +548,7 @@ class MainActivity : AppCompatActivity() { viewModel: MainActivityViewModel, packageName: String ) { - lifecycleScope.launch { + lifecycleScope.launch(Dispatchers.IO) { val fusedDownload = viewModel.updateAwaitingForPurchasedApp(packageName) if (fusedDownload != null) { ApplicationDialogFragment( diff --git a/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt b/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt index cd54ddf68e06ad1ae8e0272b1cbd50b63d96355c..030755e7d6865ef6205dc53cda537fda47ec0a31 100644 --- a/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt +++ b/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt @@ -50,6 +50,7 @@ import foundation.e.apps.install.pkg.AppLoungePackageManager import foundation.e.apps.install.pkg.PWAManager import foundation.e.apps.install.workmanager.AppInstallProcessor import foundation.e.apps.utils.NetworkStatusManager +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import javax.inject.Inject @@ -190,7 +191,7 @@ class MainActivityViewModel @Inject constructor( } fun getApplication(app: Application) { - viewModelScope.launch { + viewModelScope.launch(Dispatchers.IO) { appInstallProcessor.initAppInstall(app) } }