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