feat: refs #6659 jetPackCompose

This commit is contained in:
Sergio De la torre 2025-02-20 09:47:18 +01:00
parent 0b42a3c61b
commit e0b148ddfd
7 changed files with 36 additions and 14 deletions

View File

@ -6,7 +6,6 @@ import com.google.gson.Gson
import com.google.gson.JsonObject
import es.verdnatura.MobileApplication
import es.verdnatura.R
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
import org.json.JSONObject
import retrofit2.Call
@ -95,4 +94,25 @@ abstract class SalixCallback<T>(val context: Context) : Callback<T> {
}
}
}
}
fun nameofFunction(function: Any): String {
return try {
function.javaClass.enclosingMethod!!.name + "->"
} catch (e: Exception) {
"ActivityMain->"
}
}
fun getMessageFromAllResponse(callFunction: String, responseMessage: String): String {
var messageFromError: String = try {
val answerError = JSONObject(responseMessage)
answerError.get("Message").toString()
} catch (e: Exception) {
responseMessage
}
return "$messageFromError.\r${"Callback: $callFunction."}"
}

View File

@ -8,7 +8,7 @@ import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Locale
class FunctionUtils{
class FunctionUtils {
fun getMessageFromJSON(json: String): String {
val gson = Gson()
var message = ""
@ -38,9 +38,11 @@ class FunctionUtils{
private fun getCurdate(date: String, context: Context): String {
val c = Calendar.getInstance()
val df = SimpleDateFormat(context.getString(R.string.dateCompleteFormat), Locale.getDefault())
val df =
SimpleDateFormat(context.getString(R.string.dateCompleteFormat), Locale.getDefault())
val df2 = SimpleDateFormat(context.getString(R.string.timeFormat), Locale.getDefault())
c.time = df.parse(date)!!
return df2.format(c.time)
}
}

View File

@ -8,11 +8,11 @@ import com.google.gson.JsonObject
import es.verdnatura.MobileApplication
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.domain.getMessageFromAllResponse
import es.verdnatura.domain.nameofFunction
import es.verdnatura.domain.toast
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
import es.verdnatura.presentation.common.TicketPickupResponse

View File

@ -9,11 +9,11 @@ import es.verdnatura.MobileApplication
import es.verdnatura.R
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.domain.getMessageFromAllResponse
import es.verdnatura.domain.nameofFunction
import es.verdnatura.domain.toast
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ItemShelving
import es.verdnatura.presentation.common.ResponseItemVO

View File

@ -8,11 +8,11 @@ import com.google.gson.JsonObject
import es.verdnatura.MobileApplication
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.domain.getMessageFromAllResponse
import es.verdnatura.domain.nameofFunction
import es.verdnatura.domain.toast
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
import es.verdnatura.presentation.common.ResponseItemVO

View File

@ -6,10 +6,10 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.domain.getMessageFromAllResponse
import es.verdnatura.domain.nameofFunction
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity

View File

@ -6,9 +6,9 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.map
import com.google.gson.JsonObject
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.getMessageFromAllResponse
import es.verdnatura.domain.nameofFunction
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
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.ShelvingLogSalixList