refs #6276 feat:silex →salix
This commit is contained in:
parent
2c6e6bdfa9
commit
02fe790204
|
@ -352,7 +352,7 @@ class LoginFragment(var imageUri: Uri?) :
|
|||
}
|
||||
|
||||
}
|
||||
if (it.isVersionCritical == 1) {
|
||||
if (it.isVersionCritical) {
|
||||
customDialog.setDescription(getString(R.string.updatecritical))
|
||||
} else {
|
||||
customDialog.setKoButton(getString(R.string.cancel)) {
|
||||
|
|
|
@ -12,7 +12,6 @@ import es.verdnatura.domain.ConstAndValues.TOKEN
|
|||
import es.verdnatura.domain.ConstAndValues.TOKENCREATED
|
||||
import es.verdnatura.domain.ConstAndValues.TTL
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.SilexCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
|
@ -171,12 +170,12 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
|||
.enqueue(object : SalixCallback<List<JsonObject>>(context) {
|
||||
override fun onSuccess(response: Response<List<JsonObject>>) {
|
||||
|
||||
_serialNumber.value = response.body()?.firstOrNull()?.get("serialNumber")?.asString
|
||||
_serialNumber.value =
|
||||
response.body()?.firstOrNull()?.get("serialNumber")?.asString
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fun deviceLog_addSalix(
|
||||
app: String, versionApp: String, android_id: String, userFk: Int, serialnumber: String?
|
||||
) {
|
||||
|
@ -201,13 +200,10 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
fun checkVersion(nameApp: String) {
|
||||
//Tarea 6276 Modificado back
|
||||
//cambiar "isVersionCritical": false a Boolean
|
||||
//salix.getVersion(nameApp)
|
||||
silex.getVersion(nameApp)
|
||||
//.enqueue(object : SalixCallback<versionApp>(context) {
|
||||
.enqueue(object : SilexCallback<VersionApp>(context) {
|
||||
override fun onSuccess(response: Response<VersionApp>) {
|
||||
if (response.body() != null) {
|
||||
salix.getVersion(nameApp)
|
||||
.enqueue(object : SalixCallback<VersionApp>(context) {
|
||||
override fun onSuccess(response: Response<VersionApp>) {
|
||||
|
||||
_versionappitem.value = response.body()?.let {
|
||||
VersionApp(
|
||||
it.appname,
|
||||
|
@ -220,23 +216,16 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
_versionappitem.value = VersionApp(
|
||||
"", "", isError = true, errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), response.message()
|
||||
nameApp, "", isError = true, errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), t.message!!
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
_versionappitem.value = VersionApp(
|
||||
nameApp, "", isError = true, errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this), t.message!!
|
||||
)
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fun getListFromJSON(json: JsonObject): MutableList<itemsExpeditionDynamics> {
|
||||
|
@ -252,23 +241,26 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
|||
return list
|
||||
}
|
||||
|
||||
fun operator_add(workerFk:Int? = null) {
|
||||
fun operator_add(workerFk: Int? = null) {
|
||||
//Tarea 6276
|
||||
salix.operatorAdd(hashMapOf("workerFk" to workerFk))
|
||||
.enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
override fun onError(t: Throwable) {
|
||||
|
||||
if (!(t.message!!.contains("ER_DUP_ENTRY")))
|
||||
_operatorAdd.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
if (!(t.message!!.contains("ER_DUP_ENTRY")))
|
||||
_operatorAdd.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
t.message!!
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_operatorAdd.value = ResponseItemVO("", false)
|
||||
}
|
||||
})
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_operatorAdd.value = ResponseItemVO("", false)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//Tarea 5870
|
||||
|
|
|
@ -78,7 +78,7 @@ class Operator(
|
|||
class VersionApp(
|
||||
val appname: String = "",
|
||||
val version: String = "",
|
||||
var isVersionCritical: Int = 0,
|
||||
var isVersionCritical: Boolean = false,
|
||||
var url: String? = null,
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
|
|
Loading…
Reference in New Issue