Optimize when statement in EnvironmentUrlDataJsonExtensions (#1331)

This commit is contained in:
David Perez 2024-05-02 10:50:46 -05:00 committed by Álison Fernandes
parent fd08f39fd9
commit 69bc72552d

View file

@ -111,10 +111,14 @@ private fun EnvironmentUrlDataJson.getSelfHostedUrlOrNull(): String? =
*/
fun EnvironmentUrlDataJson.toEnvironmentUrls(): Environment =
when (this) {
EnvironmentUrlDataJson.DEFAULT_US -> Environment.Us
EnvironmentUrlDataJson.DEFAULT_LEGACY_US -> Environment.Us
EnvironmentUrlDataJson.DEFAULT_EU -> Environment.Eu
EnvironmentUrlDataJson.DEFAULT_LEGACY_EU -> Environment.Eu
EnvironmentUrlDataJson.DEFAULT_US,
EnvironmentUrlDataJson.DEFAULT_LEGACY_US,
-> Environment.Us
EnvironmentUrlDataJson.DEFAULT_EU,
EnvironmentUrlDataJson.DEFAULT_LEGACY_EU,
-> Environment.Eu
else -> Environment.SelfHosted(environmentUrlData = this)
}