update 特殊符号兼容;修复执行多条消息丢失
This commit is contained in:
@@ -72,4 +72,32 @@ data class ExecCallbackBean(
|
||||
const val ERROR_OTHER = 501000
|
||||
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
if (!super.equals(other)) return false
|
||||
|
||||
other as ExecCallbackBean
|
||||
|
||||
if (rawMsg != other.rawMsg) return false
|
||||
if (errorCode != other.errorCode) return false
|
||||
if (errorReason != other.errorReason) return false
|
||||
if (runTime != other.runTime) return false
|
||||
if (timeCost != other.timeCost) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = super.hashCode()
|
||||
result = 31 * result + (rawMsg?.hashCode() ?: 0)
|
||||
result = 31 * result + errorCode
|
||||
result = 31 * result + errorReason.hashCode()
|
||||
result = 31 * result + runTime.hashCode()
|
||||
result = 31 * result + timeCost.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -82,6 +82,7 @@ object MyLooper {
|
||||
WeworkController.enableLoopRunning = true
|
||||
} else {
|
||||
WeworkController.mainLoopRunning = false
|
||||
LogUtils.v("加入指令到执行队列", GsonUtils.toJson(message))
|
||||
getInstance().sendMessage(Message.obtain().apply {
|
||||
what = message.type * message.hashCode()
|
||||
obj = message.apply { messageId = messageList.messageId }
|
||||
|
||||
@@ -733,7 +733,8 @@ object WeworkOperationImpl {
|
||||
AccessibilityUtil.findTextInput(getRoot(), trimTitle)
|
||||
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView, Views.RecyclerView, Views.ViewGroup, minChildCount = 2)
|
||||
val regex = "^$trimTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||
val regex = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||
selectListView,
|
||||
regex,
|
||||
@@ -882,7 +883,8 @@ object WeworkOperationImpl {
|
||||
AccessibilityUtil.findTextInput(getRoot(), trimTitle)
|
||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView, Views.RecyclerView, Views.ViewGroup, minChildCount = 2, firstChildClazz = Views.TextView)
|
||||
val regex = "^$trimTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||
val regex = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||
selectListView,
|
||||
regex,
|
||||
@@ -976,7 +978,8 @@ object WeworkOperationImpl {
|
||||
AccessibilityUtil.findTextInput(getRoot(), trimTitle)
|
||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView, Views.RecyclerView, Views.ViewGroup, minChildCount = 2, firstChildClazz = Views.RelativeLayout)
|
||||
val regex = "^$trimTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||
val regex = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||
selectListView,
|
||||
regex,
|
||||
|
||||
23
app/src/main/java/org/yameida/worktool/utils/RegexHelper.kt
Normal file
23
app/src/main/java/org/yameida/worktool/utils/RegexHelper.kt
Normal file
@@ -0,0 +1,23 @@
|
||||
package org.yameida.worktool.utils
|
||||
|
||||
object RegexHelper {
|
||||
|
||||
fun reverseRegexTitle(string: String): String {
|
||||
return string.replace("\\", "\\\\")
|
||||
.replace("*", "\\*")
|
||||
.replace("+", "\\+")
|
||||
.replace(".", "\\.")
|
||||
.replace("[", "\\[")
|
||||
.replace("]", "\\]")
|
||||
.replace("?", "\\?")
|
||||
.replace("^", "\\^")
|
||||
.replace("$", "\\$")
|
||||
.replace("{", "\\{")
|
||||
.replace("}", "\\}")
|
||||
.replace("|", "\\|")
|
||||
// .replace("-", "\\-") //企微自身限制
|
||||
// .replace("(", "\\(") //企微自身限制
|
||||
// .replace(")", "\\)") //企微自身限制
|
||||
}
|
||||
|
||||
}
|
||||
@@ -104,7 +104,8 @@ object WeworkRoomUtil {
|
||||
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||
//消息页搜索结果列表
|
||||
val selectListView = findOneByClazz(getRoot(), Views.ListView)
|
||||
val regex = "^$trimTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||
val regex = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||
val searchResult = AccessibilityUtil.findOneByTextRegex(
|
||||
selectListView,
|
||||
regex,
|
||||
|
||||
Reference in New Issue
Block a user