ShamrockPrivate: 尝试修复自发消息异常闪退

Signed-off-by: WhiteChi <whitechi73@outlook.com>
This commit is contained in:
WhiteChi 2023-11-02 18:44:02 +08:00
parent dc2503b045
commit 41675ed874
2 changed files with 4 additions and 1 deletions

View File

@ -56,9 +56,10 @@ internal object MsgSvc: BaseSvc() {
qqMsgId: Long
): Result<MsgRecord> {
val contact = MessageHelper.generateContact(chatType, peerId)
val service = QRoute.api(IMsgService::class.java) ?:
return Result.failure(Exception("获取消息服务"))
val msg = withTimeoutOrNull(5000) {
val service = QRoute.api(IMsgService::class.java)
suspendCancellableCoroutine { continuation ->
service.getMsgsByMsgId(contact, arrayListOf(qqMsgId)) { code, _, msgRecords ->
if (code == 0 && msgRecords.isNotEmpty()) {

View File

@ -117,6 +117,8 @@ internal object AioListener: IKernelMsgListener {
} else if (record.sendStatus == MsgConstant.KSENDSTATUSFAILED) {
it.resume(null)
}
}.onFailure { _ ->
it.resume(null)
}
delay(50)
}