|
|
@@ -6,6 +6,7 @@ import org.yameida.worktool.Constant
|
|
|
import org.yameida.worktool.model.WeworkMessageBean
|
|
|
import org.yameida.worktool.service.WeworkController
|
|
|
import org.yameida.worktool.service.getRoot
|
|
|
+import org.yameida.worktool.service.log
|
|
|
import org.yameida.worktool.service.sleep
|
|
|
import org.yameida.worktool.utils.AccessibilityUtil.findAllByClazz
|
|
|
import org.yameida.worktool.utils.AccessibilityUtil.findAllOnceByClazz
|
|
|
@@ -429,11 +430,27 @@ object WeworkTextUtil {
|
|
|
val textNode = AccessibilityUtil.findOnceByText(backNode, replyContent)
|
|
|
if (textNode != null && replyContent.isNotEmpty()) {
|
|
|
LogUtils.d("nameList: $nameList\nreplyContent: $replyContent")
|
|
|
- return longClickMessageItem(
|
|
|
+ var longClickMessageItem = longClickMessageItem(
|
|
|
item,
|
|
|
WeworkMessageBean.ROOM_TYPE_INTERNAL_CONTACT,
|
|
|
*key
|
|
|
)
|
|
|
+ if (!longClickMessageItem && num == 2) {
|
|
|
+ log(
|
|
|
+ "长按转发失败11111 type nameList: $nameList\n" +
|
|
|
+ "replyContent: $replyContent",
|
|
|
+ WeworkMessageBean.ROBOT_ERROR_LOG
|
|
|
+ )
|
|
|
+ return longClickMessageItem(
|
|
|
+ node,
|
|
|
+ replyTextType,
|
|
|
+ replyNick,
|
|
|
+ replyContent,
|
|
|
+ *key,
|
|
|
+ num = 1
|
|
|
+ )
|
|
|
+ }
|
|
|
+ return longClickMessageItem
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -455,11 +472,27 @@ object WeworkTextUtil {
|
|
|
}
|
|
|
if (replyTextType == WeworkMessageBean.TEXT_TYPE_LINK && replyTextType == textTypeFromItem) {
|
|
|
LogUtils.d("nameList: $nameList\nreplyContent: $replyContent")
|
|
|
- return longClickMessageItem(
|
|
|
+ var longClickMessageItem = longClickMessageItem(
|
|
|
item,
|
|
|
WeworkMessageBean.ROOM_TYPE_INTERNAL_GROUP,
|
|
|
*key
|
|
|
)
|
|
|
+ if (!longClickMessageItem && num == 2) {
|
|
|
+ log(
|
|
|
+ "长按转发失败11113 nameList: $nameList\n" +
|
|
|
+ "replyContent: $replyContent",
|
|
|
+ WeworkMessageBean.ROBOT_ERROR_LOG
|
|
|
+ )
|
|
|
+ return longClickMessageItem(
|
|
|
+ node,
|
|
|
+ replyTextType,
|
|
|
+ replyNick,
|
|
|
+ replyContent,
|
|
|
+ *key,
|
|
|
+ num = 1
|
|
|
+ )
|
|
|
+ }
|
|
|
+ return true
|
|
|
}
|
|
|
if ((replyTextType == WeworkMessageBean.TEXT_TYPE_FILE || replyTextType == WeworkMessageBean.TEXT_TYPE_VIDEO)
|
|
|
&& replyContent.contains("###")
|
|
|
@@ -475,21 +508,60 @@ object WeworkTextUtil {
|
|
|
) != null
|
|
|
) {
|
|
|
LogUtils.d("nameList: $nameList\nreplyContent: $replyContent")
|
|
|
- return longClickMessageItem(
|
|
|
+ var longClickMessageItem = longClickMessageItem(
|
|
|
item,
|
|
|
WeworkMessageBean.ROOM_TYPE_INTERNAL_GROUP,
|
|
|
*key
|
|
|
)
|
|
|
+ if (!longClickMessageItem && num == 2) {
|
|
|
+ log(
|
|
|
+ "长按转发失败11112 nameList: $nameList\n" +
|
|
|
+ "replyContent: $replyContent",
|
|
|
+ WeworkMessageBean.ROBOT_ERROR_LOG
|
|
|
+ )
|
|
|
+ return longClickMessageItem(
|
|
|
+ node,
|
|
|
+ replyTextType,
|
|
|
+ replyNick,
|
|
|
+ replyContent,
|
|
|
+ *key,
|
|
|
+ num = 1
|
|
|
+ )
|
|
|
+ }
|
|
|
+ return true
|
|
|
}
|
|
|
}
|
|
|
+ sleep(Constant.CHANGE_PAGE_INTERVAL)
|
|
|
val textNode = AccessibilityUtil.findOnceByText(backNode, replyContent)
|
|
|
if (textNode != null && replyContent.isNotEmpty()) {
|
|
|
LogUtils.d("nameList: $nameList\nreplyContent: $replyContent")
|
|
|
- return longClickMessageItem(
|
|
|
+ var longClickMessageItem = longClickMessageItem(
|
|
|
item,
|
|
|
WeworkMessageBean.ROOM_TYPE_INTERNAL_GROUP,
|
|
|
*key
|
|
|
)
|
|
|
+ if (!longClickMessageItem && num == 2) {
|
|
|
+ log(
|
|
|
+ "长按转发失败11111nameList: $nameList\n" +
|
|
|
+ "replyContent: $replyContent",
|
|
|
+ WeworkMessageBean.ROBOT_ERROR_LOG
|
|
|
+ )
|
|
|
+ return longClickMessageItem(
|
|
|
+ node,
|
|
|
+ replyTextType,
|
|
|
+ replyNick,
|
|
|
+ replyContent,
|
|
|
+ *key,
|
|
|
+ num = 1
|
|
|
+ )
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }else{
|
|
|
+ log(
|
|
|
+ "找不到消息: $nameList\n" +
|
|
|
+ "replyContent: $replyContent",
|
|
|
+ WeworkMessageBean.ROBOT_ERROR_LOG
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -573,7 +645,7 @@ object WeworkTextUtil {
|
|
|
return AccessibilityUtil.clickByNode(WeworkController.weworkService, backNode)
|
|
|
}
|
|
|
AccessibilityUtil.performLongClickWithSon(backNode)
|
|
|
- sleep(Constant.CHANGE_PAGE_INTERVAL)
|
|
|
+ sleep(Constant.BASE_GENERAL_INTERVAL)
|
|
|
val optionRvList = findAllByClazz(getRoot(), Views.RecyclerView, Views.ViewGroup)
|
|
|
for (optionRv in optionRvList) {
|
|
|
val keyTv = AccessibilityUtil.findOnceByText(optionRv, *key, exact = true)
|