Use Dispatchers.IO for network and database operations

This commit is contained in:
davidoskky 2022-08-25 12:42:40 +02:00
parent 8c817b5938
commit ac0156748b
2 changed files with 2 additions and 1 deletions

View File

@ -336,7 +336,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
handleRecurringTask()
CoroutineScope(Dispatchers.Main).launch {
CoroutineScope(Dispatchers.IO).launch {
repository.handleDBActions()
}

View File

@ -55,6 +55,7 @@ class AppViewModel(private val repository: Repository) : ViewModel() {
}
fun getItems(appendResults: Boolean, itemType: ItemType) {
// TODO: Find a way to use Dispatchers.IO without creating conflicts
CoroutineScope(Dispatchers.Main).launch {
_refreshingIndicatorProvider.emit(true)
repository.displayedItems = itemType