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