[v2.13.2][Fix]解决Room崩溃问题

This commit is contained in:
chenfufeng
2023-01-10 19:25:21 +08:00
parent 79ff37d90d
commit 3e3b64f1c8
2 changed files with 11 additions and 7 deletions

View File

@@ -12,6 +12,7 @@ import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.Utils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -156,6 +157,7 @@ object DataManager {
}
private suspend fun getCacheMessages(context: Context): List<MsgBoxBean> = withContext(Dispatchers.IO) {
delay(2000)
return@withContext MsgBoxDb.getDb(context)
.monitorDao()
.getAllCachedMessages()