[2.13.0][fix]添加查询消息盒子历史数据

This commit is contained in:
chenfufeng
2022-12-01 11:52:52 +08:00
parent 3cd125dbb6
commit 79e4767cc0
10 changed files with 45 additions and 3 deletions

View File

@@ -138,10 +138,23 @@ object DataManager {
*/
fun queryAllMessages(context: Context) {
scope.launch {
initCache()
getCacheMessages(context)
}
}
private fun initCache() {
if (cacheNotifyList.isNotEmpty()) {
cacheNotifyList.clear()
}
if (cacheRecordList.isNotEmpty()) {
cacheRecordList.clear()
}
if (cacheSysInfoList.isNotEmpty()) {
cacheSysInfoList.clear()
}
}
private suspend fun getCacheMessages(context: Context): List<MsgBoxBean> = withContext(Dispatchers.IO) {
return@withContext MsgBoxDb.getDb(context)
.monitorDao()

View File

@@ -26,6 +26,10 @@ class MsgBoxProvider : IMsgBoxProvider {
}.start()
}
override fun queryAllMessages(context: Context) {
DataManager.queryAllMessages(context)
}
override fun saveMsg(bean: MsgBoxBean) {
DataManager.saveMsg(bean)
}