fix: 捕抓磁盘已满时下载广告插件造成的闪退 https://sentry.shanqu.cc/organizations/lightgame/issues/418801/

This commit is contained in:
chenjuntao
2024-12-02 11:17:02 +08:00
parent 3b8b60bc6b
commit ecd4610186

View File

@ -2,6 +2,7 @@ package com.gh.download.simple
import android.annotation.SuppressLint
import android.database.sqlite.SQLiteException
import android.database.sqlite.SQLiteFullException
import com.gh.gamecenter.core.utils.ToastUtils
import com.lg.download.*
import com.lg.download.listener.InnerDownloadListener
@ -264,8 +265,15 @@ object DownloadMessageHandler : InnerDownloadListener {
}
fun insertDownloadToDatabase(downloadEntity: SimpleDownloadEntity) {
mDownloadDao.insertDownloadEntity(downloadEntity)
updateDownloadList()
try {
mDownloadDao.insertDownloadEntity(downloadEntity)
updateDownloadList()
} catch (e: SQLiteException) {
if (e is SQLiteFullException) {
ToastUtils.showToast("磁盘已满,请清理空间后获得更好的体验")
}
e.printStackTrace()
}
}
fun updateDownloadToDatabase(