|
|
@@ -16,7 +16,6 @@ import org.yameida.worktool.utils.*
|
|
|
import java.io.File
|
|
|
import java.text.SimpleDateFormat
|
|
|
import java.util.*
|
|
|
-import kotlin.collections.LinkedHashSet
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -261,7 +260,8 @@ object WeworkOperationImpl {
|
|
|
)
|
|
|
) {
|
|
|
LogUtils.d("开始转发")
|
|
|
- val relaySelectResult = relaySelectTarget(nameList, extraText)
|
|
|
+ val relaySelectResult =
|
|
|
+ newRelaySelectTarget(nameList, extraText, isRelay = true)
|
|
|
if (relaySelectResult.result) {
|
|
|
AccessibilityExtraUtil.loadingPage(
|
|
|
"CommonSelectActivity",
|
|
|
@@ -692,7 +692,12 @@ object WeworkOperationImpl {
|
|
|
if (groupManagerTv != null) {
|
|
|
AccessibilityUtil.performClick(groupManagerTv)
|
|
|
val dismissTv =
|
|
|
- AccessibilityUtil.findOneByText(getRoot(), "解散群聊", exact = true, timeout = 2000)
|
|
|
+ AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(),
|
|
|
+ "解散群聊",
|
|
|
+ exact = true,
|
|
|
+ timeout = 2000
|
|
|
+ )
|
|
|
AccessibilityUtil.performClick(dismissTv)
|
|
|
if (dismissTv != null) {
|
|
|
val confirmTv = AccessibilityUtil.findOneByText(
|
|
|
@@ -841,7 +846,10 @@ object WeworkOperationImpl {
|
|
|
AccessibilityUtil.performClick(shareToWorkButton)
|
|
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
shareToWorkButton =
|
|
|
- AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
|
|
+ AccessibilityUtil.findOnceByText(
|
|
|
+ getRoot(true, share = true),
|
|
|
+ "发送给同事"
|
|
|
+ )
|
|
|
LogUtils.v(
|
|
|
"尝试发送给同事",
|
|
|
shareToWorkButton == null,
|
|
|
@@ -1202,7 +1210,8 @@ object WeworkOperationImpl {
|
|
|
description
|
|
|
)
|
|
|
) {
|
|
|
- val relaySelectResult = relaySelectTarget(titleList, extraText)
|
|
|
+ val relaySelectResult =
|
|
|
+ newRelaySelectTarget(titleList, extraText)
|
|
|
if (relaySelectResult.result) {
|
|
|
AccessibilityExtraUtil.loadingPage(
|
|
|
"CommonSelectActivity",
|
|
|
@@ -1211,6 +1220,18 @@ object WeworkOperationImpl {
|
|
|
"MessageListActivity"
|
|
|
)
|
|
|
AccessibilityUtil.waitForPageMissing("CommonSelectActivity")
|
|
|
+ if (message.isRelay) {
|
|
|
+ val tvFlag = AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(true, share = true),
|
|
|
+ "留在企业微信"
|
|
|
+ )
|
|
|
+ if (tvFlag != null) {
|
|
|
+ AccessibilityUtil.performClick(tvFlag)
|
|
|
+ }
|
|
|
+ message.weCom = 2
|
|
|
+ switchWeCom(message)
|
|
|
+ }
|
|
|
+ sleep(Constant.BASE_CHANGE_PAGE_INTERVAL)
|
|
|
uploadCommandResult(
|
|
|
message,
|
|
|
ExecCallbackBean.SUCCESS,
|
|
|
@@ -1454,7 +1475,10 @@ object WeworkOperationImpl {
|
|
|
AccessibilityUtil.performClick(shareToWorkButton)
|
|
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
shareToWorkButton =
|
|
|
- AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
|
|
+ AccessibilityUtil.findOnceByText(
|
|
|
+ getRoot(true, share = true),
|
|
|
+ "发送给同事"
|
|
|
+ )
|
|
|
LogUtils.v(
|
|
|
"尝试发送给同事",
|
|
|
shareToWorkButton == null,
|
|
|
@@ -1825,7 +1849,8 @@ object WeworkOperationImpl {
|
|
|
receivedContent
|
|
|
)
|
|
|
) {
|
|
|
- val relaySelectResult = relaySelectTarget(titleList, extraText)
|
|
|
+ val relaySelectResult =
|
|
|
+ newRelaySelectTarget(titleList, extraText)
|
|
|
if (relaySelectResult.result) {
|
|
|
AccessibilityExtraUtil.loadingPage(
|
|
|
"CommonSelectActivity",
|
|
|
@@ -1842,6 +1867,10 @@ object WeworkOperationImpl {
|
|
|
relaySelectResult.successList,
|
|
|
relaySelectResult.failList
|
|
|
)
|
|
|
+ if (message.isRelay) {
|
|
|
+ message.weCom = 2
|
|
|
+ switchWeCom(message)
|
|
|
+ }
|
|
|
goHome()
|
|
|
return true
|
|
|
} else {
|
|
|
@@ -2098,21 +2127,27 @@ object WeworkOperationImpl {
|
|
|
WeworkMessageBean.SEND_MESSAGE -> {
|
|
|
WeworkController.sendMessage(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_MICRO_DISK_IMAGE -> {
|
|
|
WeworkController.pushMicroDiskImage(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_MICRO_DISK_FILE -> {
|
|
|
WeworkController.pushMicroDiskFile(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_MICROPROGRAM -> {
|
|
|
WeworkController.pushMicroprogram(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_OFFICE -> {
|
|
|
WeworkController.pushOffice(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_FILE -> {
|
|
|
WeworkController.pushFile(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_LINK -> {
|
|
|
WeworkController.pushLink(weworkMessage)
|
|
|
}
|
|
|
@@ -2144,21 +2179,27 @@ object WeworkOperationImpl {
|
|
|
WeworkMessageBean.SEND_MESSAGE -> {
|
|
|
WeworkController.sendMessage(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_MICRO_DISK_IMAGE -> {
|
|
|
WeworkController.pushMicroDiskImage(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_MICRO_DISK_FILE -> {
|
|
|
WeworkController.pushMicroDiskFile(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_MICROPROGRAM -> {
|
|
|
WeworkController.pushMicroprogram(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_OFFICE -> {
|
|
|
WeworkController.pushOffice(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_FILE -> {
|
|
|
WeworkController.pushFile(weworkMessage)
|
|
|
}
|
|
|
+
|
|
|
WeworkMessageBean.PUSH_LINK -> {
|
|
|
WeworkController.pushLink(weworkMessage)
|
|
|
}
|
|
|
@@ -3518,7 +3559,12 @@ object WeworkOperationImpl {
|
|
|
if (clockInFlag != null) {
|
|
|
AccessibilityUtil.findTextAndClick(getRoot(), "上班打卡", "下班打卡")
|
|
|
val doneFlag =
|
|
|
- AccessibilityUtil.findOneByText(getRoot(), "上班·正常", "之后可打下班卡", "今日打卡已完成")
|
|
|
+ AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(),
|
|
|
+ "上班·正常",
|
|
|
+ "之后可打下班卡",
|
|
|
+ "今日打卡已完成"
|
|
|
+ )
|
|
|
if (doneFlag != null) {
|
|
|
LogUtils.d("打卡成功")
|
|
|
uploadCommandResult(message, ExecCallbackBean.SUCCESS, "", startTime)
|
|
|
@@ -3535,12 +3581,22 @@ object WeworkOperationImpl {
|
|
|
}
|
|
|
} else {
|
|
|
LogUtils.e("未找到上下班打卡")
|
|
|
- uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到上下班打卡", startTime)
|
|
|
+ uploadCommandResult(
|
|
|
+ message,
|
|
|
+ ExecCallbackBean.ERROR_BUTTON,
|
|
|
+ "未找到上下班打卡",
|
|
|
+ startTime
|
|
|
+ )
|
|
|
return false
|
|
|
}
|
|
|
} else {
|
|
|
LogUtils.e("未找到在打卡范围")
|
|
|
- uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到在打卡范围", startTime)
|
|
|
+ uploadCommandResult(
|
|
|
+ message,
|
|
|
+ ExecCallbackBean.ERROR_BUTTON,
|
|
|
+ "未找到在打卡范围",
|
|
|
+ startTime
|
|
|
+ )
|
|
|
return false
|
|
|
}
|
|
|
}
|
|
|
@@ -3782,7 +3838,12 @@ object WeworkOperationImpl {
|
|
|
}
|
|
|
} else {
|
|
|
LogUtils.e("未找到搜索按钮")
|
|
|
- uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到搜索按钮", startTime)
|
|
|
+ uploadCommandResult(
|
|
|
+ message,
|
|
|
+ ExecCallbackBean.ERROR_BUTTON,
|
|
|
+ "未找到搜索按钮",
|
|
|
+ startTime
|
|
|
+ )
|
|
|
return false
|
|
|
}
|
|
|
} else {
|
|
|
@@ -3971,6 +4032,165 @@ object WeworkOperationImpl {
|
|
|
getRoot(),
|
|
|
"选择联系人",
|
|
|
"选择参与人",
|
|
|
+ "选择聊天",
|
|
|
+ exact = true,
|
|
|
+ timeout = timeout
|
|
|
+ ) == null
|
|
|
+ ) {
|
|
|
+ LogUtils.e("未找到选择联系人/选择参与人")
|
|
|
+ error("未找到选择联系人/选择参与人")
|
|
|
+ return selectResult
|
|
|
+ }
|
|
|
+ //聊天消息列表 1ListView 0RecycleView xViewGroup
|
|
|
+ val list = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView)
|
|
|
+ if (list != null) {
|
|
|
+ val frontNode = AccessibilityUtil.findFrontNode(list, 2)
|
|
|
+ val textViewList = AccessibilityUtil.findAllOnceByClazz(frontNode, Views.TextView)
|
|
|
+ if (textViewList.size >= 2) {
|
|
|
+ val searchButton: AccessibilityNodeInfo = textViewList[textViewList.size - 2]
|
|
|
+ val multiButton: AccessibilityNodeInfo = textViewList[textViewList.size - 1]
|
|
|
+ AccessibilityUtil.performClick(multiButton)
|
|
|
+ AccessibilityUtil.performClick(searchButton)
|
|
|
+ var isSelect = false
|
|
|
+ for (select in LinkedHashSet(selectList)) {
|
|
|
+ val needTrim = select.contains(Constant.regTrimTitle)
|
|
|
+ val trimTitle = select.replace(Constant.regTrimTitle, "")
|
|
|
+ AccessibilityUtil.findTextInput(getRoot(), trimTitle)
|
|
|
+ sleep(Constant.CHANGE_PAGE_INTERVAL)
|
|
|
+ val selectListView = AccessibilityUtil.findOneByClazz(
|
|
|
+ getRoot(),
|
|
|
+ Views.ListView,
|
|
|
+ Views.RecyclerView,
|
|
|
+ Views.ViewGroup,
|
|
|
+ minChildCount = 2
|
|
|
+ )
|
|
|
+ val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
|
|
+ val regex1 =
|
|
|
+ (if (Constant.friendRemarkStrict) "^$reverseRegexTitle" else "^(微信昵称:)|((企业)?邮箱:)?$reverseRegexTitle") +
|
|
|
+ (if (needTrim) ".*?" else Constant.suffixString)
|
|
|
+ val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
|
|
+ val regex = "($regex1)|($regex2)"
|
|
|
+ val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
|
|
+ selectListView,
|
|
|
+ regex,
|
|
|
+ timeout = Constant.CHANGE_PAGE_INTERVAL * 3,
|
|
|
+ root = false
|
|
|
+ )
|
|
|
+ if (selectListView != null && matchSelect != null) {
|
|
|
+ for (i in 0 until selectListView.childCount) {
|
|
|
+ val item = selectListView.getChild(i)
|
|
|
+ val searchResult = AccessibilityUtil.findOnceByTextRegex(item, regex)
|
|
|
+ //过滤已退出的群聊
|
|
|
+ if (searchResult?.parent != null && searchResult.parent.childCount < 3) {
|
|
|
+ item.refresh()
|
|
|
+ val imageView = AccessibilityUtil.findOneByClazz(
|
|
|
+ item,
|
|
|
+ Views.ImageView,
|
|
|
+ root = false
|
|
|
+ )
|
|
|
+ AccessibilityUtil.performClick(imageView)
|
|
|
+ isSelect = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (matchSelect != null) {
|
|
|
+ selectResult.successList.add(select)
|
|
|
+ LogUtils.d("找到搜索结果: $select")
|
|
|
+ } else {
|
|
|
+ selectResult.failList.add(select)
|
|
|
+ LogUtils.e("未搜索到结果: $select")
|
|
|
+ error("未搜索到结果: $select")
|
|
|
+ val noResult = AccessibilityUtil.findOnceByText(
|
|
|
+ getRoot(),
|
|
|
+ "无搜索结果",
|
|
|
+ "暂无搜索结果",
|
|
|
+ exact = true
|
|
|
+ ) != null
|
|
|
+ LogUtils.e("企微: 无搜索结果: $noResult")
|
|
|
+ }
|
|
|
+ sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
+ }
|
|
|
+ if (!isSelect) {
|
|
|
+ LogUtils.e("未选择接收者")
|
|
|
+ error("未选择接收者")
|
|
|
+ return selectResult
|
|
|
+ }
|
|
|
+ val confirmButton =
|
|
|
+ AccessibilityUtil.findOneByTextRegex(getRoot(), "^确定(\\(\\d+\\))?\$")
|
|
|
+ if (confirmButton != null) {
|
|
|
+ AccessibilityUtil.performClick(confirmButton)
|
|
|
+ sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
+ if (!needSend) {
|
|
|
+ selectResult.result = true
|
|
|
+ return selectResult
|
|
|
+ }
|
|
|
+ if (!extraText.isNullOrBlank()) {
|
|
|
+ LogUtils.d("extraText: $extraText")
|
|
|
+ AccessibilityUtil.findTextInput(getRoot(), extraText)
|
|
|
+ }
|
|
|
+ val sendButton =
|
|
|
+ AccessibilityUtil.findOneByTextRegex(getRoot(), "^发送(\\(\\d+\\))?\$")
|
|
|
+ if (sendButton != null) {
|
|
|
+ AccessibilityUtil.performClick(sendButton)
|
|
|
+ selectResult.result = true
|
|
|
+ return selectResult
|
|
|
+ }
|
|
|
+ LogUtils.e("未发现发送按钮")
|
|
|
+ error("未发现发送按钮")
|
|
|
+ return selectResult
|
|
|
+ } else {
|
|
|
+ LogUtils.e("未发现确认按钮")
|
|
|
+ error("未发现确认按钮")
|
|
|
+ return selectResult
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ LogUtils.e("未发现搜索和多选按钮")
|
|
|
+ error("未发现搜索和多选按钮")
|
|
|
+ return selectResult
|
|
|
+ }
|
|
|
+ }
|
|
|
+ LogUtils.e("未知错误")
|
|
|
+ error("未知错误")
|
|
|
+ return selectResult
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 转发消息到目标列表
|
|
|
+ * 支持场景:长按消息转发、微盘图片转发
|
|
|
+ * selectList 昵称或群名列表
|
|
|
+ * extraText 转发是否附加一条文本
|
|
|
+ */
|
|
|
+ private fun newRelaySelectTarget(
|
|
|
+ selectList: List<String>,
|
|
|
+ extraText: String? = null,
|
|
|
+ needSend: Boolean = true,
|
|
|
+ timeout: Long = 5000,
|
|
|
+ isRelay: Boolean = false
|
|
|
+ ): SelectResult {
|
|
|
+ val selectResult = SelectResult()
|
|
|
+ if (!isRelay) {
|
|
|
+ if (SPUtils.getInstance().getInt("num") == 2) {
|
|
|
+ sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
+ val aList = AccessibilityUtil.findAllByText(
|
|
|
+ WeworkController.weworkService.rootInActiveWindow,
|
|
|
+ "企业微信"
|
|
|
+ )
|
|
|
+ if (aList.size == 2) {
|
|
|
+// if (1 == SPUtils.getInstance().getInt("weCom")) {
|
|
|
+ AccessibilityUtil.performClick(aList.firstOrNull())
|
|
|
+// } else {
|
|
|
+// AccessibilityUtil.performClick(aList.lastOrNull())
|
|
|
+// }
|
|
|
+ }
|
|
|
+ sleep(Constant.BASE_CHANGE_PAGE_INTERVAL)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(),
|
|
|
+ "选择联系人",
|
|
|
+ "选择参与人",
|
|
|
+ "选择聊天",
|
|
|
exact = true,
|
|
|
timeout = timeout
|
|
|
) == null
|
|
|
@@ -4111,7 +4331,12 @@ object WeworkOperationImpl {
|
|
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
LogUtils.d("进入客户群应用")
|
|
|
val textView =
|
|
|
- AccessibilityUtil.findOneByText(getRoot(), "创建一个客户群", "创建一个居民群", "创建一个学员群")
|
|
|
+ AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(),
|
|
|
+ "创建一个客户群",
|
|
|
+ "创建一个居民群",
|
|
|
+ "创建一个学员群"
|
|
|
+ )
|
|
|
return AccessibilityUtil.performClick(textView)
|
|
|
}
|
|
|
LogUtils.e("未找到客户群应用")
|
|
|
@@ -4142,7 +4367,12 @@ object WeworkOperationImpl {
|
|
|
*/
|
|
|
private fun createGroupLimit(): Boolean {
|
|
|
val hasLimit =
|
|
|
- AccessibilityUtil.findOneByText(getRoot(), "新建群聊功能暂时被限制", "未验证企业", timeout = 2000)
|
|
|
+ AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(),
|
|
|
+ "新建群聊功能暂时被限制",
|
|
|
+ "未验证企业",
|
|
|
+ timeout = 2000
|
|
|
+ )
|
|
|
if (hasLimit == null) {
|
|
|
SPUtils.getInstance("limit").put("canCreateGroup", true)
|
|
|
} else if (SPUtils.getInstance("limit").getBoolean("canCreateGroup", false)) {
|
|
|
@@ -4158,7 +4388,12 @@ object WeworkOperationImpl {
|
|
|
*/
|
|
|
private fun createGroupError(): Boolean {
|
|
|
val hasLimit =
|
|
|
- AccessibilityUtil.findOneByText(getRoot(), "账号异常", "新建客户群功能已被限制使用", timeout = 2000)
|
|
|
+ AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(),
|
|
|
+ "账号异常",
|
|
|
+ "新建客户群功能已被限制使用",
|
|
|
+ timeout = 2000
|
|
|
+ )
|
|
|
return hasLimit != null
|
|
|
}
|
|
|
|
|
|
@@ -4601,7 +4836,12 @@ object WeworkOperationImpl {
|
|
|
while (retry++ < 10) {
|
|
|
AccessibilityUtil.performClick(editButton)
|
|
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
- if (AccessibilityUtil.findOnceByText(getRoot(), "编辑", exact = true) == null)
|
|
|
+ if (AccessibilityUtil.findOnceByText(
|
|
|
+ getRoot(),
|
|
|
+ "编辑",
|
|
|
+ exact = true
|
|
|
+ ) == null
|
|
|
+ )
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
@@ -4701,7 +4941,8 @@ object WeworkOperationImpl {
|
|
|
timeout = 2000
|
|
|
)
|
|
|
if (useTv == null) {
|
|
|
- val useTemplateTv = AccessibilityUtil.findOneByDesc(getRoot(), "使用该模板")
|
|
|
+ val useTemplateTv =
|
|
|
+ AccessibilityUtil.findOneByDesc(getRoot(), "使用该模板")
|
|
|
if (useTemplateTv != null) {
|
|
|
AccessibilityUtil.performClick(useTemplateTv)
|
|
|
}
|
|
|
@@ -4770,11 +5011,16 @@ object WeworkOperationImpl {
|
|
|
error("非聊天房间 无法发送消息")
|
|
|
return false
|
|
|
}
|
|
|
- val voiceFlag = AccessibilityUtil.findOnceByText(getRoot(), "按住 说话", "按住说话", exact = true)
|
|
|
+ val voiceFlag =
|
|
|
+ AccessibilityUtil.findOnceByText(getRoot(), "按住 说话", "按住说话", exact = true)
|
|
|
if (voiceFlag != null) {
|
|
|
AccessibilityUtil.performClickWithSon(AccessibilityUtil.findFrontNode(voiceFlag))
|
|
|
}
|
|
|
- val quitFlag = AccessibilityUtil.findOnceByText(getRoot(), "无法在已退出的群聊中发送消息", exact = true)
|
|
|
+ val quitFlag = AccessibilityUtil.findOnceByText(
|
|
|
+ getRoot(),
|
|
|
+ "无法在已退出的群聊中发送消息",
|
|
|
+ exact = true
|
|
|
+ )
|
|
|
if (quitFlag != null) {
|
|
|
LogUtils.e("无法在已退出的群聊中发送消息 title: $title")
|
|
|
error("无法在已退出的群聊中发送消息 title: $title")
|
|
|
@@ -4829,9 +5075,11 @@ object WeworkOperationImpl {
|
|
|
AccessibilityUtil.findOnceByClazz(getRoot(), Views.EditText), "@"
|
|
|
)
|
|
|
}
|
|
|
- val atFlag = AccessibilityUtil.findOneByText(getRoot(), "选择提醒的人", exact = true)
|
|
|
+ val atFlag =
|
|
|
+ AccessibilityUtil.findOneByText(getRoot(), "选择提醒的人", exact = true)
|
|
|
if (atFlag != null) {
|
|
|
- val searchFlag = AccessibilityUtil.findOneByText(getRoot(), "搜索", exact = true)
|
|
|
+ val searchFlag =
|
|
|
+ AccessibilityUtil.findOneByText(getRoot(), "搜索", exact = true)
|
|
|
val container =
|
|
|
AccessibilityUtil.findBackNode(searchFlag, minChildCount = 2)?.parent
|
|
|
if (container != null) {
|
|
|
@@ -5075,10 +5323,16 @@ object WeworkOperationImpl {
|
|
|
*/
|
|
|
fun setFriendTags(tagList: List<String>): Boolean {
|
|
|
val tagList = if (tagList.size > 5) tagList.subList(0, 5) else tagList
|
|
|
- var tvTag = AccessibilityUtil.findAllByText(getRoot(), "个人标签", exact = true).lastOrNull()
|
|
|
+ var tvTag =
|
|
|
+ AccessibilityUtil.findAllByText(getRoot(), "个人标签", exact = true).lastOrNull()
|
|
|
if (tvTag == null) {
|
|
|
- AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "个人标签")
|
|
|
- tvTag = AccessibilityUtil.findAllByText(getRoot(), "个人标签", exact = true).lastOrNull()
|
|
|
+ AccessibilityUtil.scrollAndFindByText(
|
|
|
+ WeworkController.weworkService,
|
|
|
+ getRoot(),
|
|
|
+ "个人标签"
|
|
|
+ )
|
|
|
+ tvTag =
|
|
|
+ AccessibilityUtil.findAllByText(getRoot(), "个人标签", exact = true).lastOrNull()
|
|
|
}
|
|
|
val oldTagList = arrayListOf<String>()
|
|
|
val list = AccessibilityUtil.findBackNode(tvTag)
|
|
|
@@ -5134,7 +5388,13 @@ object WeworkOperationImpl {
|
|
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
//可能有两次确定 另一次为添加新tag
|
|
|
val textNode =
|
|
|
- AccessibilityUtil.findOneByText(getRoot(), "确定", "保存", "个人信息", exact = true)
|
|
|
+ AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(),
|
|
|
+ "确定",
|
|
|
+ "保存",
|
|
|
+ "个人信息",
|
|
|
+ exact = true
|
|
|
+ )
|
|
|
if (textNode?.text?.toString() in arrayOf("确定", "保存")) {
|
|
|
AccessibilityUtil.performClick(textNode)
|
|
|
}
|
|
|
@@ -5261,7 +5521,12 @@ object WeworkOperationImpl {
|
|
|
if (groupManagerTv != null) {
|
|
|
AccessibilityUtil.performClick(groupManagerTv)
|
|
|
val dismissTv =
|
|
|
- AccessibilityUtil.findOneByText(getRoot(), "转让群主", exact = true, timeout = 2000)
|
|
|
+ AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(),
|
|
|
+ "转让群主",
|
|
|
+ exact = true,
|
|
|
+ timeout = 2000
|
|
|
+ )
|
|
|
AccessibilityUtil.performClick(dismissTv)
|
|
|
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView)
|
|
|
if (selectListView != null) {
|
|
|
@@ -5337,7 +5602,12 @@ object WeworkOperationImpl {
|
|
|
if (groupManagerTv != null) {
|
|
|
AccessibilityUtil.performClick(groupManagerTv)
|
|
|
val dismissTv =
|
|
|
- AccessibilityUtil.findOneByText(getRoot(), "群管理员", exact = true, timeout = 2000)
|
|
|
+ AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(),
|
|
|
+ "群管理员",
|
|
|
+ exact = true,
|
|
|
+ timeout = 2000
|
|
|
+ )
|
|
|
AccessibilityUtil.performClick(dismissTv)
|
|
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
val gridView = AccessibilityUtil.findOnceByClazz(getRoot(), Views.GridView)
|
|
|
@@ -5516,7 +5786,12 @@ object WeworkOperationImpl {
|
|
|
if (groupManagerTv != null) {
|
|
|
AccessibilityUtil.performClick(groupManagerTv)
|
|
|
val dismissTv =
|
|
|
- AccessibilityUtil.findOneByText(getRoot(), "群管理员", exact = true, timeout = 2000)
|
|
|
+ AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(),
|
|
|
+ "群管理员",
|
|
|
+ exact = true,
|
|
|
+ timeout = 2000
|
|
|
+ )
|
|
|
AccessibilityUtil.performClick(dismissTv)
|
|
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
val gridView = AccessibilityUtil.findOnceByClazz(getRoot(), Views.GridView)
|
|
|
@@ -5674,7 +5949,12 @@ object WeworkOperationImpl {
|
|
|
AccessibilityUtil.performClick(textView)
|
|
|
}
|
|
|
val tvAddressFlag =
|
|
|
- AccessibilityUtil.findOneByText(getRoot(), "禁止改群名", exact = true, timeout = 2000)
|
|
|
+ AccessibilityUtil.findOneByText(
|
|
|
+ getRoot(),
|
|
|
+ "禁止改群名",
|
|
|
+ exact = true,
|
|
|
+ timeout = 2000
|
|
|
+ )
|
|
|
if (tvAddressFlag != null) {
|
|
|
val tvAddress = AccessibilityUtil.findBackNode(tvAddressFlag, minChildCount = 1)
|
|
|
val addressDesc =
|
|
|
@@ -6467,7 +6747,7 @@ object WeworkOperationImpl {
|
|
|
?.apply {
|
|
|
this.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
|
|
startActivity(this)
|
|
|
- sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
+ sleep(Constant.BASE_GENERAL_INTERVAL)
|
|
|
// 查找并点击第一个应用
|
|
|
val rootNode = WeworkController.weworkService.rootInActiveWindow
|
|
|
var aa = AccessibilityUtil.findAllByClazz(rootNode, Views.ImageView)
|
|
|
@@ -6477,13 +6757,15 @@ object WeworkOperationImpl {
|
|
|
AccessibilityUtil.findAllByClazz(rootNode, Views.ImageView).lastOrNull()!!
|
|
|
}
|
|
|
AccessibilityUtil.performClick(firstAppNode)
|
|
|
- uploadCommandResult(
|
|
|
- message,
|
|
|
- ExecCallbackBean.SUCCESS,
|
|
|
- "",
|
|
|
- System.currentTimeMillis()
|
|
|
- )
|
|
|
- sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
+ if (!message.isRelay) {
|
|
|
+ uploadCommandResult(
|
|
|
+ message,
|
|
|
+ ExecCallbackBean.SUCCESS,
|
|
|
+ "",
|
|
|
+ System.currentTimeMillis()
|
|
|
+ )
|
|
|
+ sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
+ }
|
|
|
SPUtils.getInstance().put("weCom", message.weCom)
|
|
|
WeworkController.weworkService.webSocketManager.send(
|
|
|
WeworkMessageBean(
|
|
|
@@ -6512,4 +6794,88 @@ object WeworkOperationImpl {
|
|
|
)
|
|
|
return true
|
|
|
}
|
|
|
+
|
|
|
+ fun sendGroupChat(message: WeworkMessageBean):Boolean{
|
|
|
+ if (WeworkRoomUtil.intoGroupChat("群发助手") || WeworkRoomUtil.intoGroupChat("群发助手", fastIn = false)) {
|
|
|
+ Constant.lastUseMultiSender = System.currentTimeMillis()
|
|
|
+ val list = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView)
|
|
|
+ if (list != null) {
|
|
|
+ var findDayFlag = false
|
|
|
+ while (!findDayFlag) {
|
|
|
+ val childCount = list.childCount
|
|
|
+ for (i in 0 until list.childCount) {
|
|
|
+ if (findDayFlag) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ val item = list.getChild(childCount - 1 - i)
|
|
|
+ if (AccessibilityUtil.findOnceByText(item, "午") != null) {
|
|
|
+ findDayFlag = true
|
|
|
+ }
|
|
|
+ if (item != null && item.childCount > 0) {
|
|
|
+ LogUtils.d("点击群发")
|
|
|
+ AccessibilityUtil.clickByNode(
|
|
|
+ WeworkController.weworkService,
|
|
|
+ AccessibilityUtil.findOnceByClazz(item, Views.FrameLayout)
|
|
|
+ )
|
|
|
+ if (!AccessibilityExtraUtil.loadingPage("EnterpriseCustomerEnterpriseMassMessageDetailActivity")) {
|
|
|
+ AccessibilityUtil.clickByNode(
|
|
|
+ WeworkController.weworkService,
|
|
|
+ AccessibilityUtil.findOnceByClazz(
|
|
|
+ item,
|
|
|
+ Views.FrameLayout
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+ if (AccessibilityExtraUtil.loadingPage("EnterpriseCustomerEnterpriseMassMessageDetailActivity")) {
|
|
|
+ AccessibilityUtil.findOneByText(getRoot(), "发送")
|
|
|
+ sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
+ 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()
|
|
|
+ sleep(Constant.POP_WINDOW_INTERVAL)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (findDayFlag) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ AccessibilityUtil.performScrollUp(list)
|
|
|
+ sleep(Constant.CHANGE_PAGE_INTERVAL)
|
|
|
+ list.refresh()
|
|
|
+ LogUtils.d("向上滚动查找当日日期")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ uploadCommandResult(
|
|
|
+ message,
|
|
|
+ ExecCallbackBean.SUCCESS,
|
|
|
+ "",
|
|
|
+ System.currentTimeMillis()
|
|
|
+ )
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
}
|