Merge branch 'master' into dev_arch_opt_3.0

# Conflicts:
#	core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainMoGoApplication.java
This commit is contained in:
donghongyu
2023-01-16 11:43:46 +08:00
4 changed files with 85 additions and 31 deletions

View File

@@ -9,9 +9,11 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager
import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb
import com.mogo.eagle.core.function.msgbox.db.MsgBoxInfo
import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
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
@@ -139,7 +141,11 @@ object DataManager {
fun queryAllMessages(context: Context) {
scope.launch {
initCache()
getCacheMessages(context)
try {
getCacheMessages(context)
} catch (e: Exception) {
CallerLogger.e("DataManager", e.message)
}
}
}
@@ -156,6 +162,7 @@ object DataManager {
}
private suspend fun getCacheMessages(context: Context): List<MsgBoxBean> = withContext(Dispatchers.IO) {
delay(2000)
return@withContext MsgBoxDb.getDb(context)
.monitorDao()
.getAllCachedMessages()