Skip to content

Commit

Permalink
update 自动群发
Browse files Browse the repository at this point in the history
  • Loading branch information
gallonyin committed Sep 23, 2023
1 parent 1e11713 commit 9c3610c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
31 changes: 31 additions & 0 deletions app/src/main/java/org/yameida/worktool/service/WeworkLoopImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,37 @@ object WeworkLoopImpl {
}
}
} else {
if (titleList.size > 0) {
val title = titleList[0]
if (title == "群发助手") {
LogUtils.d("使用功能: 群发助手")
val list = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView)
if (list != null) {
val childCount = list.childCount
for (i in 0 until list.childCount) {
val item = list.getChild(childCount - 1 - i)
if (item != null && item.childCount > 0) {
LogUtils.d("点击群发")
AccessibilityUtil.printNodeClazzTree(item)
AccessibilityUtil.clickByNode(WeworkController.weworkService, AccessibilityUtil.findOnceByClazz(item, Views.FrameLayout))
if (AccessibilityExtraUtil.loadingPage("EnterpriseCustomerEnterpriseMassMessageDetailActivity")) {
AccessibilityUtil.findOneByText(getRoot(), "发送")
if (AccessibilityUtil.findOnceByText(getRoot(), "已发送", exact = true) != null) {
LogUtils.d("该条群发已发送")
backPress()
} else {
if (AccessibilityUtil.findTextAndClick(getRoot(), "发送", exact = true)) {
LogUtils.d("发送该条群发")
AccessibilityUtil.findOneByText(getRoot(), "已发送", exact = true)
}
backPress()
}
}
}
}
}
}
}
LogUtils.v("退出非聊天房间 ${WeworkController.weworkService.currentClass}")
}
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ object AccessibilityExtraUtil {
var currentTime = startTime
while (currentTime - startTime <= timeout) {
if (service.currentClass in clazzList || service.currentClass.split(".").last() in clazzList) {
Log.v(tag, "loadingPage: $clazzList")
Log.v(tag, "loadingPage: ${clazzList.joinToString()}")
return true
}
sleep(SHORT_INTERVAL)
currentTime = System.currentTimeMillis()
}
Log.e(tag, "loadingPage: not found: $clazzList current: ${service.currentClass}")
Log.e(tag, "loadingPage: not found: ${clazzList.joinToString()} current: ${service.currentClass}")
return false
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/org/yameida/worktool/utils/Views.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ public class Views {
public static String ProgressBar = "android.widget.ProgressBar";
public static String ScrollView = "android.widget.ScrollView";
public static String CheckBox = "android.widget.CheckBox";
public static String FrameLayout = "android.widget.FrameLayout";
}

0 comments on commit 9c3610c

Please sign in to comment.