Moves language translation cleanup to the IO thread since it clears disk files as well

This commit is contained in:
Vitor Pamplona 2024-02-12 11:15:59 -05:00
parent a3ac8a445d
commit bdff8c6c0d

View File

@ -113,7 +113,9 @@ class MainActivity : AppCompatActivity() {
val accountStateViewModel: AccountStateViewModel = viewModel()
accountStateViewModel.serviceManager = serviceManager
LaunchedEffect(key1 = Unit) { accountStateViewModel.tryLoginExistingAccountAsync() }
LaunchedEffect(key1 = Unit) {
accountStateViewModel.tryLoginExistingAccountAsync()
}
AccountScreen(accountStateViewModel, sharedPreferencesViewModel)
}
@ -158,7 +160,9 @@ class MainActivity : AppCompatActivity() {
override fun onPause() {
Log.d("Lifetime Event", "MainActivity.onPause")
LanguageTranslatorService.clear()
GlobalScope.launch(Dispatchers.IO) {
LanguageTranslatorService.clear()
}
serviceManager.cleanObservers()
// if (BuildConfig.DEBUG) {