1
0
Fork 0

For #5552 - Temporary fix for startup crash on es locales

master
Jeff Boek 2019-09-24 17:37:26 -07:00
parent 2e32083d84
commit 1c9c5317eb
1 changed files with 17 additions and 6 deletions

View File

@ -40,6 +40,7 @@ import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.isInExperiment
import org.mozilla.fenix.test.Mockable
import java.util.FormatFlagsConversionMismatchException
/**
* Component group for background services. These are the components that need to be accessed from within a
@ -61,12 +62,22 @@ class BackgroundServices(
}
}
fun defaultDeviceName(context: Context): String = context.getString(
R.string.default_device_name,
context.getString(R.string.app_name),
Build.MANUFACTURER,
Build.MODEL
)
// // A malformed string is causing crashes.
// This will be removed when the string is fixed. See #5552
fun defaultDeviceName(context: Context): String = try {
context.getString(
R.string.default_device_name,
context.getString(R.string.app_name),
Build.MANUFACTURER,
Build.MODEL
)
} catch (ex: FormatFlagsConversionMismatchException) {
"%s on %s %s".format(
context.getString(R.string.app_name),
Build.MANUFACTURER,
Build.MODEL
)
}
private val serverConfig = ServerConfig.release(CLIENT_ID, redirectUrl(context))
private val deviceConfig = DeviceConfig(