[6.3.0] fix cert null bug and add func of request cert file

This commit is contained in:
EmArrow
2024-03-13 18:30:44 +08:00
parent 86a8509237
commit 52daec6775
5 changed files with 38 additions and 7 deletions

View File

@@ -83,6 +83,9 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.permissions.BackgrounderPermission
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.call.cloud.CallerCloudCertManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.map.MogoData.Companion.mogoMapData
@@ -131,7 +134,7 @@ internal class DebugSettingView @JvmOverloads constructor(
IMoGoChassisThrottleStateListener,
IMoGoSweeperFutianCleanSystemListener,
IMoGoObuInfoListener,
ISopSettingListener, IViewControlListener {
ISopSettingListener, IViewControlListener, IMoGoCloudListener {
private val TAG = "DebugSettingView"
@@ -219,6 +222,8 @@ internal class DebugSettingView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
// 添加证书 监听
CallerCloudListenerManager.addListener(TAG, this)
// 添加 OBU状态 监听
CallerObuConnectListenerManager.addListener(TAG, this)
// 添加 ADAS状态 监听
@@ -264,6 +269,8 @@ internal class DebugSettingView @JvmOverloads constructor(
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// 移除 证书 监听
CallerCloudListenerManager.removeListener(TAG)
// 移除 OBU状态 监听
CallerObuConnectListenerManager.removeListener(TAG)
// 移除 ADAS状态 监听
@@ -292,6 +299,7 @@ internal class DebugSettingView @JvmOverloads constructor(
//雨天、美化、点云设置同步
CallerSopSettingManager.removeListener(TAG)
// 移除 业务配置监听
CallerDevaToolsFuncConfigListenerManager.unRegisterDevaToolsFuncConfigListener(
FuncBizConfig.FOUNDATION,
@@ -1261,12 +1269,28 @@ internal class DebugSettingView @JvmOverloads constructor(
}
}
//是否启用证书认证
cbSsl.isChecked = SharedPrefsMgr.getInstance().getBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION,false)
cbSsl.isChecked = !CallerCloudCertManager.getRootCrtF().isNullOrEmpty()
cbSsl.setOnCheckedChangeListener { _, isChecked ->
SharedPrefsMgr.getInstance().putBoolean(MoGoConfig.AUTOPILOT_CERTIFICATION,isChecked)
if(isChecked){
if(!CallerCloudCertManager.getRootCrtF().isNullOrEmpty()){
cbSsl.isChecked = true
}else{
CallerCloudCertManager.certFileDownLoad{ errorMsg ->
ToastUtils.showShort(errorMsg)
cbSsl.isChecked = false
}
}
}else{
cbSsl.isChecked = false
}
}
}
override fun authCrtFile(device: String, root: String) {
super.authCrtFile(device, root)
cbSsl.isChecked = true
}
/**
* 设置Hmi点击监听
*/

View File

@@ -105,10 +105,10 @@ class CertFileManager : IMoGoCertProvider {
}
override fun getDeviceCrtF(): String? {
return deviceCrtFile?:SharedPrefsMgr.getInstance().getString(securityKeyTAG, "")
return deviceCrtFile?:SharedPrefsMgr.getInstance().getString(securityKeyTAG, null)
}
override fun getRootCrtF(): String? {
return rootCrtFile?:SharedPrefsMgr.getInstance().getString(securityRootTAG, "")
return rootCrtFile?:SharedPrefsMgr.getInstance().getString(securityRootTAG, null)
}
}