From 61de241463a255369dd638f1ee55d84c4f949578 Mon Sep 17 00:00:00 2001
From: Amanpal Singh <87360222+aman-alfresco@users.noreply.github.com>
Date: Thu, 26 Sep 2024 12:00:17 +0530
Subject: [PATCH] ADST-601 (#361)
* fixed crash happening on the fetching config
* added localisation strings
---
actions/src/main/res/values-de/strings.xml | 2 ++
actions/src/main/res/values-es/strings.xml | 2 ++
actions/src/main/res/values-fr/strings.xml | 2 ++
actions/src/main/res/values-it/strings.xml | 2 ++
actions/src/main/res/values-nl/strings.xml | 2 ++
.../kotlin/com/alfresco/content/data/CommonRepository.kt | 8 ++++++--
.../com/alfresco/content/data/MobileConfigDataEntry.kt | 4 ++++
7 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/actions/src/main/res/values-de/strings.xml b/actions/src/main/res/values-de/strings.xml
index 47312b1b..e400a8b8 100755
--- a/actions/src/main/res/values-de/strings.xml
+++ b/actions/src/main/res/values-de/strings.xml
@@ -93,5 +93,7 @@
Workflows sind nicht verfügbar!
Workflows werden hier angezeigt, wenn sie erstellt werden.
+ Keine Aktionen verfügbar.
+ Wenden Sie sich an Ihren Administrator, um Hilfe zu erhalten.
diff --git a/actions/src/main/res/values-es/strings.xml b/actions/src/main/res/values-es/strings.xml
index 3cf48d94..6e91b2eb 100755
--- a/actions/src/main/res/values-es/strings.xml
+++ b/actions/src/main/res/values-es/strings.xml
@@ -91,6 +91,8 @@
%s elementos agregados a favoritos
%s elementos removidos de favoritos
+ No hay acciones disponibles.
+ Póngase en contacto con su administrador para obtener ayuda.
No se encontró ningún flujo de trabajo
Inicie un flujo de trabajo nuevo que desee encontrar con facilidad más adelante.
diff --git a/actions/src/main/res/values-fr/strings.xml b/actions/src/main/res/values-fr/strings.xml
index 49057323..dd467eff 100755
--- a/actions/src/main/res/values-fr/strings.xml
+++ b/actions/src/main/res/values-fr/strings.xml
@@ -93,4 +93,6 @@
Workflows non disponibles
Les workflows apparaîtront ici lorsqu\'ils seront créés.
+ Aucune action disponible.
+ Contactez votre administrateur pour obtenir de l\'aide.
diff --git a/actions/src/main/res/values-it/strings.xml b/actions/src/main/res/values-it/strings.xml
index ed7938b3..4d4a8814 100755
--- a/actions/src/main/res/values-it/strings.xml
+++ b/actions/src/main/res/values-it/strings.xml
@@ -93,4 +93,6 @@
Workflow non disponibili!
Una volta creati, i workflow verrano visualizzati qui.
+ Nessuna azione disponibile.
+ Contattare l\'amministratore per ottenere assistenza.
diff --git a/actions/src/main/res/values-nl/strings.xml b/actions/src/main/res/values-nl/strings.xml
index e36cd2f5..d7e9cf3f 100755
--- a/actions/src/main/res/values-nl/strings.xml
+++ b/actions/src/main/res/values-nl/strings.xml
@@ -91,6 +91,8 @@
%s items toegevoegd aan favorieten
%s items verwijderd uit favorieten
+ Geen acties beschikbaar.
+ Neem contact op met je beheerder voor hulp.
Geen workflows gevonden
Maak een nieuwe workflow die u later gemakkelijk wilt kunnen vinden.
diff --git a/data/src/main/kotlin/com/alfresco/content/data/CommonRepository.kt b/data/src/main/kotlin/com/alfresco/content/data/CommonRepository.kt
index d51bc464..36b290a0 100644
--- a/data/src/main/kotlin/com/alfresco/content/data/CommonRepository.kt
+++ b/data/src/main/kotlin/com/alfresco/content/data/CommonRepository.kt
@@ -51,8 +51,12 @@ class CommonRepository(val session: Session = SessionManager.requireSession) {
}
suspend fun getMobileConfigData() {
- val data = MobileConfigDataEntry.with(service.getMobileConfig("https://${URL(session.account.serverUrl).host}/app-config.json"))
-
+ var data = MobileConfigDataEntry.default()
+ try {
+ data = MobileConfigDataEntry.with(service.getMobileConfig("https://${URL(session.account.serverUrl).host}/app-config.json"))
+ } catch (ex: Exception) {
+ ex.printStackTrace()
+ }
saveJsonToSharedPrefs(session.context, KEY_FEATURES_MOBILE, data)
}
diff --git a/data/src/main/kotlin/com/alfresco/content/data/MobileConfigDataEntry.kt b/data/src/main/kotlin/com/alfresco/content/data/MobileConfigDataEntry.kt
index 78427485..c7ab06a0 100644
--- a/data/src/main/kotlin/com/alfresco/content/data/MobileConfigDataEntry.kt
+++ b/data/src/main/kotlin/com/alfresco/content/data/MobileConfigDataEntry.kt
@@ -18,6 +18,10 @@ data class MobileConfigDataEntry(
featuresMobile = MobileFeatures.with(configData.featuresMobile),
)
}
+
+ fun default(): MobileConfigDataEntry {
+ return MobileConfigDataEntry(featuresMobile = MobileFeatures())
+ }
}
}