diff --git a/app/src/main/java/com/gh/common/videolog/VideoRecordUtils.kt b/app/src/main/java/com/gh/common/videolog/VideoRecordUtils.kt index a82dfc46a8..a1d24f00a6 100644 --- a/app/src/main/java/com/gh/common/videolog/VideoRecordUtils.kt +++ b/app/src/main/java/com/gh/common/videolog/VideoRecordUtils.kt @@ -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("数据库/磁盘已满,删除视频日志失败") + } } }