[EnvChange]优化环境配置入口持久化逻辑

This commit is contained in:
renwj
2022-07-29 20:05:25 +08:00
parent d5d8ab39e7
commit a3c072fed3

View File

@@ -33,9 +33,7 @@ object EnvChangeManager {
fun getCityName(): String {
val cache = getConfig()
return if (cache == null) {
val cityCode = CallerMapLocationListenerManager.getCurrentLocation()?.cityCode ?: SharedPrefsMgr.getInstance(Utils.getApp()).getString(SharedPrefsConstants.LOCATION_CITY_CODE) ?: "010"
updateCityCode(cityCode)
when(cityCode) {
when(CallerMapLocationListenerManager.getCurrentLocation()?.cityCode ?: SharedPrefsMgr.getInstance(Utils.getApp()).getString(SharedPrefsConstants.LOCATION_CITY_CODE) ?: "010") {
"010" -> "北京"
"0734" -> "衡阳"
else -> "未知"
@@ -51,17 +49,15 @@ object EnvChangeManager {
fun getNetMode(): String {
val cache = getConfig()
if (cache == null) {
val mode = DebugConfig.getNetMode()
updateNetMode(mode)
return when(mode) {
return if (cache == null) {
when(DebugConfig.getNetMode()) {
DebugConfig.NET_MODE_RELEASE -> "生产"
DebugConfig.NET_MODE_QA -> "测试"
DebugConfig.NET_MODE_DEMO -> "演示"
else -> "未知"
}
} else {
return when(cache.second) {
when(cache.second) {
DebugConfig.NET_MODE_RELEASE -> "生产"
DebugConfig.NET_MODE_QA -> "测试"
DebugConfig.NET_MODE_DEMO -> "演示"