refs #6411 feat:update libraries

This commit is contained in:
Sergio De la torre 2024-02-27 12:00:33 +01:00
parent 7571e7f6ea
commit e85939e211
16 changed files with 827 additions and 785 deletions

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.buscaritem.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
@ -16,7 +16,7 @@ class BuscarItemViewModel(val context: Context) : BaseViewModel(context) {
private val _locationList by lazy { MutableLiveData<LocationListVO>() } private val _locationList by lazy { MutableLiveData<LocationListVO>() }
val locationList: LiveData<LocationListVO> val locationList: LiveData<LocationListVO>
get() = _locationList get() = _locationList
val loadLocationList = Transformations.map(_locationList) { Event(it) } val loadLocationList: LiveData<Event<LocationListVO>> = _locationList.map { Event(it) }
fun itemshelvingGetInfo(itemFk: Any) { fun itemshelvingGetInfo(itemFk: Any) {
//salix falla fecha //salix falla fecha

View File

@ -3,7 +3,8 @@ package es.verdnatura.presentation.view.feature.collection.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import com.google.gson.JsonObject
import es.verdnatura.MobileApplication import es.verdnatura.MobileApplication
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.SilexCallback import es.verdnatura.domain.SilexCallback
@ -12,6 +13,7 @@ import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.common.TicketState import es.verdnatura.presentation.common.TicketState
import es.verdnatura.presentation.view.feature.collection.ItemVO import es.verdnatura.presentation.view.feature.collection.ItemVO
@ -39,10 +41,17 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val collectionTicketList: LiveData<CollectionVO> val collectionTicketList: LiveData<CollectionVO>
get() = _collectionTicketList get() = _collectionTicketList
private val _responseExistsItemShelvingSale by lazy { MutableLiveData<ResponseItemExistsItemShelvingSale>() }
val responseExistsItemShelvingSale: LiveData<ResponseItemExistsItemShelvingSale>
get() = _responseExistsItemShelvingSale
private val _collectionTicketSalix by lazy { MutableLiveData<CollectionTicket>() } private val _collectionTicketSalix by lazy { MutableLiveData<CollectionTicket>() }
val collectionTicketSalix: LiveData<CollectionTicket> val collectionTicketSalix: LiveData<CollectionTicket>
get() = _collectionTicketSalix get() = _collectionTicketSalix
val loadCollectionTicketSalix: LiveData<Event<CollectionTicket>> =
_collectionTicketSalix.map { Event(it) }
private val _collectionTicketListLocal by lazy { MutableLiveData<CollectionTicket>() } private val _collectionTicketListLocal by lazy { MutableLiveData<CollectionTicket>() }
val collectionTicketListLocal: LiveData<CollectionTicket> val collectionTicketListLocal: LiveData<CollectionTicket>
get() = _collectionTicketListLocal get() = _collectionTicketListLocal
@ -170,10 +179,16 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
val responseGetExtensionFromUserId: LiveData<ResponseItemVO> val responseGetExtensionFromUserId: LiveData<ResponseItemVO>
get() = _responseGetExtensionFromUserId get() = _responseGetExtensionFromUserId
val loadResponseDel = Transformations.map(_responseDel) { Event(it) }
val loadResponseSaleTrackingMark = Transformations.map(_responseSaleTracking_mark) { Event(it) } val loadResponseDel: LiveData<Event<ResponseItemVO>> = _responseDel.map { Event(it) }
val loadResponseItemShelvingUpdate =
Transformations.map(_responseItemShelvingUpdate) { Event(it) }
val loadResponseSaleTrackingMark: LiveData<Event<ResponseItemVO>> =
_responseSaleTracking_mark.map { Event(it) }
val loadResponseItemShelvingUpdate: LiveData<Event<ResponseItemVO>> =
_responseItemShelvingUpdate.map { Event(it) }
fun collectionTicketGet( fun collectionTicketGet(
collectionFk: Int, collectionFk: Int,
@ -295,6 +310,26 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
}) })
} }
fun itemShelvingSaleExists(
itemShelvingSaleFk: Number,
position: Int,
quantity: Int
) {
salix.itemShelvingSaleExists(
itemShelvingSaleFk
)
.enqueue(object :
SalixCallback<JsonObject>(context) {
override fun onSuccess(response: Response<JsonObject>) {
_responseExistsItemShelvingSale.value = ResponseItemExistsItemShelvingSale(
response.body()!!.entrySet().first().value.asBoolean, position, quantity
)
}
})
}
fun saleTrackingReplace( fun saleTrackingReplace(
saleFk: Int, saleFk: Int,
originalQuantity: Int, originalQuantity: Int,

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.delivery.viewmodels
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
@ -76,7 +76,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
private val _expeditionList by lazy { MutableLiveData<ExpeditionList>() } private val _expeditionList by lazy { MutableLiveData<ExpeditionList>() }
val expeditionList: LiveData<ExpeditionList> = _expeditionList val expeditionList: LiveData<ExpeditionList> = _expeditionList
val loadRouteList = Transformations.map(_routeList) { Event(it) } val loadRouteList: LiveData<Event<RouteList>> = _routeList.map { Event(it) }
private val _responseLoadList by lazy { MutableLiveData<ResponseItemVO>() } private val _responseLoadList by lazy { MutableLiveData<ResponseItemVO>() }
val responseLoadList: LiveData<ResponseItemVO> = _responseLoadList val responseLoadList: LiveData<ResponseItemVO> = _responseLoadList

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.diadeventa.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
@ -25,7 +25,7 @@ class DayOfSaleViewModel(val context: Context) : BaseViewModel(context) {
val itemShelvingSaleDateList: LiveData<ItemShelvingSaleDateList> val itemShelvingSaleDateList: LiveData<ItemShelvingSaleDateList>
get() = _itemShelvingSaleDateList get() = _itemShelvingSaleDateList
val loadItemShelvingSaleDateList = Transformations.map(_itemShelvingSaleDateList) { Event(it) } val loadItemShelvingSaleDateList: LiveData<Event<ItemShelvingSaleDateList>> = _itemShelvingSaleDateList.map { Event(it) }
fun itemShelvingGetSaleDate(vShelvingFK: String) { fun itemShelvingGetSaleDate(vShelvingFK: String) {
//salix falla fecha //salix falla fecha

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.historicoarticulo.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event
@ -17,7 +17,7 @@ class HistoricoArticuloViewModel(val context: Context) : BaseViewModel(context)
val historicoList: LiveData<ItemHistoricoListVO> val historicoList: LiveData<ItemHistoricoListVO>
get() = _historicoList get() = _historicoList
val loadHistoricoList = Transformations.map(_historicoList) { Event(it) } val loadHistoricoList: LiveData<Event<ItemHistoricoListVO>> = _historicoList.map { Event(it) }
fun itemGetBalance(itemFk: Int, vWarehouseFk: Int) { fun itemGetBalance(itemFk: Int, vWarehouseFk: Int) {

View File

@ -5,6 +5,7 @@ import android.view.inputmethod.EditorInfo
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemshelvinglogBinding import es.verdnatura.databinding.FragmentItemshelvinglogBinding
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.component.CustomDialog
@ -67,23 +68,30 @@ class ItemShelvingLogFragment(
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
itemShelvingLogList.observe(viewLifecycleOwner) {
if (it.list.isEmpty()) { loadItemShelvingLogList.observe(viewLifecycleOwner) { event ->
customDialog.setTitle(getString(R.string.noResults)) event.getContentIfNotHandled().notNull {
.setDescription(getString(R.string.noDataLabelScanned))
.setOkButton(getString(R.string.close)) { if (it.list.isEmpty()) {
customDialog.dismiss() customDialog.setTitle(getString(R.string.noResults))
}.show() .setDescription(getString(R.string.noDataLabelScanned))
} else { .setOkButton(getString(R.string.close)) {
adapter = ItemShelvingLogAdapter( customDialog.dismiss()
it.list, }.show()
onPasillerosItemClickListener = pasillerosItemClickListener!! } else {
) adapter = ItemShelvingLogAdapter(
binding.itemshelvinglogRecyclerview.adapter = adapter it.list,
binding.itemshelvinglogRecyclerview.layoutManager = onPasillerosItemClickListener = pasillerosItemClickListener!!
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) )
setToolBar(getString(R.string.itemShelvingLog) + ":" + itemScan) binding.itemshelvinglogRecyclerview.adapter = adapter
binding.itemshelvinglogRecyclerview.layoutManager =
LinearLayoutManager(
requireContext(),
LinearLayoutManager.VERTICAL,
false
)
setToolBar(getString(R.string.itemShelvingLog) + ":" + itemScan)
}
} }
} }
} }

View File

@ -1,8 +1,9 @@
package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event
@ -13,7 +14,7 @@ import retrofit2.Response
class ShelvingLogViewModel(val context: Context) : BaseViewModel(context) { class ShelvingLogViewModel(val context: Context) : BaseViewModel(context) {
private val _itemShelvingLogSalixList by lazy { MutableLiveData<ShelvingLogSalixList>() } private val _itemShelvingLogSalixList by lazy { MutableLiveData<ShelvingLogSalixList>() }
val loadShelvingLogSalixList = Transformations.map(_itemShelvingLogSalixList) { Event(it) } val loadShelvingLogSalixList: LiveData<Event<ShelvingLogSalixList>> = _itemShelvingLogSalixList.map { Event(it) }
fun shelvings(vShelvingFK: String) { fun shelvings(vShelvingFK: String) {
salix.Shelvings("""{"where": {"code": "$vShelvingFK"}}""").enqueue(object : salix.Shelvings("""{"where": {"code": "$vShelvingFK"}}""").enqueue(object :

View File

@ -1,8 +1,9 @@
package es.verdnatura.presentation.view.feature.historicovehiculo.fragment package es.verdnatura.presentation.view.feature.historicovehiculo.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
@ -14,7 +15,7 @@ import retrofit2.Response
class HistoricoVehiculoViewModel(var context: Context) : BaseViewModel(context) { class HistoricoVehiculoViewModel(var context: Context) : BaseViewModel(context) {
private val _historicovehiculoList by lazy { MutableLiveData<ItemHistoricoVehiculoList>() } private val _historicovehiculoList by lazy { MutableLiveData<ItemHistoricoVehiculoList>() }
val loadHistoricoVehiculoList = Transformations.map(_historicovehiculoList) { Event(it) } val loadHistoricoVehiculoList: LiveData<Event<ItemHistoricoVehiculoList>> = _historicovehiculoList.map { Event(it) }
fun machineWorkeGetHistorical(plateNumber: String, workerId:Int) { fun machineWorkeGetHistorical(plateNumber: String, workerId:Int) {
//salix falla fecha //salix falla fecha

View File

@ -1,24 +0,0 @@
package es.verdnatura.presentation.view.feature.imageview.activity
import es.verdnatura.R
import es.verdnatura.databinding.ActivityImageviewBinding
import es.verdnatura.presentation.base.BaseActivity
import es.verdnatura.presentation.common.loadUrl
class ImageViewActivity : BaseActivity<ActivityImageviewBinding>(){
override fun getLayoutId(): Int = R.layout.activity_imageview
override fun init() {
binding.mainToolbar.toolbarTitle.text = intent.getStringExtra(getString(R.string.title))
binding.imgView.loadUrl(intent.getStringExtra(getString(R.string.url))!!)
binding.mainToolbar.backButton.setOnClickListener {
onBackPressed()
}
}
}

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.inventario.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import com.google.gson.JsonObject import com.google.gson.JsonObject
import es.verdnatura.MobileApplication import es.verdnatura.MobileApplication
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
@ -66,14 +66,12 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
private val _inventoryListParking by lazy { MutableLiveData<InventoryParkingList>() } private val _inventoryListParking by lazy { MutableLiveData<InventoryParkingList>() }
val inventoryListParking: LiveData<InventoryParkingList> val inventoryListParking: LiveData<InventoryParkingList>
get() = _inventoryListParking get() = _inventoryListParking
val loadInventaryParkingList: LiveData<Event<InventoryParkingList>> = _inventoryListParking.map { Event(it) }
val loadInventaryParkingList = Transformations.map(_inventoryListParking) { Event(it) }
private val _responseCode by lazy { MutableLiveData<ResponseItemVO>() } private val _responseCode by lazy { MutableLiveData<ResponseItemVO>() }
val responseCode: LiveData<ResponseItemVO> val responseCode: LiveData<ResponseItemVO>
get() = _responseCode get() = _responseCode
val loadReponseCode: LiveData<Event<ResponseItemVO>> = _responseCode.map { Event(it) }
val loadReponseCode = Transformations.map(_responseCode) { Event(it) }
//sergio para obtener comprador //sergio para obtener comprador
fun itemShelvingBuyerGet() { fun itemShelvingBuyerGet() {
@ -85,8 +83,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
}) })
} }
val loadInventaryList: LiveData<Event<InventaryListVO>> = _inventaryList.map { Event(it) }
val loadInventaryList = Transformations.map(_inventaryList) { Event(it) }
fun getInventory(buyerFk: Int, warehouseFk: Int) { fun getInventory(buyerFk: Int, warehouseFk: Int) {
salix.itemShelvingFilterBuyer(params = arrayListOf(buyerFk, warehouseFk)) salix.itemShelvingFilterBuyer(params = arrayListOf(buyerFk, warehouseFk))

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.login.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.JsonObject import com.google.gson.JsonObject
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
@ -63,8 +63,7 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
private val _renewTokenResponse by lazy { MutableLiveData<RenewToken>() } private val _renewTokenResponse by lazy { MutableLiveData<RenewToken>() }
val renewTokenResponse: LiveData<RenewToken> val renewTokenResponse: LiveData<RenewToken>
get() = _renewTokenResponse get() = _renewTokenResponse
val loadAccessConfigSalixList: LiveData<Event<accessConfigSalixList>> = _accessConfigSalixList.map { Event(it) }
val loadAccessConfigSalixList = Transformations.map(_accessConfigSalixList) { Event(it) }
fun loginSalix(user: String, password: String) { fun loginSalix(user: String, password: String) {
salix.login(LoginSalixVO(user, password)) salix.login(LoginSalixVO(user, password))

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
@ -18,7 +18,7 @@ import retrofit2.Response
class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(context) { class ExpeditionPalletDetailViewModel(var context: Context) : BaseViewModel(context) {
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletViewListVO>() } private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletViewListVO>() }
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) } val loadExpeditionPalletList: LiveData<Event<ItemPalletViewListVO>> = _expeditionPalletList.map { Event(it) }
private val _response by lazy { MutableLiveData<ResponseItemVO>() } private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO> val response: LiveData<ResponseItemVO>

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
@ -20,10 +20,11 @@ import retrofit2.Response
class ExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) { class ExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletListVO>() } private val _expeditionPalletList by lazy { MutableLiveData<ItemPalletListVO>() }
val loadExpeditionPalletList = Transformations.map(_expeditionPalletList) { Event(it) } val loadExpeditionPalletList: LiveData<Event<ItemPalletListVO>> =
_expeditionPalletList.map { Event(it) }
private val _scanList by lazy { MutableLiveData<ItemScanList>() } private val _scanList by lazy { MutableLiveData<ItemScanList>() }
val loadScanList = Transformations.map(_scanList) { Event(it) } val loadScanList: LiveData<Event<ItemScanList>> = _scanList.map { Event(it) }
private val _response by lazy { MutableLiveData<ResponseItemVO>() } private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO> val response: LiveData<ResponseItemVO>
@ -57,7 +58,7 @@ class ExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
.enqueue(object : .enqueue(object :
SalixCallback<List<ItemScanVO>>(context) { SalixCallback<List<ItemScanVO>>(context) {
override fun onSuccess(response: Response<List<ItemScanVO>>) { override fun onSuccess(response: Response<List<ItemScanVO>>) {
_scanList.value = response.body()?.let { ItemScanList(it) } _scanList.value = response.body()?.let { ItemScanList(it) }
} }
}) })
@ -84,11 +85,10 @@ class ExpeditionPalletViewModel(val context: Context) : BaseViewModel(context) {
.enqueue(object : SalixCallback<String>(context) { .enqueue(object : SalixCallback<String>(context) {
override fun onSuccess(response: Response<String>) { override fun onSuccess(response: Response<String>) {
_responseCheckexpeditionScanPut.value = _responseCheckexpeditionScanPut.value =
ResponseItemVO(isError = false, response = response.body()!!) ResponseItemVO(isError = false, response = response.body()!!)
}
}
}) })
} }

View File

@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context import android.content.Context
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.getMessageFromAllResponse
@ -19,10 +19,10 @@ import retrofit2.Response
class ExpeditionScanViewModel(val context: Context) : BaseViewModel(context) { class ExpeditionScanViewModel(val context: Context) : BaseViewModel(context) {
private val _expeditionScanList by lazy { MutableLiveData<ItemExpeditionScanList>() } private val _expeditionScanList by lazy { MutableLiveData<ItemExpeditionScanList>() }
val loadExpeditionScanList = Transformations.map(_expeditionScanList) { Event(it) } val loadExpeditionScanList: LiveData<Event<ItemExpeditionScanList>> = _expeditionScanList.map { Event(it) }
private val _scanList by lazy { MutableLiveData<ItemScanList>() } private val _scanList by lazy { MutableLiveData<ItemScanList>() }
val loadScanList = Transformations.map(_scanList) { Event(it) } val loadScanList: LiveData<Event<ItemScanList>> = _scanList.map { Event(it) }
private val _response by lazy { MutableLiveData<ResponseItemVO>() } private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO> val response: LiveData<ResponseItemVO>

View File

@ -3,8 +3,9 @@ package es.verdnatura.presentation.view.feature.paletizador.fragment
import android.content.Context import android.content.Context
import android.os.Build import android.os.Build
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event import es.verdnatura.presentation.common.Event
@ -20,10 +21,10 @@ import java.time.LocalTime
class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context) { class ExpeditionTruckListViewModel(val context: Context) : BaseViewModel(context) {
private val _expeditionTruckList by lazy { MutableLiveData<ItemExpeditionTruckList>() } private val _expeditionTruckList by lazy { MutableLiveData<ItemExpeditionTruckList>() }
val loadExpeditionTruckList = Transformations.map(_expeditionTruckList) { Event(it) } val loadExpeditionTruckList: LiveData<Event<ItemExpeditionTruckList>> = _expeditionTruckList.map { Event(it) }
private val _response by lazy { MutableLiveData<ResponseItemVO>() } private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val loadResponseExpeditionAdd = Transformations.map(_response) { Event(it) } val loadResponseExpeditionAdd: LiveData<Event<ResponseItemVO>> = _response.map { Event(it) }
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
fun expeditionTruckList() { fun expeditionTruckList() {