Merge branch 'hotfix-v4.5.4-254-database' into 'release'

捕抓视频日志数据库满了的时候的异常

See merge request halo/assistant-android!71
This commit is contained in:
juntao
2021-01-08 10:04:22 +08:00

View File

@ -2,7 +2,9 @@ package com.gh.common.videolog
import android.annotation.SuppressLint
import android.app.Application
import android.database.sqlite.SQLiteFullException
import com.gh.common.util.toRequestBody
import com.gh.common.util.toastInInternalRelease
import com.gh.gamecenter.manager.UserManager
import com.gh.gamecenter.retrofit.BiResponse
import com.gh.gamecenter.retrofit.RetrofitManager
@ -26,8 +28,13 @@ object VideoRecordUtils {
mApplication = application
videoRecordExecutor.execute {
val recordList = videoRecordDao.getAll()
videoRecordSet.addAll(recordList)
try {
val recordList = videoRecordDao.getAll()
videoRecordSet.addAll(recordList)
} catch (e: SQLiteFullException) {
e.printStackTrace()
toastInInternalRelease("数据库/磁盘已满,写入视频新日志失败")
}
}
}
@ -39,6 +46,9 @@ object VideoRecordUtils {
videoRecordDao.insert(entity)
} catch (e: Exception) {
e.printStackTrace()
if (e is SQLiteFullException) {
toastInInternalRelease("数据库/磁盘已满,写入视频新日志失败")
}
}
if (videoRecordSet.size >= STORE_SIZE) {
commitVideoRecord()
@ -52,7 +62,11 @@ object VideoRecordUtils {
uploadVideoRecord()
val exposureList = videoRecordSet.toList()
videoRecordSet.removeAll(exposureList)
videoRecordDao.deleteMany(exposureList)
try {
videoRecordDao.deleteMany(exposureList)
} catch (e: SQLiteFullException) {
toastInInternalRelease("数据库/磁盘已满,删除视频日志失败")
}
}
}