[fix]
[HttpHeaderInterceptor降频 去掉Delegates.observable]
This commit is contained in:
yangyakun
2025-07-09 18:59:02 +08:00
parent 443f1cafe1
commit fc24043cef
2 changed files with 28 additions and 23 deletions

View File

@@ -75,17 +75,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>(), IMoGoCloudListener {
@Volatile @Volatile
private var gotToken = false private var gotToken = false
private var httpDnsSimpleLocation by Delegates.observable(getDefaultSimpleLocation()) { _, oldValue, newValue -> private var httpDnsSimpleLocation = getDefaultSimpleLocation()
if (gotToken && oldValue.cityCode != newValue.cityCode) {
if (handler.hasMessages(1)) {
handler.removeMessages(1)
}
val msg = Message.obtain()
msg.what = 1
msg.obj = Pair(oldValue.cityCode, newValue.cityCode)
handler.sendMessageDelayed(msg, 1000L * 10)
}
}
override fun callCreateOnMainThread() = true override fun callCreateOnMainThread() = true
@@ -190,8 +180,8 @@ class HttpDnsStartUp : AndroidStartup<Boolean>(), IMoGoCloudListener {
val envConfig = CallerDevaToolsManager.getEnvConfig() val envConfig = CallerDevaToolsManager.getEnvConfig()
if (envConfig != null) { if (envConfig != null) {
// 更新 // 更新
httpDnsSimpleLocation = checkCityCode(envConfig.cityCode)
SimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon) httpDnsSimpleLocation = SimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon)
return httpDnsSimpleLocation return httpDnsSimpleLocation
} }
val mogoLocation: MogoLocation = val mogoLocation: MogoLocation =
@@ -202,13 +192,16 @@ class HttpDnsStartUp : AndroidStartup<Boolean>(), IMoGoCloudListener {
mogoLocation.cityCode.isNullOrEmpty() && mogoLocation.cityCode.isNullOrEmpty() &&
!CallerMapUIServiceManager.getGDLocationServer()?.lastCityCode.isNullOrEmpty() !CallerMapUIServiceManager.getGDLocationServer()?.lastCityCode.isNullOrEmpty()
) { ) {
val cityCode = (CallerMapUIServiceManager.getGDLocationServer()?.lastCityCode
?: "010")
checkCityCode(cityCode)
SimpleLocation( SimpleLocation(
CallerMapUIServiceManager.getGDLocationServer()?.lastCityCode cityCode,
?: "010",
mogoLocation.latitude, mogoLocation.latitude,
mogoLocation.longitude mogoLocation.longitude
) )
} else { } else {
checkCityCode(mogoLocation.cityCode)
SimpleLocation( SimpleLocation(
mogoLocation.cityCode, mogoLocation.cityCode,
mogoLocation.latitude, mogoLocation.latitude,
@@ -222,6 +215,18 @@ class HttpDnsStartUp : AndroidStartup<Boolean>(), IMoGoCloudListener {
initAiCloudSDK() initAiCloudSDK()
} }
private fun checkCityCode(cityCode: String) {
if (gotToken && cityCode != httpDnsSimpleLocation.cityCode) {
if (handler.hasMessages(1)) {
handler.removeMessages(1)
}
val msg = Message.obtain()
msg.what = 1
msg.obj = Pair(httpDnsSimpleLocation.cityCode, cityCode)
handler.sendMessageDelayed(msg, 1000L * 10)
}
}
@ChainLog( @ChainLog(
linkChainLog = CHAIN_TYPE_STATUS, linkChainLog = CHAIN_TYPE_STATUS,
linkCode = CHAIN_SOURCE_CLOUD, linkCode = CHAIN_SOURCE_CLOUD,

View File

@@ -64,21 +64,21 @@ bytex.ASM_API=ASM7
LOGLIB_VERSION=1.10.18 LOGLIB_VERSION=1.10.18
######## MogoAiCloudSDK Version ######## ######## MogoAiCloudSDK Version ########
# 网络请求LOGLIB_VERSION # 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.4.7.58 MOGO_NETWORK_VERSION=1.4.7.65
# 鉴权 # 鉴权
MOGO_PASSPORT_VERSION=1.4.7.63 MOGO_PASSPORT_VERSION=1.4.7.65
# 长链接 # 长链接
MOGO_SOCKET_VERSION=1.4.7.58 MOGO_SOCKET_VERSION=1.4.7.65
# 数据采集 # 数据采集
MOGO_REALTIME_VERSION=1.4.7.58 MOGO_REALTIME_VERSION=1.4.7.65
# 直播推流 # 直播推流
MOGO_LIVE_VERSION=1.4.7.58 MOGO_LIVE_VERSION=1.4.7.65
# 直播拉流 # 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.4.7.58 MOGO_TRAFFICLIVE_VERSION=1.4.7.65
# 定位服务 # 定位服务
MOGO_LOCATION_VERSION=1.4.7.58 MOGO_LOCATION_VERSION=1.4.7.65
# 远程通讯模块 # 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.7.58 MOGO_TELEMATIC_VERSION=1.4.7.65
# 动态换肤SDK # 动态换肤SDK
MOGO_SKIN_VERSION=1.4.7.50 MOGO_SKIN_VERSION=1.4.7.50
######## MogoAiCloudSDK Version ######## ######## MogoAiCloudSDK Version ########