feat: refs #7920 itemShelvingGet
This commit is contained in:
parent
32edc951f2
commit
b4f811b7b8
|
@ -22,6 +22,7 @@ import es.verdnatura.domain.ConstAndValues.RENEWINTERVAL
|
|||
import es.verdnatura.domain.ConstAndValues.RENEWPERIOD
|
||||
import es.verdnatura.domain.ConstAndValues.TOKEN
|
||||
import es.verdnatura.domain.ConstAndValues.TOKENCREATED
|
||||
import es.verdnatura.domain.ConstAndValues.TOKENMULTIMEDIA
|
||||
import es.verdnatura.domain.ConstAndValues.TTL
|
||||
import es.verdnatura.domain.ConstAndValues.USER
|
||||
import es.verdnatura.domain.ConstAndValues.WORKFORMSELECTED
|
||||
|
@ -484,6 +485,15 @@ class LoginFragment() :
|
|||
|
||||
}
|
||||
}
|
||||
multimediaTokenResponse.observe(viewLifecycleOwner) {
|
||||
runBlocking {
|
||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||
TOKENMULTIMEDIA,
|
||||
it.multimediaToken.id
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
loginSalixItem.observe(viewLifecycleOwner) {
|
||||
|
@ -514,6 +524,7 @@ class LoginFragment() :
|
|||
app.userPassword = binding.edittextPassword.text.toString()
|
||||
|
||||
viewModel.getAccessTokenConfigs()
|
||||
viewModel.getMultimedaToken()
|
||||
}
|
||||
}
|
||||
loadAccessConfigSalixList.observe(viewLifecycleOwner) { event ->
|
||||
|
|
|
@ -23,6 +23,7 @@ import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalixList
|
|||
import es.verdnatura.presentation.view.feature.login.model.DataUserSalix
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginDevice
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.MultimediaTokenResponse
|
||||
import es.verdnatura.presentation.view.feature.login.model.OperatorAdd
|
||||
import es.verdnatura.presentation.view.feature.login.model.OperatorSalix
|
||||
import es.verdnatura.presentation.view.feature.login.model.RenewToken
|
||||
|
@ -58,13 +59,16 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
|||
get() = _workerOperator
|
||||
|
||||
private val _accessConfigSalixList by lazy { MutableLiveData<AccessConfigSalixList>() }
|
||||
|
||||
private val _renewTokenResponse by lazy { MutableLiveData<RenewToken>() }
|
||||
val renewTokenResponse: LiveData<RenewToken>
|
||||
get() = _renewTokenResponse
|
||||
val loadAccessConfigSalixList: LiveData<Event<AccessConfigSalixList>> =
|
||||
_accessConfigSalixList.map { Event(it) }
|
||||
|
||||
private val _multimediaTokenResponse by lazy { MutableLiveData<MultimediaTokenResponse>() }
|
||||
val multimediaTokenResponse: LiveData<MultimediaTokenResponse>
|
||||
get() = _multimediaTokenResponse
|
||||
|
||||
fun loginSalix(user: String, password: String) {
|
||||
salix.login(LoginSalixVO(user, password))
|
||||
.enqueue(object : SalixCallback<LoginSalixVO>(context) {
|
||||
|
@ -285,6 +289,21 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun getMultimedaToken(
|
||||
) {
|
||||
|
||||
salix.getMultimediaToken()
|
||||
.enqueue(object : SalixCallback<MultimediaTokenResponse>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<MultimediaTokenResponse>) {
|
||||
_multimediaTokenResponse.value = response.body()?.let {
|
||||
it
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun renewToken(
|
||||
) {
|
||||
salix.renewToken().enqueue(object : SalixCallback<RenewToken>(context) {
|
||||
|
|
|
@ -115,4 +115,12 @@ class LoginDevice(
|
|||
|
||||
data class NameWorker(
|
||||
val firstName: String, val lastName: String
|
||||
)
|
||||
|
||||
data class MultimediaTokenResponse(
|
||||
val multimediaToken: MultimediaToken
|
||||
)
|
||||
|
||||
data class MultimediaToken(
|
||||
val id: String,
|
||||
)
|
Loading…
Reference in New Issue