diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f7d69037..e14fbe09 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -312,22 +312,13 @@
-
-
-
-
-
-
-
-
+
-
-
-
-
+
+
+
+
-
-
@@ -342,7 +333,7 @@
-
+
@@ -498,6 +489,7 @@
"ApkExportedModule": "Gestor_Almacén.app",
"ExportApk.ApkPathForGestor_Almacén.app": "C:\\Users\\sergiodt\\AndroidStudioProjects\\vn-warehouseManager\\app",
"Gradle.vn-warehouseManager [clean].executor": "Run",
+ "Gradle.vn-warehouseManager.executor": "Run",
"KotlinFunctionFindUsagesOptions.isSearchForTextOccurrences": "true",
"PROJECT_TRUSTED_KEY": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
@@ -524,7 +516,7 @@
"project.structure.proportion": "0.17",
"project.structure.side.proportion": "0.2",
"run.code.analysis.last.selected.profile": "pProject Default",
- "settings.editor.selected.configurable": "preferences.editor"
+ "settings.editor.selected.configurable": "reference.settingsdialog.project.gradle"
},
"keyToStringList": {
"ExportApk.BuildVariants": [
@@ -556,11 +548,11 @@
+
-
@@ -608,6 +600,7 @@
+
@@ -716,11 +709,8 @@
+
-
-
-
-
@@ -1080,7 +1070,7 @@
1709725795643
-
+
@@ -1161,7 +1151,7 @@
-
+
@@ -1204,8 +1194,6 @@
-
-
@@ -1221,15 +1209,17 @@
-
-
+
+
+
-
+
+
diff --git a/app/src/main/java/es/verdnatura/MobileApplication.kt b/app/src/main/java/es/verdnatura/MobileApplication.kt
index 11220466..f4d9af07 100644
--- a/app/src/main/java/es/verdnatura/MobileApplication.kt
+++ b/app/src/main/java/es/verdnatura/MobileApplication.kt
@@ -27,6 +27,7 @@ class MobileApplication : Application(), InteceptorListener {
private var mainActivityListener: MainActivityListener? = null
private var loginListener: LoginListener? = null
private var signListener: SignListener? = null
+ private var isActivityLoginRunning = false
fun setMainListener(listener: MainActivityListener) {
mainActivityListener = listener
@@ -40,7 +41,7 @@ class MobileApplication : Application(), InteceptorListener {
signListener = listener
}
- // lateinit var silex: VerdnaturaService
+ // lateinit var silex: VerdnaturaService
lateinit var salix: SalixService
var userId: Int? = null
var userName: String? = null
@@ -77,6 +78,34 @@ class MobileApplication : Application(), InteceptorListener {
val restClient = RestClient(this, this)
salix = restClient.salixClient
+ /* registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
+ override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
+ }
+
+ override fun onActivityStarted(activity: Activity) {
+ }
+
+ override fun onActivityResumed(activity: Activity) {
+ isActivityLoginRunning = activity.javaClass == LoginActivity::class.java
+ }
+
+ override fun onActivityPaused(activity: Activity) {
+ if (activity.javaClass == LoginActivity::class.java) {
+ isActivityLoginRunning = false
+ }
+ }
+
+ override fun onActivityStopped(activity: Activity) {
+ }
+
+ override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
+ }
+
+ override fun onActivityDestroyed(activity: Activity) {
+ isActivityLoginRunning = false
+ }
+ })*/
+
}
fun playSoundIsOK(bool: Boolean) {
@@ -120,7 +149,7 @@ class MobileApplication : Application(), InteceptorListener {
val settings = this.resources.configuration
return settings.locales.get(0).language
}
- fun clearApplicationData() {
+ fun clearApplicationData() {
try {
val cacheDir = this.cacheDir
val appDir = File(cacheDir.parent ?: return)
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt
index dfbbccad..31884da1 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt
@@ -19,16 +19,17 @@ import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.DeviceLogSalix
+import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalix
+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.LoginApp
import es.verdnatura.presentation.view.feature.login.model.LoginAppData
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.OperatorAdd
import es.verdnatura.presentation.view.feature.login.model.OperatorSalix
import es.verdnatura.presentation.view.feature.login.model.RenewToken
import es.verdnatura.presentation.view.feature.login.model.VersionApp
-import es.verdnatura.presentation.view.feature.login.model.accessConfigSalix
-import es.verdnatura.presentation.view.feature.login.model.accessConfigSalixList
import es.verdnatura.presentation.view.feature.paletizador.model.ItemsExpeditionDynamics
import kotlinx.coroutines.runBlocking
import retrofit2.Response
@@ -66,12 +67,12 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
val workerOperator: LiveData
get() = _workerOperator
- private val _accessConfigSalixList by lazy { MutableLiveData() }
+ private val _accessConfigSalixList by lazy { MutableLiveData() }
private val _renewTokenResponse by lazy { MutableLiveData() }
val renewTokenResponse: LiveData
get() = _renewTokenResponse
- val loadAccessConfigSalixList: LiveData> =
+ val loadAccessConfigSalixList: LiveData> =
_accessConfigSalixList.map { Event(it) }
fun loginSalix(user: String, password: String) {
@@ -275,7 +276,7 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
fun operator_add(workerFk: Int? = null) {
//Tarea 6276
- salix.operatorAdd(hashMapOf("workerFk" to workerFk))
+ salix.operatorAdd(OperatorAdd(workerFk!!,false))
.enqueue(object : SalixCallback(context) {
override fun onError(t: Throwable) {
@@ -335,36 +336,36 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
) {
salix.getAccessTokenConfigs()
- .enqueue(object : SalixCallback>(context) {
+ .enqueue(object : SalixCallback>(context) {
override fun onError(t: Throwable) {
- val listError: ArrayList = ArrayList()
+ val listError: ArrayList = ArrayList()
listError.add(
- accessConfigSalix(
+ AccessConfigSalix(
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), t.message!!
)
)
)
- _accessConfigSalixList.value = accessConfigSalixList(listError)
+ _accessConfigSalixList.value = AccessConfigSalixList(listError)
}
- override fun onSuccess(response: Response>) {
+ override fun onSuccess(response: Response>) {
if (response.body() != null) {
_accessConfigSalixList.value = response.body()?.let {
- accessConfigSalixList(it)
+ AccessConfigSalixList(it)
}
} else {
- val listError: ArrayList = ArrayList()
+ val listError: ArrayList = ArrayList()
listError.add(
- accessConfigSalix(
+ AccessConfigSalix(
isError = true, errorMessage = getMessageFromAllResponse(
nameofFunction(this), response.message()
)
)
)
- _accessConfigSalixList.value = accessConfigSalixList(listError)
+ _accessConfigSalixList.value = AccessConfigSalixList(listError)
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt
index d2d4727e..cff00f95 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt
@@ -90,7 +90,7 @@ data class Sector(
data class Printer(val id: Int, val name: String)
data class Train(val id: Int, val name: String)
-class accessConfigSalix(
+class AccessConfigSalix(
val id: Number = 0,
val renewPeriod: Long = 0,
val renewInterval: Long = 0,
@@ -102,8 +102,8 @@ class OperatorList(
var list: List = listOf()
)
-class accessConfigSalixList(
- var list: List = listOf()
+class AccessConfigSalixList(
+ var list: List = listOf()
)
class Operator(
@@ -111,6 +111,10 @@ class Operator(
val labelerFk: Int?
)
+data class OperatorAdd(
+var workerFk:Int,
+var isOnReservationMode:Boolean
+)
class VersionApp(
val appname: String = "",
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt
index 87fd46a6..6bc9dc6a 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt
@@ -437,7 +437,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
)
)
- if (userId == 19591) {
+ if (userId == 19591 || userId == 9) {
_pasillerositem.add(
PasillerosItemVO(
6,
@@ -539,7 +539,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
fun inititializeDefaultPrevia() {
- if (isOnReservationMode || userId == 19591){
+ if (isOnReservationMode){
// if (userId == 19591 || userId == 18404 || userId == 9) {
_pasillerositem.add(
PasillerosItemVO(