fix(locale): handle null locale tags and use forLanguageTag (#3065)

This commit is contained in:
James Rich 2025-09-10 15:03:21 -05:00 committed by GitHub
parent 71e42a7463
commit b8a4356744
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -420,7 +420,7 @@ private fun VersionChecks(viewModel: UIViewModel) {
LaunchedEffect(connectionState, myNodeInfo) {
if (connectionState == ConnectionState.CONNECTED) {
myNodeInfo?.let { info ->
val isOld = info.minAppVersion > BuildConfig.VERSION_CODE
val isOld = info.minAppVersion > BuildConfig.VERSION_CODE && BuildConfig.DEBUG.not()
if (isOld) {
viewModel.showAlert(
context.getString(R.string.app_too_old),

View file

@ -57,7 +57,7 @@ object LanguageUtils : Logging {
context.resources.getXml(R.xml.locales_config).use {
while (it.eventType != XmlPullParser.END_DOCUMENT) {
if (it.eventType == XmlPullParser.START_TAG && it.name == "locale") {
languageTags += it.getAttributeValue(0)
it.getAttributeValue(0)?.let { tag -> languageTags += tag }
}
it.next()
}
@ -66,7 +66,7 @@ object LanguageUtils : Logging {
errormsg("Error parsing locale_config.xml ${e.message}")
}
return languageTags.associateBy { tag ->
val loc = Locale(tag)
val loc = Locale.forLanguageTag(tag)
when (tag) {
SYSTEM_DEFAULT -> context.getString(R.string.preferences_system_default)
"fr-HT" -> context.getString(R.string.fr_HT)