refs #4678 preparar fallo conexión

This commit is contained in:
Sergio De la torre 2023-05-31 16:02:32 +02:00
parent 22faafd907
commit 4304da8316
1 changed files with 3 additions and 4 deletions

View File

@ -1,12 +1,11 @@
package es.verdnatura.presentation.view.feature.delivery.viewmodels
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import es.verdnatura.db.Expedicion
import es.verdnatura.db.ExpedicionDatabase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@ -17,12 +16,12 @@ class DatabaseViewModel(val context: Context) : BaseViewModel(context) {
private val db = ExpedicionDatabase.getInstance(context)
val expediciones = MutableLiveData<List<Expedicion>>()
val expediciones = MutableLiveData<List<ExpeditionInfoLoadUnload>>()
fun cargarExpediciones() {
viewModelScope.launch {
val expedicionesList = withContext(Dispatchers.IO) {
db.expedicionDao().getAll()
db.expedicionDao().getAll(123)
}
expediciones.postValue(expedicionesList)