Use Dispatchers.IO for network and database operations
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
parent
8c817b5938
commit
ac0156748b
@ -336,7 +336,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
|
|||||||
|
|
||||||
handleRecurringTask()
|
handleRecurringTask()
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
repository.handleDBActions()
|
repository.handleDBActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ class AppViewModel(private val repository: Repository) : ViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getItems(appendResults: Boolean, itemType: ItemType) {
|
fun getItems(appendResults: Boolean, itemType: ItemType) {
|
||||||
|
// TODO: Find a way to use Dispatchers.IO without creating conflicts
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
_refreshingIndicatorProvider.emit(true)
|
_refreshingIndicatorProvider.emit(true)
|
||||||
repository.displayedItems = itemType
|
repository.displayedItems = itemType
|
||||||
|
Loading…
Reference in New Issue
Block a user