[6.4.0] add func of auth cert show

This commit is contained in:
EmArrow
2024-04-08 16:30:05 +08:00
parent afd44e9da7
commit 4e35d90a57
16 changed files with 217 additions and 71 deletions

View File

@@ -8,13 +8,20 @@ import android.content.IntentFilter
import android.location.LocationManager
import android.util.Log
import androidx.core.location.LocationManagerCompat
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.cloud.IMoGoCloudListener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.telematic.IConnectStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicStatusListenerManager
import com.mogo.eagle.core.utilcode.util.AppStateManager
@@ -30,7 +37,8 @@ import java.util.concurrent.atomic.AtomicBoolean
internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
IMoGoDevaToolsListener, IMoGoAutopilotStatusListener,
IConnectStatusListener, IMogoStatusChangedListener {
IConnectStatusListener, IMogoStatusChangedListener, IMoGoAutopilotCarConfigListener,
IMoGoCloudListener {
companion object {
const val TAG = "OverViewImpl"
@@ -56,6 +64,9 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
@Volatile
private var isAutopilotException = false
@Volatile
private var isAuthCrtException = false
@Volatile
private var isFirst = true
@@ -125,6 +136,8 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
MogoStatusManager.getInstance()
.registerStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
CallerCloudListenerManager.addListener(TAG, this)
val isGranted = checkIsGpsException()
if (!isGranted) {
@@ -268,11 +281,41 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
}
private fun checkIfNotException() {
if (!isServerException && !isCloudSocketException && !isTracingException && !isGpsException && !isAutopilotException) {
if (!isServerException && !isCloudSocketException && !isTracingException && !isGpsException && !isAutopilotException && !isAuthCrtException) {
send(OverViewStatus(false))
}
}
override fun authCrtFile(device: String, root: String) {
super.authCrtFile(device, root)
isAuthCrtException = false
checkIfNotException()
}
override fun authCrtError(errorMsg: String) {
super.authCrtError(errorMsg)
isAuthCrtException = true
send(OverViewStatus(true))
}
override fun onCertificationResult(msg: String) {
super.onCertificationResult(msg)
if (!SharedPrefsMgr.getInstance().getBoolean(
"${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}",
MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE
)
) {
return
}
if(msg.contains("成功校验")){
isAuthCrtException = false
checkIfNotException()
}else{
isAuthCrtException = true
send(OverViewStatus(true))
}
}
override fun onDestroy() {
super.onDestroy()
// CallerDevaToolsListenerManager.removeListener(TAG)
@@ -280,6 +323,9 @@ internal class OverViewImpl(ctx: Context) : IFlow<OverViewStatus>(ctx),
MogoStatusManager.getInstance()
.unregisterStatusChangedListener(TAG, StatusDescriptor.CLOUD_SOCKET, this)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
CallerCloudListenerManager.removeListener(TAG)
try {
if (registered.compareAndSet(true, false) && receiver != null) {
ctx.unregisterReceiver(receiver)

View File

@@ -1,34 +0,0 @@
package com.zhjt.mogo_core_function_devatools.status.ui
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.zhjt.mogo_core_function_devatools.R
/**
* 状态汇总View控件
*/
class StatusSummaryView@JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(
context,
attrs,
defStyleAttr
), IMoGoAutopilotStatusListener {
companion object{
private const val TAG = "SummaryStatusView"
}
init {
LayoutInflater.from(context).inflate(R.layout.view_initiative_bad_case, this, true)
initView()
}
private fun initView() {
}
}