[common]
[自驾埋点 Rx 改为 handle]
This commit is contained in:
yangyakun
2024-08-29 18:18:49 +08:00
parent 9a26b4badc
commit ea9258561e

View File

@@ -12,6 +12,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.utils.RxUtils
import io.reactivex.disposables.Disposable
@@ -55,6 +56,9 @@ abstract class OchAutopilotAnalytics {
MogoAnalyticUtils.track(EVENT_KEY_START_AUTOPILOT_PARAMETERS, params)
}
/**
* 底盘收到启动自驾的ack
*/
fun triggerStartAutopilotParametersAck(data:String,isSuccess:Boolean){
val params = HashMap<String, Any>()
params[EVENT_PARAM_ENV_ONLINE] = DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE
@@ -65,6 +69,9 @@ abstract class OchAutopilotAnalytics {
MogoAnalyticUtils.track(EVENT_KEY_START_AUTOPILOT_ACK, params)
}
/**
* 启动自驾判断距离
*/
fun triggerDistance2LineorStation(info: String){
val map = hashMapOf<String, Any>()
map[EVENT_PARAM_AUTOPILOTANALYTICS_GROUP] = EVENT_PARAM_AUTOPILOTANALYTICS_GROUP
@@ -79,10 +86,14 @@ abstract class OchAutopilotAnalytics {
private var mStartAutopilotKey: String? = null
private val mStartAutopilotParams = HashMap<String, Any>()
private var startAutopiloTimeOut: Disposable? = null
private val timeOutRunnable = Runnable {
// 15s内未开启上报失败埋点
triggerStartAutopilotFailureEvent("", "15s后app等待超时", System.currentTimeMillis())
}
fun triggerStartAutopilotFailureEventByAdas(failCode: String, failMsg: String, startFailDate: Long) {
RxUtils.disposeSubscribe(startAutopiloTimeOut)
BizLoopManager.removeCallback(timeOutRunnable)
triggerStartAutopilotFailureEvent(failCode, failMsg, startFailDate)
}
@@ -126,7 +137,7 @@ abstract class OchAutopilotAnalytics {
mStartAutopilotKey = if (restart) getEventKeyRestartService() else getEventKeyStartService()
if (send) {
if (mStartAutopilotParams.isEmpty()) return
RxUtils.disposeSubscribe(startAutopiloTimeOut)
BizLoopManager.removeCallback(timeOutRunnable)
// 开启成功,上报埋点
mStartAutopilotParams[EVENT_PARAM_START_FAILURE_CODE] = ""
mStartAutopilotParams[EVENT_PARAM_START_FAILURE_MSG] = ""
@@ -145,10 +156,8 @@ abstract class OchAutopilotAnalytics {
mStartAutopilotParams[EVENT_PARAM_END_NAME] = endName
mStartAutopilotParams[EVENT_PARAM_LINE_ID] = lineId
mStartAutopilotParams[EVENT_PARAM_ORDER_NUMBER] = orderId?:""
startAutopiloTimeOut = RxUtils.createSubscribeOnOwnThread(LOOP_PERIOD_15S) {
// 15s内未开启上报失败埋点
triggerStartAutopilotFailureEvent("", "15s后app等待超时", System.currentTimeMillis())
}
BizLoopManager.removeCallback(timeOutRunnable)
BizLoopManager.postDelayed(timeOutRunnable,LOOP_PERIOD_15S)
}
}
@@ -192,7 +201,6 @@ abstract class OchAutopilotAnalytics {
* 用户点击启动自驾的时间
*/
fun triggerClickStartAutopilotTime(triggerDate: Long) {
val plateNum = AppConfigInfo.plateNumber
val params = HashMap<String, Any>()
params[EVENT_PARAM_ENV_ONLINE] = DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE
params[EVENT_PARAM_CLICK_TIME] = DateTimeUtils.getTimeText(triggerDate,DateTimeUtils.yyyy_MM_dd_HH_mm_ss_SSS)