feat: 修复Sentry上报的BUG
This commit is contained in:
@ -25,6 +25,8 @@ import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
|
||||
import io.reactivex.disposables.Disposable
|
||||
import java.util.*
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
|
||||
class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
StandardGSYVideoPlayer(context, attrs) {
|
||||
@ -49,6 +51,8 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
private var mStartTrackRunnable: Runnable? = null
|
||||
private var mStopTrackRunnable: Runnable? = null
|
||||
|
||||
private val mTrackHandler = Handler(Looper.getMainLooper())
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.layout_article_item_video
|
||||
}
|
||||
@ -265,7 +269,7 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
&& currentState != CURRENT_STATE_PLAYING_BUFFERING_START) {// 上报开始视频播放埋点
|
||||
// 视频停止播放后再恢复播放的间隔时间未超过3秒,则取消上报结束视频播放埋点
|
||||
mStopTrackRunnable?.let { runnable ->
|
||||
handler.removeCallbacks(runnable)
|
||||
mTrackHandler.removeCallbacks(runnable)
|
||||
}
|
||||
|
||||
mVideoEntity?.let {
|
||||
@ -286,7 +290,7 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
mStartTrackRunnable = it
|
||||
}
|
||||
// 埋点要求视频播放3秒后再上报埋点
|
||||
handler.postDelayed(startTrackRunnable, 3000)
|
||||
mTrackHandler.postDelayed(startTrackRunnable, 3000)
|
||||
}
|
||||
} else if (currentState != state
|
||||
&& (state == CURRENT_STATE_AUTO_COMPLETE
|
||||
@ -296,7 +300,7 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
) {// 上报结束视频播放埋点
|
||||
// 从开始播放视频到停止播放视频的间隔时间没有超过3秒,则取消上报开始视频播放埋点
|
||||
this.mStartTrackRunnable?.let {
|
||||
handler.removeCallbacks(it)
|
||||
mTrackHandler.removeCallbacks(it)
|
||||
mStartTrackRunnable = null
|
||||
} ?: let {
|
||||
mVideoEntity?.let {
|
||||
@ -317,7 +321,7 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
this.mStopTrackRunnable = it
|
||||
}
|
||||
// 埋点要求停止视频播放3秒后再上报埋点
|
||||
handler.postDelayed(stopTrackRunnable, 3000)
|
||||
mTrackHandler.postDelayed(stopTrackRunnable, 3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.gh.gamecenter.qa.video.detail
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.AttributeSet
|
||||
import android.view.GestureDetector
|
||||
import android.view.MotionEvent
|
||||
@ -26,7 +28,6 @@ import com.gh.gamecenter.feature.entity.ForumVideoEntity
|
||||
import com.gh.gamecenter.forum.home.ForumScrollCalculatorHelper
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.qa.dialog.MoreFunctionPanelDialog
|
||||
import com.gh.gamecenter.qa.entity.ArticleDetailEntity
|
||||
import com.gh.gamecenter.video.detail.CustomManager
|
||||
import com.lightgame.utils.Utils
|
||||
import com.shuyu.gsyvideoplayer.utils.CommonUtil
|
||||
@ -52,6 +53,8 @@ class ForumTopVideoView @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
private var mStartTrackRunnable: Runnable? = null
|
||||
private var mStopTrackRunnable: Runnable? = null
|
||||
|
||||
private val mTrackHandler = Handler(Looper.getMainLooper())
|
||||
|
||||
init {
|
||||
post {
|
||||
gestureDetector =
|
||||
@ -311,7 +314,7 @@ class ForumTopVideoView @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
&& currentState != CURRENT_STATE_PLAYING_BUFFERING_START) {// 上报开始视频播放埋点
|
||||
// 视频停止播放后再恢复播放的间隔时间未超过3秒,则取消上报结束视频播放埋点
|
||||
mStopTrackRunnable?.let { runnable ->
|
||||
handler.removeCallbacks(runnable)
|
||||
mTrackHandler.removeCallbacks(runnable)
|
||||
}
|
||||
|
||||
mForumVideoEntity?.let {
|
||||
@ -332,7 +335,7 @@ class ForumTopVideoView @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
mStartTrackRunnable = it
|
||||
}
|
||||
// 埋点要求视频播放3秒后再上报埋点
|
||||
handler.postDelayed(startTrackRunnable, 3000)
|
||||
mTrackHandler.postDelayed(startTrackRunnable, 3000)
|
||||
}
|
||||
} else if (currentState != state
|
||||
&& (state == CURRENT_STATE_AUTO_COMPLETE
|
||||
@ -343,7 +346,7 @@ class ForumTopVideoView @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
// 从开始播放视频到停止播放视频的间隔时间没有超过3秒,则取消上报开始视频播放埋点
|
||||
val startTrackRunnable = this.mStartTrackRunnable
|
||||
if (startTrackRunnable != null) {
|
||||
handler.removeCallbacks(startTrackRunnable)
|
||||
mTrackHandler.removeCallbacks(startTrackRunnable)
|
||||
mStartTrackRunnable = null
|
||||
} else {
|
||||
mForumVideoEntity?.let {
|
||||
@ -364,7 +367,7 @@ class ForumTopVideoView @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
this.mStopTrackRunnable = it
|
||||
}
|
||||
// 埋点要求停止视频播放3秒后再上报埋点
|
||||
handler.postDelayed(stopTrackRunnable, 3000)
|
||||
mTrackHandler.postDelayed(stopTrackRunnable, 3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -735,7 +735,7 @@ class SearchGameResultAdapter(
|
||||
"${position + 1}",
|
||||
"])"
|
||||
),
|
||||
location = "搜索-列表:" + gameEntity.name!!,
|
||||
location = "搜索-列表:${gameEntity.name ?: ""}",
|
||||
traceEvent = exposureEvent,
|
||||
clickCallback = {
|
||||
if (adConfig != null) {
|
||||
|
||||
@ -456,7 +456,7 @@ public class HaloApp extends MultiDexApplication {
|
||||
.getInstance()
|
||||
.build(RouteConsts.provider.push)
|
||||
.navigation();
|
||||
pushProvider.initialize(this);
|
||||
if (pushProvider != null) pushProvider.initialize(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -469,12 +469,14 @@ public class HaloApp extends MultiDexApplication {
|
||||
.build(RouteConsts.provider.push)
|
||||
.navigation();
|
||||
|
||||
if (pushProvider == null) return;
|
||||
|
||||
// 绑定账号
|
||||
Single<String> bindAccountSingle = pushProvider.bindAccount(getOAID());
|
||||
|
||||
// 绑定标签
|
||||
Single<String> bindTagSingle = pushProvider.bindTag(mChannel)
|
||||
.subscribeOn(Schedulers.io());
|
||||
Single<String> bindTagSingle = !TextUtils.isEmpty(mChannel)
|
||||
? pushProvider.bindTag(mChannel).subscribeOn(Schedulers.io()) : null;
|
||||
|
||||
// 初始化推送
|
||||
pushProvider
|
||||
@ -482,8 +484,13 @@ public class HaloApp extends MultiDexApplication {
|
||||
.flatMap((response) -> {
|
||||
// 绑定别名、标签和账号任意一个流程失败,都不会影响其他流程的执行
|
||||
Single<String> single = bindAccountSingle
|
||||
.onErrorReturn((e) -> response)
|
||||
.zipWith(bindTagSingle.onErrorReturn((e) -> response), (s1, s2) -> response);
|
||||
.onErrorReturn((e) -> response);
|
||||
|
||||
if (bindTagSingle != null) {
|
||||
single = single
|
||||
.zipWith(bindTagSingle.onErrorReturn((e) -> response), (s1, s2) -> response);
|
||||
}
|
||||
|
||||
if (UserManager.getInstance().isLoggedIn()) {
|
||||
String userId = UserManager.getInstance().getUserId();
|
||||
// 绑定别名
|
||||
|
||||
Reference in New Issue
Block a user