update at列表优化模式

This commit is contained in:
gallonyin
2023-03-25 17:34:01 +08:00
parent 3591fee868
commit 40ca3c9fde
2 changed files with 31 additions and 8 deletions

View File

@@ -285,6 +285,13 @@ object WeworkGetImpl {
}
}
}
val tvCountFlag = AccessibilityUtil.findOnceByText(getRoot(), "查看全部群成员", exact = true)
val tvCount = AccessibilityUtil.findBackNode(tvCountFlag)
if (tvCount != null && tvCount.text != null) {
LogUtils.d("群成员: " + tvCount.text)
val count = tvCount.text.toString().replace("", "")
weworkMessageBean.groupNumber = count.toIntOrNull()
}
val gridView = AccessibilityUtil.findOneByClazz(getRoot(), Views.GridView)
if (gridView != null && gridView.childCount >= 2) {
val tvOwnerName = AccessibilityUtil.findOnceByClazz(gridView.getChild(0), Views.TextView)
@@ -292,13 +299,17 @@ object WeworkGetImpl {
LogUtils.d("群主: " + tvOwnerName.text)
weworkMessageBean.groupOwner = tvOwnerName.text.toString()
}
if (!saveMembers && weworkMessageBean.groupNumber ?: 0 <= 8) {
val set = linkedSetOf<String>()
for (i in 0 until gridView.childCount) {
val item = gridView.getChild(i)
val name = AccessibilityUtil.findOnceByClazz(item, Views.TextView)?.text?.toString()
?: continue
set.add(name)
}
LogUtils.d("群成员: ${set.joinToString()}")
weworkMessageBean.nameList = set.toList()
}
val tvCountFlag = AccessibilityUtil.findOnceByText(getRoot(), "查看全部群成员", exact = true)
val tvCount = AccessibilityUtil.findBackNode(tvCountFlag)
if (tvCount != null && tvCount.text != null) {
LogUtils.d("群成员: " + tvCount.text)
val count = tvCount.text.toString().replace("", "")
weworkMessageBean.groupNumber = count.toIntOrNull()
}
val tvAnnouncementFlag = AccessibilityUtil.findOnceByText(getRoot(), "群公告", exact = true)
val tvAnnouncement = AccessibilityUtil.findBackNode(tvAnnouncementFlag)

View File

@@ -1707,8 +1707,20 @@ object WeworkOperationImpl {
AccessibilityUtil.performClickWithSon(AccessibilityUtil.findFrontNode(voiceFlag))
}
var atFailed = false
val atList = if (!at.isNullOrEmpty()) listOf(at) else atList
val atList = if (!at.isNullOrEmpty()) arrayListOf(at) else atList?.toMutableList()
if (!atList.isNullOrEmpty() && (roomType == WeworkMessageBean.ROOM_TYPE_INTERNAL_GROUP || roomType == WeworkMessageBean.ROOM_TYPE_EXTERNAL_GROUP)) {
val nameList = arrayListOf<String>()
if (atList.count { it.startsWith("#regex#") } > 0 && WeworkRoomUtil.intoGroupManager()) {
val groupInfo = WeworkGetImpl.getGroupInfoDetail(saveAddress = false, saveMembers = false)
nameList.addAll(groupInfo.nameList)
val regex = atList.first { it.startsWith("#regex#") }.split("#regex#").last().toRegex()
for (name in groupInfo.nameList) {
if (name != Constant.myName && name.matches(regex)) {
atList.add(name)
}
}
}
atList.removeIf { it.startsWith("#regex#") }
atList.forEachIndexed { index, at ->
if (index == 0) {
AccessibilityUtil.findTextInput(getRoot(), "@")