Making sure the UI update from language is in the Main thread.

This commit is contained in:
Vitor Pamplona
2023-10-23 11:09:47 -04:00
parent 91bfb60613
commit 9dfb4d1a1b
@@ -109,9 +109,11 @@ class SharedPreferencesViewModel : ViewModel() {
fun updateLanguageInTheUI() { fun updateLanguageInTheUI() {
if (sharedPrefs.language != null) { if (sharedPrefs.language != null) {
AppCompatDelegate.setApplicationLocales( viewModelScope.launch(Dispatchers.Main) {
LocaleListCompat.forLanguageTags(sharedPrefs.language) AppCompatDelegate.setApplicationLocales(
) LocaleListCompat.forLanguageTags(sharedPrefs.language)
)
}
} }
} }