feat packing refs #4021

This commit is contained in:
Sergio De la torre 2024-06-24 15:42:10 +02:00
parent 59b91ffc61
commit d52bdbc546
1 changed files with 25 additions and 18 deletions

View File

@ -163,27 +163,28 @@ class DataStoreLocal(var mobileApplication: MobileApplication) {
fun getImages(): Flow<List<com.esafirm.imagepicker.model.Image>> {
val gson = Gson()
return mobileApplication.dataStore.data.map { preferences ->
val imagesJson = preferences[IMAGES_KEY] ?: return@map emptyList<com.esafirm.imagepicker.model.Image>()
val imagesJson = preferences[IMAGES_KEY]
?: return@map emptyList<com.esafirm.imagepicker.model.Image>()
val type = object : TypeToken<List<com.esafirm.imagepicker.model.Image>>() {}.type
gson.fromJson(imagesJson, type)
}
}
suspend fun deleteEntryPackaging(){
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYID,"")
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERID,"")
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERNAME,"")
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYOBSERVATIONORIGINAL,"")
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYOBSERVATIONS,"")
suspend fun deleteEntryPackaging() {
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYID, "")
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERID, "")
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERNAME, "")
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYOBSERVATIONORIGINAL, "")
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYOBSERVATIONS, "")
}
suspend fun deleteImages(){
suspend fun deleteImages() {
mobileApplication.dataStore.edit { preferences ->
preferences.remove(IMAGES_KEY)
}
}
suspend fun deleteWorkForm(nameWorkForm: Preferences.Key<String>) {
if (nameWorkForm.name == "all") {
@ -251,15 +252,20 @@ class DataStoreLocal(var mobileApplication: MobileApplication) {
urlSalix = "https://test-salix.verdnatura.es"
)
)
val working_in_test = true
if (working_in_test) {
saveWorkForm(
WorkForms(
"TestLocalhost",
urlSalix = "https://test-salix.verdnatura.es"
)
saveWorkForm(
WorkForms(
"Dev",
urlSalix = "https://dev-salix.verdnatura.es"
)
)
saveWorkForm(
WorkForms(
"Aula formación",
urlSalix = "http://pc525.samba.verdnatura.es:3000"
)
)
val working_in_test = false
if (working_in_test) {
saveWorkForm(
WorkForms(
"TestHome",
@ -326,6 +332,7 @@ class DataStoreLocal(var mobileApplication: MobileApplication) {
}
return url
}
fun getServerLilium(): String {
var url =