[650]feat: 通用事件弹框,增加日志打印和相关埋点;
This commit is contained in:
@@ -11,6 +11,7 @@ import androidx.core.content.ContextCompat
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.business.roadcross.net.NDERoadV2NModel
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.function.hmi.ui.v2n.RoadV2NEventWindowView.Companion.trackEvent
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
@@ -113,23 +114,26 @@ class RoadV2NEventLivePlayView @JvmOverloads constructor(
|
||||
/**
|
||||
* 开始查询拉流url
|
||||
*/
|
||||
fun startRoadCameraLive(
|
||||
fun startRoadCameraLive(eventId:String,
|
||||
cameraId: String, lon: Double, lat: Double, cityCode: String
|
||||
) {
|
||||
CallerLogger.i(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"startRoadCameraLive, cameraId=$cameraId, lon=$lon, lat=$lat"
|
||||
"startRoadCameraLive, eventId=$eventId, cameraId=$cameraId, lon=$lon, lat=$lat, cityCode=$cityCode"
|
||||
)
|
||||
trackEvent("startRoadCameraLive --> eventId=$eventId, cameraId=$cameraId, lon=$lon, lat=$lat, cityCode=$cityCode")
|
||||
startLoading()
|
||||
NDERoadV2NModel.ndeRoadV2NModel.querySingleCameraLiveByCameraIp(cameraId, lon, lat, cityCode,
|
||||
onSuccess = {
|
||||
startPlay(it?.liveUrl)
|
||||
trackEvent("startRoadCameraLive --> success, eventId=$eventId, liveUrl=${it?.liveUrl}")
|
||||
},
|
||||
onError = {
|
||||
CallerLogger.e(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"查询视频播放地址error, msg=$it"
|
||||
)
|
||||
trackEvent("startRoadCameraLive --> error, eventId=$eventId, msg=$it")
|
||||
stopLoading()
|
||||
showPlayFail()
|
||||
|
||||
@@ -147,6 +151,7 @@ class RoadV2NEventLivePlayView @JvmOverloads constructor(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"stopRoadCameraLive"
|
||||
)
|
||||
trackEvent("stopRoadCameraLive --> ")
|
||||
stopLoading()
|
||||
try {
|
||||
svpPlayer?.gsyVideoManager?.stop()
|
||||
@@ -156,15 +161,18 @@ class RoadV2NEventLivePlayView @JvmOverloads constructor(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"onDetachedFromWindow, e=${e.message}"
|
||||
)
|
||||
trackEvent("stopRoadCameraLive --> e=${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
private fun startPlay(flvUrl: String?) {
|
||||
trackEvent("startPlay --> flvUrl=${flvUrl}")
|
||||
if (TextUtils.isEmpty(flvUrl)) {
|
||||
CallerLogger.e(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"播放视频数据异常, flvUrl=${flvUrl}"
|
||||
)
|
||||
trackEvent("startPlay --> 播放视频数据异常, flvUrl=${flvUrl}")
|
||||
stopLoading()
|
||||
showPlayFail()
|
||||
return
|
||||
@@ -173,6 +181,7 @@ class RoadV2NEventLivePlayView @JvmOverloads constructor(
|
||||
"${SceneConstant.M_HMI}$TAG",
|
||||
"开始加载视频, flvUrl=${flvUrl}"
|
||||
)
|
||||
trackEvent("startPlay --> 开始加载视频, flvUrl=${flvUrl}")
|
||||
flvUrl?.also {
|
||||
startLoadVideo(it)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.v2x.RoadV2NEventWindowBean
|
||||
@@ -27,6 +30,8 @@ import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.ivV2XI
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.roundRoadV2NEventContainer
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.tvV2XHintContent
|
||||
import kotlinx.android.synthetic.main.hmi_view_road_v2n_event_window.view.tvV2XTimeStr
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import java.util.UUID
|
||||
|
||||
@@ -41,6 +46,18 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
|
||||
companion object {
|
||||
const val TAG = "RoadV2NEventWindowView"
|
||||
const val ANALYTICS_KEY = "hmi_road_event_window_view"
|
||||
|
||||
public fun trackEvent(msg: String) {
|
||||
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.IO) {
|
||||
val map: MutableMap<String, Any> = HashMap()
|
||||
map["msg"] = msg
|
||||
MogoAnalyticUtils.track(
|
||||
ANALYTICS_KEY,
|
||||
map
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val isPassengerScreen by lazy {
|
||||
@@ -265,8 +282,9 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun show(dataBean: RoadV2NEventWindowBean) {
|
||||
trackEvent("show --> ${dataBean.toString()}")
|
||||
UiThreadHandler.post {
|
||||
currentEventUUID = dataBean.uuid
|
||||
currentEventUUID = dataBean.eventId
|
||||
ivV2XImage.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
@@ -280,19 +298,25 @@ class RoadV2NEventWindowView @JvmOverloads constructor(
|
||||
AIAssist.getInstance(context)
|
||||
.speakTTSVoiceWithLevel(dataBean.hintStr, AIAssist.LEVEL0)
|
||||
}
|
||||
val cityCode = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().cityCode
|
||||
containerLivePlay.startRoadCameraLive(
|
||||
dataBean.cameraIp, dataBean.lon, dataBean.lat, cityCode)
|
||||
val cityCode =
|
||||
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().cityCode
|
||||
containerLivePlay.startRoadCameraLive(dataBean.eventId,
|
||||
dataBean.cameraIp, dataBean.lon, dataBean.lat, cityCode
|
||||
)
|
||||
visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
override fun dismiss(eventId: String) {
|
||||
trackEvent("dismiss --> eventId=${eventId}")
|
||||
UiThreadHandler.post {
|
||||
if (eventId == currentEventUUID) {
|
||||
visibility = View.GONE
|
||||
currentEventUUID = ""
|
||||
containerLivePlay.stopRoadCameraLive()
|
||||
trackEvent("dismiss --> eventId=${eventId}, 执行dismiss")
|
||||
} else {
|
||||
trackEvent("dismiss --> eventId=${eventId}, 跳过dismiss")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user