[2.15.0] debug setting view bug

This commit is contained in:
zhongchao
2023-03-16 19:16:08 +08:00
parent ca37198966
commit fe2d3c47c8
4 changed files with 26 additions and 9 deletions

View File

@@ -24,7 +24,7 @@ class MoGoTelematicProvider: IMogoTelematicProvider {
return NSDNettyManager.getInstance().connServerIp
}
override fun getServerToken(): String {
override fun getServerToken(): String? {
return NSDNettyManager.getInstance().serverSn
}

View File

@@ -181,11 +181,20 @@ internal class DebugSettingView @JvmOverloads constructor(
initView()
}
@Volatile
private var isRunCheck = true
/**
* 定时刷新视图数据防止因为过快更新导致anr异常
*/
private val timerTaskRefresh = object : TimerTask() {
override fun run() {
if(this@DebugSettingView == null){
return
}
if(!isRunCheck){
return
}
UiThreadHandler.post {
// 绘制应用基本信息
drawAppInfo()
@@ -226,6 +235,7 @@ internal class DebugSettingView @JvmOverloads constructor(
logInfoView!!.onEnterForeground()
}
// 开启定时查询速度
isRunCheck = true
Timer().schedule(timerTaskRefresh, Date(), 300)
if (AppConfigInfo.isConnectAutopilot && (AppConfigInfo.plateNumber.isNullOrEmpty() || AppConfigInfo.iPCMacAddress.isNullOrEmpty())) {
//查询工控机基础配置信息
@@ -273,6 +283,7 @@ internal class DebugSettingView @JvmOverloads constructor(
logInfoView!!.onEnterBackground()
}
try {
isRunCheck = false
timerTaskRefresh.cancel()
} catch (e: Exception) {
e.printStackTrace()
@@ -1517,7 +1528,7 @@ internal class DebugSettingView @JvmOverloads constructor(
"移动数据"
} else {
//WiFi
CommonUtils.getWifiName(context)
CommonUtils.getWifiName(context)?:""
}
} else {
@@ -1557,7 +1568,7 @@ internal class DebugSettingView @JvmOverloads constructor(
else -> {
"乘客端${
when {
AppConfigInfo.serverSn.isNotEmpty() -> "(司机屏SN是:${AppConfigInfo.serverSn})"
!AppConfigInfo.serverSn.isNullOrEmpty() -> "(司机屏SN是:${AppConfigInfo.serverSn?:""})"
else -> ""
}
}连接"
@@ -1593,10 +1604,12 @@ internal class DebugSettingView @JvmOverloads constructor(
}"
)
val autopilotJson = GsonUtils.toJson(mAutoPilotStatusInfo)
tvAutopilotInfo.text = autopilotJson
tvIpcInfo.text = autopilotJson
tvIpcInfoKey.text = autopilotJson
mAutoPilotStatusInfo?.let {
val autopilotJson = GsonUtils.toJson(it)
tvAutopilotInfo.text = autopilotJson
tvIpcInfo.text = autopilotJson
tvIpcInfoKey.text = autopilotJson
}
tvCmdbCarInfoContent.text = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO)?:""
tvCarInfo.text =

View File

@@ -9,7 +9,7 @@ interface IMogoTelematicProvider: IProvider {
fun getServerIp(): String
fun getServerToken(): String
fun getServerToken(): String?
fun sendMsgToAllClients(type: Int, byteArray: ByteArray)

View File

@@ -32,7 +32,11 @@ object CallerTelematicManager {
}
fun getServerToken(): String {
return providerApi?.getServerToken() ?: ""
providerApi?.let {
return it.getServerToken()?:""
}.also{
return ""
}
}
/**