From acf9206fe10d0f067e7ca53b83b57252959b9a64 Mon Sep 17 00:00:00 2001 From: Alexandru2909 Date: Fri, 29 Jul 2022 17:17:02 +0300 Subject: [PATCH] For #25837 - Invalidate cached nimbusValidation values when changing locale settings --- .../settings/advanced/DefaultLocaleSettingsController.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/org/mozilla/fenix/settings/advanced/DefaultLocaleSettingsController.kt b/app/src/main/java/org/mozilla/fenix/settings/advanced/DefaultLocaleSettingsController.kt index 96089aa20..1e9d95b1e 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/advanced/DefaultLocaleSettingsController.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/advanced/DefaultLocaleSettingsController.kt @@ -8,6 +8,7 @@ import android.app.Activity import android.content.Context import mozilla.components.support.locale.LocaleManager import mozilla.components.support.locale.LocaleUseCases +import org.mozilla.fenix.nimbus.FxNimbus import java.util.Locale interface LocaleSettingsController { @@ -31,6 +32,9 @@ class DefaultLocaleSettingsController( localeSettingsStore.dispatch(LocaleSettingsAction.Select(locale)) LocaleManager.setNewLocale(activity, localeUseCase, locale) LocaleManager.updateBaseConfiguration(activity, locale) + + // Invalidate cached values to use the new locale + FxNimbus.features.nimbusValidation.withCachedValue(null) activity.recreate() activity.overridePendingTransition(0, 0) } @@ -42,6 +46,9 @@ class DefaultLocaleSettingsController( localeSettingsStore.dispatch(LocaleSettingsAction.Select(localeSettingsStore.state.localeList[0])) LocaleManager.resetToSystemDefault(activity, localeUseCase) LocaleManager.updateBaseConfiguration(activity, localeSettingsStore.state.localeList[0]) + + // Invalidate cached values to use the default locale + FxNimbus.features.nimbusValidation.withCachedValue(null) activity.recreate() activity.overridePendingTransition(0, 0) }