update 主循环自动继续

This commit is contained in:
gallonyin
2023-06-26 18:26:37 +08:00
parent bb947c774a
commit bc7cc50294
2 changed files with 6 additions and 5 deletions

View File

@@ -107,9 +107,10 @@ object MyLooper {
} else { } else {
WeworkController.mainLoopRunning = false WeworkController.mainLoopRunning = false
LogUtils.v("加入指令到执行队列", if (message.fileBase64.isNullOrEmpty()) GsonUtils.toJson(message) else message.type) LogUtils.v("加入指令到执行队列", if (message.fileBase64.isNullOrEmpty()) GsonUtils.toJson(message) else message.type)
getInstance().removeMessages(message.type * message.hashCode() + (System.currentTimeMillis() / 10000).toInt()) val messageWhat = message.type * message.hashCode() + (System.currentTimeMillis() / 10000).toInt()
getInstance().removeMessages(messageWhat)
getInstance().sendMessage(Message.obtain().apply { getInstance().sendMessage(Message.obtain().apply {
what = message.type * message.hashCode() + (System.currentTimeMillis() / 10000).toInt() what = messageWhat
obj = message.apply { obj = message.apply {
messageId = messageList.messageId messageId = messageList.messageId
apiSend = messageList.apiSend apiSend = messageList.apiSend

View File

@@ -55,10 +55,10 @@ object WeworkLoopImpl {
sleep(300) sleep(300)
} }
} catch (e: Exception) { } catch (e: Exception) {
mainLoopRunning = false
LogUtils.e("ERROR mainLoop: " + e.message, e) LogUtils.e("ERROR mainLoop: " + e.message, e)
error("ERROR mainLoop: $e") error("ERROR mainLoop: $e")
sleep(Constant.LONG_INTERVAL) sleep(Constant.LONG_INTERVAL)
MyLooper.getInstance().removeMessages(WeworkMessageBean.LOOP_RECEIVE_NEW_MESSAGE)
MyLooper.getInstance().sendMessage(Message.obtain().apply { MyLooper.getInstance().sendMessage(Message.obtain().apply {
what = WeworkMessageBean.LOOP_RECEIVE_NEW_MESSAGE what = WeworkMessageBean.LOOP_RECEIVE_NEW_MESSAGE
obj = WeworkMessageBean().apply { type = WeworkMessageBean.LOOP_RECEIVE_NEW_MESSAGE } obj = WeworkMessageBean().apply { type = WeworkMessageBean.LOOP_RECEIVE_NEW_MESSAGE }
@@ -526,10 +526,10 @@ object WeworkLoopImpl {
if (spotNodeList.size > 0) { if (spotNodeList.size > 0) {
LogUtils.i("发现未读消息: " + spotNodeList.size + "") LogUtils.i("发现未读消息: " + spotNodeList.size + "")
log("发现未读消息: " + spotNodeList.size + "") log("发现未读消息: " + spotNodeList.size + "")
if (AccessibilityUtil.performClick(spotNodeList.first())) { if (AccessibilityUtil.performClick(spotNodeList.firstOrNull())) {
//进入聊天页 下一步 getChatMessageList //进入聊天页 下一步 getChatMessageList
} else { } else {
AccessibilityUtil.clickByNode(WeworkController.weworkService, spotNodeList.first().parent) AccessibilityUtil.clickByNode(WeworkController.weworkService, spotNodeList.firstOrNull()?.parent)
} }
return true return true
} else { } else {