feat: refs #6659 jetPackCompose
This commit is contained in:
parent
0b42a3c61b
commit
e0b148ddfd
|
@ -6,7 +6,6 @@ import com.google.gson.Gson
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import retrofit2.Call
|
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."}"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class FunctionUtils{
|
class FunctionUtils {
|
||||||
fun getMessageFromJSON(json: String): String {
|
fun getMessageFromJSON(json: String): String {
|
||||||
val gson = Gson()
|
val gson = Gson()
|
||||||
var message = ""
|
var message = ""
|
||||||
|
@ -38,9 +38,11 @@ class FunctionUtils{
|
||||||
|
|
||||||
private fun getCurdate(date: String, context: Context): String {
|
private fun getCurdate(date: String, context: Context): String {
|
||||||
val c = Calendar.getInstance()
|
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())
|
val df2 = SimpleDateFormat(context.getString(R.string.timeFormat), Locale.getDefault())
|
||||||
c.time = df.parse(date)!!
|
c.time = df.parse(date)!!
|
||||||
return df2.format(c.time)
|
return df2.format(c.time)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,11 +8,11 @@ import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.domain.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.domain.nameofFunction
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
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.Event
|
||||||
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
|
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
|
||||||
import es.verdnatura.presentation.common.TicketPickupResponse
|
import es.verdnatura.presentation.common.TicketPickupResponse
|
||||||
|
|
|
@ -9,11 +9,11 @@ import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.domain.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.domain.nameofFunction
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
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.Event
|
||||||
import es.verdnatura.presentation.common.ItemShelving
|
import es.verdnatura.presentation.common.ItemShelving
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
|
|
|
@ -8,11 +8,11 @@ import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.domain.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.domain.nameofFunction
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
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.Event
|
||||||
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
|
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
|
|
|
@ -6,10 +6,10 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.map
|
import androidx.lifecycle.map
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.domain.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.domain.nameofFunction
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
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.Event
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||||
|
|
|
@ -6,9 +6,9 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.map
|
import androidx.lifecycle.map
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.domain.SalixCallback
|
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.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalixList
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalixList
|
||||||
|
|
Loading…
Reference in New Issue