update 优化群名识别;优化进群速度
This commit is contained in:
@@ -27,6 +27,9 @@ object Constant {
|
||||
val transformation = "AES/CBC/PKCS7Padding"
|
||||
val wssRegex = "^wss".toRegex()
|
||||
val wsRegex = "^ws".toRegex()
|
||||
val suffixString = "(-.*)?(…)?(\\(\\d+\\))?$"
|
||||
val suffixRegex = "(-.*)?(…)?(\\(\\d+\\))?$"
|
||||
val digitalRegex = "\\(\\d+\\)\$".toRegex()
|
||||
var weworkCorpName: String
|
||||
get() = SPUtils.getInstance().getString("weworkCorpName", "")
|
||||
set(value) {
|
||||
|
||||
@@ -1651,7 +1651,7 @@ object WeworkOperationImpl {
|
||||
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView)
|
||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||
val regex1 = (if (Constant.friendRemarkStrict) "^$reverseRegexTitle" else "^(微信昵称:)|((企业)?邮箱:)?$reverseRegexTitle") +
|
||||
(if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$")
|
||||
(if (needTrim) ".*?" else Constant.suffixString)
|
||||
val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
||||
val regex = "($regex1)|($regex2)"
|
||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||
@@ -1766,7 +1766,7 @@ object WeworkOperationImpl {
|
||||
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView)
|
||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||
val regex1 = (if (Constant.friendRemarkStrict) "^$reverseRegexTitle" else "^(微信昵称:)|((企业)?邮箱:)?$reverseRegexTitle") +
|
||||
(if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$")
|
||||
(if (needTrim) ".*?" else Constant.suffixString)
|
||||
val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
||||
val regex = "($regex1)|($regex2)"
|
||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||
@@ -2184,7 +2184,7 @@ object WeworkOperationImpl {
|
||||
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 "(-.*)?(…)?(\\(.*?\\))?$")
|
||||
(if (needTrim) ".*?" else Constant.suffixString)
|
||||
val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
||||
val regex = "($regex1)|($regex2)"
|
||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||
@@ -2225,7 +2225,7 @@ object WeworkOperationImpl {
|
||||
return selectResult
|
||||
}
|
||||
val confirmButton =
|
||||
AccessibilityUtil.findOneByTextRegex(getRoot(), "^确定(\\(.*?\\))?\$")
|
||||
AccessibilityUtil.findOneByTextRegex(getRoot(), "^确定(\\(\\d+\\))?\$")
|
||||
if (confirmButton != null) {
|
||||
AccessibilityUtil.performClick(confirmButton)
|
||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||
@@ -2237,7 +2237,7 @@ object WeworkOperationImpl {
|
||||
LogUtils.d("extraText: $extraText")
|
||||
AccessibilityUtil.findTextInput(getRoot(), extraText)
|
||||
}
|
||||
val sendButton = AccessibilityUtil.findOneByTextRegex(getRoot(), "^发送(\\(.*?\\))?\$")
|
||||
val sendButton = AccessibilityUtil.findOneByTextRegex(getRoot(), "^发送(\\(\\d+\\))?\$")
|
||||
if (sendButton != null) {
|
||||
AccessibilityUtil.performClick(sendButton)
|
||||
selectResult.result = true
|
||||
@@ -2423,7 +2423,7 @@ object WeworkOperationImpl {
|
||||
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView, Views.RecyclerView, Views.ViewGroup, minChildCount = 2, firstChildClazz = Views.TextView)
|
||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||
val regex1 = (if (Constant.friendRemarkStrict) "^$reverseRegexTitle" else "^(微信昵称:)|((企业)?邮箱:)?$reverseRegexTitle") +
|
||||
(if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$")
|
||||
(if (needTrim) ".*?" else Constant.suffixString)
|
||||
val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
||||
val regex = "($regex1)|($regex2)"
|
||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||
@@ -2485,7 +2485,7 @@ object WeworkOperationImpl {
|
||||
AccessibilityUtil.findTextAndClick(getRoot(), "聊天记录")
|
||||
}
|
||||
val confirmButton =
|
||||
AccessibilityUtil.findOneByTextRegex(getRoot(), "^确定(\\(.*?\\))?\$")
|
||||
AccessibilityUtil.findOneByTextRegex(getRoot(), "^确定(\\(\\d+\\))?\$")
|
||||
if (confirmButton != null) {
|
||||
AccessibilityUtil.performClick(confirmButton)
|
||||
if (AccessibilityExtraUtil.loadingPage("CustomDialog", timeout = Constant.POP_WINDOW_INTERVAL)) {
|
||||
@@ -2584,7 +2584,7 @@ object WeworkOperationImpl {
|
||||
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView, Views.RecyclerView, Views.ViewGroup, minChildCount = 2, firstChildClazz = Views.RelativeLayout)
|
||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||
val regex1 = (if (Constant.friendRemarkStrict) "^$reverseRegexTitle" else "^(微信昵称:)|((企业)?邮箱:)?$reverseRegexTitle") +
|
||||
(if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$")
|
||||
(if (needTrim) ".*?" else Constant.suffixString)
|
||||
val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
||||
val regex = "($regex1)|($regex2)"
|
||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||
@@ -2936,7 +2936,7 @@ object WeworkOperationImpl {
|
||||
val selectListView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ListView)
|
||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||
val regex1 = (if (Constant.friendRemarkStrict) "^$reverseRegexTitle" else "^(微信昵称:)|((企业)?邮箱:)?$reverseRegexTitle") +
|
||||
(if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$")
|
||||
(if (needTrim) ".*?" else Constant.suffixString)
|
||||
val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
||||
val regex = "($regex1)|($regex2)"
|
||||
val matchSelect = AccessibilityUtil.findOneByTextRegex(
|
||||
|
||||
@@ -62,8 +62,8 @@ object WeworkRoomUtil {
|
||||
for (textView in textViewList) {
|
||||
if (!textView.text.isNullOrBlank()) {
|
||||
val text = textView.text.toString()
|
||||
titleList.add(text.replace("\\(\\d+\\)$".toRegex(), ""))
|
||||
if (noCut && text.contains("\\(\\d+\\)$".toRegex())) {
|
||||
titleList.add(text.replace(Constant.digitalRegex, ""))
|
||||
if (noCut && text.contains(Constant.digitalRegex)) {
|
||||
titleList.add(text)
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ object WeworkRoomUtil {
|
||||
AccessibilityUtil.performClick(item)
|
||||
LogUtils.d("快捷进入房间: $title")
|
||||
AccessibilityUtil.waitForPageMissing("WwMainActivity", "GlobalSearchActivity")
|
||||
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||
AccessibilityExtraUtil.loadingPage("ExternalGroupMessageListActivity", "ExternalWechatUserMessageListActivity", "MessageListActivity", timeout = Constant.CHANGE_PAGE_INTERVAL)
|
||||
return checkRoom(title, strict = false)
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ object WeworkRoomUtil {
|
||||
val selectListView = findOneByClazz(getRoot(), Views.ListView)
|
||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||
val regex1 = (if (Constant.friendRemarkStrict) "^$reverseRegexTitle" else "^(微信昵称:)|((企业)?邮箱:)?$reverseRegexTitle") +
|
||||
(if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$")
|
||||
(if (needTrim) ".*?" else Constant.suffixString)
|
||||
val regex2 = ".*?\\($reverseRegexTitle\\)$"
|
||||
val regex = "($regex1)|($regex2)"
|
||||
val searchResult = AccessibilityUtil.findAllByTextRegex(
|
||||
@@ -137,7 +137,7 @@ object WeworkRoomUtil {
|
||||
val title = text?.text?.toString() ?: title
|
||||
LogUtils.d("进入房间: $title")
|
||||
AccessibilityUtil.waitForPageMissing("WwMainActivity", "GlobalSearchActivity")
|
||||
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||
AccessibilityExtraUtil.loadingPage("ExternalGroupMessageListActivity", "ExternalWechatUserMessageListActivity", "MessageListActivity", timeout = Constant.CHANGE_PAGE_INTERVAL)
|
||||
return checkRoom(title, strict = false)
|
||||
} else {
|
||||
LogUtils.e("搜索到已退出群聊")
|
||||
@@ -278,10 +278,11 @@ object WeworkRoomUtil {
|
||||
return false
|
||||
}
|
||||
val roomType = getRoomType()
|
||||
val dealTitle = title.replace("…", "").replace("\\(.*?\\)".toRegex(), "")
|
||||
val dealTitle = title.replace(Constant.suffixRegex, "")
|
||||
LogUtils.v("dealTitle: $dealTitle", "titleList: ${titleList.joinToString()}")
|
||||
if (roomType != WeworkMessageBean.ROOM_TYPE_UNKNOWN
|
||||
&& (titleList.count { dealTitle == it.replace("…", "").replace("\\(.*?\\)".toRegex(), "") } > 0
|
||||
|| (!strict && titleList.count { dealTitle.contains(it.replace("…", "").replace("\\(.*?\\)".toRegex(), "")) } > 0))
|
||||
&& (titleList.count { dealTitle == it.replace(Constant.suffixRegex, "") } > 0
|
||||
|| (!strict && titleList.count { dealTitle.contains(it.replace(Constant.suffixRegex, "")) } > 0))
|
||||
) {
|
||||
intoRoomPreInit()
|
||||
LogUtils.d("当前正在房间")
|
||||
@@ -295,7 +296,7 @@ object WeworkRoomUtil {
|
||||
* 群名最后有(\d)显示群人数
|
||||
*/
|
||||
private fun isGroupChat(roomTitle: ArrayList<String>): Boolean {
|
||||
return roomTitle.size > 1 && roomTitle[1].contains("\\(\\d+\\)$".toRegex())
|
||||
return roomTitle.size > 1 && roomTitle[1].contains(Constant.digitalRegex)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user