update 优化消息双重校验
This commit is contained in:
@@ -116,17 +116,39 @@ object WeworkLoopImpl {
|
|||||||
val title = titleList.joinToString()
|
val title = titleList.joinToString()
|
||||||
LogUtils.v("聊天: $title")
|
LogUtils.v("聊天: $title")
|
||||||
log("聊天: $title")
|
log("聊天: $title")
|
||||||
//聊天消息列表 1ListView 0RecycleView xViewGroup
|
val messageList = arrayListOf<WeworkMessageBean.SubMessageBean>()
|
||||||
val list = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView)
|
val messageList2 = arrayListOf<WeworkMessageBean.SubMessageBean>()
|
||||||
if (list != null) {
|
do {
|
||||||
LogUtils.v("消息条数: " + list.childCount)
|
messageList.clear()
|
||||||
val messageList = arrayListOf<WeworkMessageBean.SubMessageBean>()
|
messageList2.clear()
|
||||||
for (i in 0 until list.childCount) {
|
//聊天消息列表 1ListView 0RecycleView xViewGroup
|
||||||
val item = list.getChild(i)
|
val list = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView)
|
||||||
if (item != null && item.childCount > 0) {
|
if (list != null) {
|
||||||
messageList.add(parseChatMessageItem(item, roomType))
|
LogUtils.v("消息条数: " + list.childCount)
|
||||||
|
for (i in 0 until list.childCount) {
|
||||||
|
val item = list.getChild(i)
|
||||||
|
if (item != null && item.childCount > 0) {
|
||||||
|
messageList.add(parseChatMessageItem(item, roomType))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sleep(Constant.POP_WINDOW_INTERVAL / 5)
|
||||||
|
LogUtils.v("双重校验聊天列表")
|
||||||
|
val list2 = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView)
|
||||||
|
if (list2 != null) {
|
||||||
|
LogUtils.v("list2消息条数: " + list2.childCount)
|
||||||
|
for (i in 0 until list2.childCount) {
|
||||||
|
val item = list2.getChild(i)
|
||||||
|
if (item != null && item.childCount > 0) {
|
||||||
|
messageList2.add(parseChatMessageItem(item, roomType))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (messageList != messageList2) {
|
||||||
|
LogUtils.e("双重校验聊天列表失败")
|
||||||
|
}
|
||||||
|
} while (messageList != messageList2)
|
||||||
|
if (messageList.isNotEmpty()) {
|
||||||
WeworkController.weworkService.webSocketManager.send(
|
WeworkController.weworkService.webSocketManager.send(
|
||||||
WeworkMessageBean(
|
WeworkMessageBean(
|
||||||
null, null,
|
null, null,
|
||||||
|
|||||||
@@ -1608,6 +1608,7 @@ object WeworkOperationImpl {
|
|||||||
LogUtils.d("发送消息: \n$content")
|
LogUtils.d("发送消息: \n$content")
|
||||||
log("发送消息: \n$content")
|
log("发送消息: \n$content")
|
||||||
AccessibilityUtil.performClick(sendButton)
|
AccessibilityUtil.performClick(sendButton)
|
||||||
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
WeworkLoopImpl.getChatMessageList()
|
WeworkLoopImpl.getChatMessageList()
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user