fix 踢人失败循环
This commit is contained in:
@@ -170,24 +170,37 @@ fun getRoot(ignoreCheck: Boolean, share: Boolean = false): AccessibilityNodeInfo
|
|||||||
*/
|
*/
|
||||||
fun backPress() {
|
fun backPress() {
|
||||||
val clazz = WeworkController.weworkService.currentClass
|
val clazz = WeworkController.weworkService.currentClass
|
||||||
val textView = AccessibilityUtil.findOnceByClazz(getRoot(), Views.TextView)
|
val root = getRoot()
|
||||||
|
val textView = AccessibilityUtil.findOnceByClazz(root, Views.TextView)
|
||||||
if (textView != null && textView.text.isNullOrBlank() && AccessibilityUtil.performClick(textView, retry = false)) {
|
if (textView != null && textView.text.isNullOrBlank() && AccessibilityUtil.performClick(textView, retry = false)) {
|
||||||
LogUtils.v("找到回退按钮")
|
LogUtils.v("找到回退按钮")
|
||||||
} else {
|
} else {
|
||||||
val ivButton = AccessibilityUtil.findOnceByClazz(getRoot(), Views.ImageView)
|
if (AccessibilityUtil.findOnceByText(root, "移出成员") != null) {
|
||||||
|
val list = AccessibilityUtil.findOneByClazz(root, Views.RecyclerView, Views.ListView)
|
||||||
|
if (list != null) {
|
||||||
|
val frontNode = AccessibilityUtil.findFrontNode(list)
|
||||||
|
val textViewList = AccessibilityUtil.findAllOnceByClazz(frontNode, Views.TextView)
|
||||||
|
if (textViewList.size >= 2) {
|
||||||
|
val closeButton: AccessibilityNodeInfo = textViewList[textViewList.size - 1]
|
||||||
|
AccessibilityUtil.performClick(closeButton)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val ivButton = AccessibilityUtil.findOnceByClazz(root, Views.ImageView)
|
||||||
if (ivButton != null && ivButton.isClickable && AccessibilityUtil.findFrontNode(ivButton) == null) {
|
if (ivButton != null && ivButton.isClickable && AccessibilityUtil.findFrontNode(ivButton) == null) {
|
||||||
LogUtils.d("未找到回退按钮 点击第一个IV按钮")
|
LogUtils.d("未找到回退按钮 点击第一个IV按钮")
|
||||||
AccessibilityUtil.performClick(ivButton, retry = false)
|
AccessibilityUtil.performClick(ivButton, retry = false)
|
||||||
} else {
|
} else {
|
||||||
LogUtils.d("未找到回退按钮 点击第一个BT按钮")
|
LogUtils.d("未找到回退按钮 点击第一个BT按钮")
|
||||||
val button = AccessibilityUtil.findOnceByClazz(getRoot(), Views.Button)
|
val button = AccessibilityUtil.findOnceByClazz(root, Views.Button)
|
||||||
if (button != null && button.childCount > 0) {
|
if (button != null && button.childCount > 0) {
|
||||||
AccessibilityUtil.performClick(button.getChild(0), retry = false)
|
AccessibilityUtil.performClick(button.getChild(0), retry = false)
|
||||||
} else if (button != null) {
|
} else if (button != null) {
|
||||||
AccessibilityUtil.performClick(button, retry = false)
|
AccessibilityUtil.performClick(button, retry = false)
|
||||||
} else {
|
} else {
|
||||||
LogUtils.d("未找到BT按钮")
|
LogUtils.d("未找到BT按钮")
|
||||||
val confirm = AccessibilityUtil.findOnceByText(getRoot(), "不保存", "确定", "我知道了", "暂不进入", "不用了", "取消", "暂不", "关闭", "退出", "留在企业微信", exact = true)
|
val confirm = AccessibilityUtil.findOnceByText(root, "不保存", "确定", "我知道了", "暂不进入", "不用了", "取消", "暂不", "关闭", "退出", "留在企业微信", exact = true)
|
||||||
if (confirm != null) {
|
if (confirm != null) {
|
||||||
LogUtils.d("尝试点击确定/我知道了/暂不进入")
|
LogUtils.d("尝试点击确定/我知道了/暂不进入")
|
||||||
AccessibilityUtil.performClick(confirm)
|
AccessibilityUtil.performClick(confirm)
|
||||||
|
|||||||
@@ -2456,6 +2456,7 @@ object WeworkOperationImpl {
|
|||||||
error("拉人失败 找不到: $select")
|
error("拉人失败 找不到: $select")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val noResult = AccessibilityUtil.findOnceByText(getRoot(), "无搜索结果", exact = true) != null
|
||||||
val textView = AccessibilityUtil.findOnceByClazz(getRoot(), Views.TextView)
|
val textView = AccessibilityUtil.findOnceByClazz(getRoot(), Views.TextView)
|
||||||
if (textView != null && textView.text.isNullOrBlank()) {
|
if (textView != null && textView.text.isNullOrBlank()) {
|
||||||
AccessibilityUtil.performClick(textView)
|
AccessibilityUtil.performClick(textView)
|
||||||
@@ -2468,7 +2469,6 @@ object WeworkOperationImpl {
|
|||||||
selectResult.failList.add(select)
|
selectResult.failList.add(select)
|
||||||
LogUtils.e("未搜索到结果: $select")
|
LogUtils.e("未搜索到结果: $select")
|
||||||
error("未搜索到结果: $select")
|
error("未搜索到结果: $select")
|
||||||
val noResult = AccessibilityUtil.findOnceByText(getRoot(), "无搜索结果", exact = true) != null
|
|
||||||
LogUtils.e("企微: 无搜索结果: $noResult")
|
LogUtils.e("企微: 无搜索结果: $noResult")
|
||||||
if (Constant.groupStrict) return selectResult
|
if (Constant.groupStrict) return selectResult
|
||||||
}
|
}
|
||||||
@@ -2606,6 +2606,7 @@ object WeworkOperationImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val noResult = AccessibilityUtil.findOnceByText(getRoot(), "无搜索结果", exact = true) != null
|
||||||
val textView = AccessibilityUtil.findOnceByClazz(getRoot(), Views.TextView)
|
val textView = AccessibilityUtil.findOnceByClazz(getRoot(), Views.TextView)
|
||||||
if (textView != null && textView.text.isNullOrBlank()) {
|
if (textView != null && textView.text.isNullOrBlank()) {
|
||||||
AccessibilityUtil.performClick(textView)
|
AccessibilityUtil.performClick(textView)
|
||||||
@@ -2618,14 +2619,14 @@ object WeworkOperationImpl {
|
|||||||
selectResult.failList.add(select)
|
selectResult.failList.add(select)
|
||||||
LogUtils.e("未搜索到结果: $select")
|
LogUtils.e("未搜索到结果: $select")
|
||||||
error("未搜索到结果: $select")
|
error("未搜索到结果: $select")
|
||||||
val noResult = AccessibilityUtil.findOnceByText(getRoot(), "无搜索结果", exact = true) != null
|
|
||||||
LogUtils.e("企微: 无搜索结果: $noResult")
|
LogUtils.e("企微: 无搜索结果: $noResult")
|
||||||
//待踢人已经不在群里的不算失败
|
//待踢人已经不在群里的不算失败
|
||||||
// if (Constant.groupStrict) return false
|
// if (Constant.groupStrict) return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
while (AccessibilityUtil.findOnceByText(getRoot(), "全部群成员", "微信用户创建") == null && !isAtHome()) {
|
var retry = 3
|
||||||
|
while (retry-- > 0 && WeworkController.weworkService.currentClass == "com.tencent.wework.choosecontact.controller.CommonChooseListActivity") {
|
||||||
backPress()
|
backPress()
|
||||||
}
|
}
|
||||||
LogUtils.d("移出0人")
|
LogUtils.d("移出0人")
|
||||||
|
|||||||
Reference in New Issue
Block a user