From 58c90306dd6fc9a8c7cbedbc23a6b824d1b7fdf7 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Mon, 23 Oct 2023 18:04:31 +0300 Subject: [PATCH] Temporarily Disable Caching for MLS demo Hotfix (#2828) * Temporarily Disable Caching for MLS demo Hotfix * Upgrade FHIR SDK engine ETag hot fix * Reset configs cache on locale change Signed-off-by: Elly Kitoto --------- Signed-off-by: Elly Kitoto Co-authored-by: Elly Kitoto --- .../fhircore/engine/configuration/ConfigurationRegistry.kt | 2 ++ android/gradle/libs.versions.toml | 2 +- .../fhircore/quest/ui/usersetting/UserSettingViewModel.kt | 1 + .../fhircore/quest/ui/usersetting/UserSettingViewModelTest.kt | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt b/android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt index e247f0d76c..c92da7580b 100644 --- a/android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt +++ b/android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt @@ -598,6 +598,8 @@ constructor( } } + fun clearConfigsCache() = configCacheMap.clear() + companion object { const val BASE_CONFIG_PATH = "configs/%s" const val COMPOSITION_CONFIG_PATH = "configs/%s/composition_config.json" diff --git a/android/gradle/libs.versions.toml b/android/gradle/libs.versions.toml index ee7249794f..f6fda5456d 100644 --- a/android/gradle/libs.versions.toml +++ b/android/gradle/libs.versions.toml @@ -25,7 +25,7 @@ desugar-jdk-libs = "1.1.5" easy-rules-jexl = "4.1.0" espresso-core = "3.5.1" fhir-common-utils = "0.0.10-SNAPSHOT" -fhir-engine = "0.1.0-beta04-preview4-SNAPSHOT" +fhir-engine = "0.1.0-beta04-preview4.1-SNAPSHOT" foundation = "1.3.1" fragment-ktx = "1.6.1" fragment-testing = "1.6.1" diff --git a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModel.kt b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModel.kt index ef97cbbda1..30fdb5826f 100644 --- a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModel.kt +++ b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModel.kt @@ -115,6 +115,7 @@ constructor( is UserSettingsEvent.SwitchLanguage -> { sharedPreferencesHelper.write(SharedPreferenceKey.LANG.name, event.language.tag) event.context.run { + configurationRegistry.clearConfigsCache() setAppLocale(event.language.tag) getActivity()?.refresh() } diff --git a/android/quest/src/test/java/org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModelTest.kt b/android/quest/src/test/java/org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModelTest.kt index beb78eccfa..4447996135 100644 --- a/android/quest/src/test/java/org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModelTest.kt +++ b/android/quest/src/test/java/org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModelTest.kt @@ -212,6 +212,8 @@ class UserSettingViewModelTest : RobolectricTest() { Shadows.shadowOf(Looper.getMainLooper()).idle() verify { sharedPreferencesHelper.write(SharedPreferenceKey.LANG.name, "es") } + + Assert.assertTrue(configurationRegistry.configCacheMap.isEmpty()) } @Test