refs #4678 preparar fallo conexión
This commit is contained in:
parent
22faafd907
commit
4304da8316
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue