Merge branch 'fix/catch_add_channel_exception' into 'dev'

feat: 包裹为 APK 写入渠道内容时的错误

See merge request halo/android/assistant-android!1579
This commit is contained in:
陈君陶
2024-03-20 14:20:35 +08:00

View File

@ -11,6 +11,7 @@ import com.gh.download.DownloadManager
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.utils.SentryHelper
import com.gh.gamecenter.core.utils.ToastUtils
import com.halo.assistant.HaloApp
import com.lg.download.DownloadError
@ -260,11 +261,15 @@ object NDownloadBridge : InnerDownloadListener, IErrorRetryHandler {
// 为下载好的 mod 游戏添加 OAID格式为 "o|oaid"
if (downloadEntity.getMetaExtra(Constants.EXTRA_IS_MODDED_GAME) == "true") {
ChannelWriter.addChannelByV2(
File(downloadEntity.path),
"o|${HaloApp.getInstance().oaid}",
true
)
try {
ChannelWriter.addChannelByV2(
File(downloadEntity.path),
"o|${HaloApp.getInstance().oaid}",
true
)
} catch (e: Exception) {
SentryHelper.onEvent("ADD_CHANNEL_FAILED", "error_digest", e.localizedMessage)
}
}