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