update 支持使用别名拉人踢人和发消息转发消息;意外跳出企微可自动跳回
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
package org.yameida.worktool.service
|
package org.yameida.worktool.service
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import android.view.accessibility.AccessibilityNodeInfo
|
import android.view.accessibility.AccessibilityNodeInfo
|
||||||
import com.blankj.utilcode.util.GsonUtils
|
import com.blankj.utilcode.util.GsonUtils
|
||||||
import com.blankj.utilcode.util.LogUtils
|
import com.blankj.utilcode.util.LogUtils
|
||||||
import com.blankj.utilcode.util.ScreenUtils
|
import com.blankj.utilcode.util.ScreenUtils
|
||||||
|
import com.blankj.utilcode.util.Utils
|
||||||
import com.hjq.toast.ToastUtils
|
import com.hjq.toast.ToastUtils
|
||||||
import org.yameida.worktool.Constant
|
import org.yameida.worktool.Constant
|
||||||
import org.yameida.worktool.MyApplication
|
import org.yameida.worktool.MyApplication
|
||||||
@@ -102,6 +104,13 @@ fun getRoot(ignoreCheck: Boolean): AccessibilityNodeInfo {
|
|||||||
LogUtils.e("当前不在企业微信: ${root.packageName}")
|
LogUtils.e("当前不在企业微信: ${root.packageName}")
|
||||||
if (System.currentTimeMillis() % 30 == 0L) {
|
if (System.currentTimeMillis() % 30 == 0L) {
|
||||||
error("当前不在企业微信: ${root.packageName}")
|
error("当前不在企业微信: ${root.packageName}")
|
||||||
|
if (!root.packageName.contains("(worktool)|(settings)".toRegex())) {
|
||||||
|
ToastUtils.show("当前不在企业微信: ${root.packageName}\n尝试跳转到企业微信")
|
||||||
|
Utils.getApp().packageManager.getLaunchIntentForPackage(Constant.PACKAGE_NAMES)?.apply {
|
||||||
|
this.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
Utils.getApp().startActivity(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ignoreCheck) {
|
if (ignoreCheck) {
|
||||||
return root
|
return root
|
||||||
|
|||||||
@@ -791,7 +791,9 @@ object WeworkOperationImpl {
|
|||||||
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||||
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView, Views.RecyclerView, Views.ViewGroup, minChildCount = 2)
|
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView, Views.RecyclerView, Views.ViewGroup, minChildCount = 2)
|
||||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||||
val regex = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
val regex1 = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||||
|
val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
||||||
|
val regex = "($regex1)|($regex2)"
|
||||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||||
selectListView,
|
selectListView,
|
||||||
regex,
|
regex,
|
||||||
@@ -943,7 +945,9 @@ object WeworkOperationImpl {
|
|||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView, Views.RecyclerView, Views.ViewGroup, minChildCount = 2, firstChildClazz = Views.TextView)
|
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView, Views.RecyclerView, Views.ViewGroup, minChildCount = 2, firstChildClazz = Views.TextView)
|
||||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||||
val regex = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
val regex1 = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||||
|
val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
||||||
|
val regex = "($regex1)|($regex2)"
|
||||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||||
selectListView,
|
selectListView,
|
||||||
regex,
|
regex,
|
||||||
@@ -1038,7 +1042,9 @@ object WeworkOperationImpl {
|
|||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView, Views.RecyclerView, Views.ViewGroup, minChildCount = 2, firstChildClazz = Views.RelativeLayout)
|
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView, Views.RecyclerView, Views.ViewGroup, minChildCount = 2, firstChildClazz = Views.RelativeLayout)
|
||||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||||
val regex = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
val regex1 = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||||
|
val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
||||||
|
val regex = "($regex1)|($regex2)"
|
||||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||||
selectListView,
|
selectListView,
|
||||||
regex,
|
regex,
|
||||||
|
|||||||
@@ -105,7 +105,9 @@ object WeworkRoomUtil {
|
|||||||
//消息页搜索结果列表
|
//消息页搜索结果列表
|
||||||
val selectListView = findOneByClazz(getRoot(), Views.ListView)
|
val selectListView = findOneByClazz(getRoot(), Views.ListView)
|
||||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||||
val regex = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
val regex1 = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||||
|
val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
||||||
|
val regex = "($regex1)|($regex2)"
|
||||||
val searchResult = AccessibilityUtil.findAllByTextRegex(
|
val searchResult = AccessibilityUtil.findAllByTextRegex(
|
||||||
selectListView,
|
selectListView,
|
||||||
regex,
|
regex,
|
||||||
|
|||||||
Reference in New Issue
Block a user