[2.13.0][fix]添加查询消息盒子历史数据
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -26,6 +26,10 @@ class MsgBoxProvider : IMsgBoxProvider {
|
||||
}.start()
|
||||
}
|
||||
|
||||
override fun queryAllMessages(context: Context) {
|
||||
DataManager.queryAllMessages(context)
|
||||
}
|
||||
|
||||
override fun saveMsg(bean: MsgBoxBean) {
|
||||
DataManager.saveMsg(bean)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user