From f449a41257590e70b1b693e365ff2d634f24dd67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E7=A5=A5=E4=BF=8A?= Date: Mon, 1 Apr 2024 11:15:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8DSentry=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../forum/home/ArticleItemVideoView.kt | 12 ++++++++---- .../qa/video/detail/ForumTopVideoView.kt | 13 ++++++++----- .../search/SearchGameResultAdapter.kt | 2 +- .../main/java/com/halo/assistant/HaloApp.java | 17 ++++++++++++----- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/ArticleItemVideoView.kt b/app/src/main/java/com/gh/gamecenter/forum/home/ArticleItemVideoView.kt index eb674d49fe..17fc75f646 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/ArticleItemVideoView.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/ArticleItemVideoView.kt @@ -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) } } } diff --git a/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumTopVideoView.kt b/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumTopVideoView.kt index 33ed8265ae..d19281dee7 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumTopVideoView.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/video/detail/ForumTopVideoView.kt @@ -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) } } } diff --git a/app/src/main/java/com/gh/gamecenter/search/SearchGameResultAdapter.kt b/app/src/main/java/com/gh/gamecenter/search/SearchGameResultAdapter.kt index 0d9a2b28ad..d71f384b0c 100644 --- a/app/src/main/java/com/gh/gamecenter/search/SearchGameResultAdapter.kt +++ b/app/src/main/java/com/gh/gamecenter/search/SearchGameResultAdapter.kt @@ -735,7 +735,7 @@ class SearchGameResultAdapter( "${position + 1}", "])" ), - location = "搜索-列表:" + gameEntity.name!!, + location = "搜索-列表:${gameEntity.name ?: ""}", traceEvent = exposureEvent, clickCallback = { if (adConfig != null) { diff --git a/app/src/main/java/com/halo/assistant/HaloApp.java b/app/src/main/java/com/halo/assistant/HaloApp.java index 441daffbbd..f0b32244f8 100644 --- a/app/src/main/java/com/halo/assistant/HaloApp.java +++ b/app/src/main/java/com/halo/assistant/HaloApp.java @@ -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 bindAccountSingle = pushProvider.bindAccount(getOAID()); // 绑定标签 - Single bindTagSingle = pushProvider.bindTag(mChannel) - .subscribeOn(Schedulers.io()); + Single bindTagSingle = !TextUtils.isEmpty(mChannel) + ? pushProvider.bindTag(mChannel).subscribeOn(Schedulers.io()) : null; // 初始化推送 pushProvider @@ -482,8 +484,13 @@ public class HaloApp extends MultiDexApplication { .flatMap((response) -> { // 绑定别名、标签和账号任意一个流程失败,都不会影响其他流程的执行 Single 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(); // 绑定别名