update 循环去重处理

This commit is contained in:
gallonyin
2023-07-30 23:41:20 +08:00
parent 3ab72fb87b
commit 9a2503d5e3

View File

@@ -13,6 +13,7 @@ import java.io.File
import java.lang.Exception import java.lang.Exception
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
import kotlin.collections.LinkedHashSet
/** /**
@@ -43,7 +44,7 @@ object WeworkOperationImpl {
} }
val successList = arrayListOf<String>() val successList = arrayListOf<String>()
val failList = arrayListOf<String>() val failList = arrayListOf<String>()
for (title in titleList) { for (title in LinkedHashSet(titleList)) {
var successFlag = true var successFlag = true
if (WeworkRoomUtil.intoRoom(title) || WeworkRoomUtil.intoRoom(title, fastIn = false)) { if (WeworkRoomUtil.intoRoom(title) || WeworkRoomUtil.intoRoom(title, fastIn = false)) {
if (sendChatMessage(receivedContent, at = at, atList = atList, title = title)) { if (sendChatMessage(receivedContent, at = at, atList = atList, title = title)) {
@@ -106,7 +107,7 @@ object WeworkOperationImpl {
} }
val successList = arrayListOf<String>() val successList = arrayListOf<String>()
val failList = arrayListOf<String>() val failList = arrayListOf<String>()
for (title in titleList) { for (title in LinkedHashSet(titleList)) {
if (WeworkRoomUtil.intoRoom(title) || WeworkRoomUtil.intoRoom(title, fastIn = false)) { if (WeworkRoomUtil.intoRoom(title) || WeworkRoomUtil.intoRoom(title, fastIn = false)) {
if (WeworkTextUtil.longClickMessageItem( if (WeworkTextUtil.longClickMessageItem(
//聊天消息列表 1ListView 0RecycleView xViewGroup //聊天消息列表 1ListView 0RecycleView xViewGroup
@@ -179,7 +180,7 @@ object WeworkOperationImpl {
extraText: String? = null extraText: String? = null
): Boolean { ): Boolean {
val startTime = System.currentTimeMillis() val startTime = System.currentTimeMillis()
for (title in titleList) { for (title in LinkedHashSet(titleList)) {
if (WeworkRoomUtil.intoRoom(title) || WeworkRoomUtil.intoRoom(title, fastIn = false)) { if (WeworkRoomUtil.intoRoom(title) || WeworkRoomUtil.intoRoom(title, fastIn = false)) {
if (!receivedName.isNullOrEmpty()) { if (!receivedName.isNullOrEmpty()) {
if (WeworkTextUtil.longClickMessageItem( if (WeworkTextUtil.longClickMessageItem(
@@ -868,7 +869,7 @@ object WeworkOperationImpl {
textType: Int textType: Int
): Boolean { ): Boolean {
val startTime = System.currentTimeMillis() val startTime = System.currentTimeMillis()
for (title in titleList) { for (title in LinkedHashSet(titleList)) {
if (WeworkRoomUtil.intoRoom(title) || WeworkRoomUtil.intoRoom(title, fastIn = false)) { if (WeworkRoomUtil.intoRoom(title) || WeworkRoomUtil.intoRoom(title, fastIn = false)) {
if (WeworkTextUtil.longClickMyMessageItem( if (WeworkTextUtil.longClickMyMessageItem(
//聊天消息列表 1ListView 0RecycleView xViewGroup //聊天消息列表 1ListView 0RecycleView xViewGroup
@@ -1112,7 +1113,7 @@ object WeworkOperationImpl {
LogUtils.d("receivedName $receivedName textType $textType originalContent $originalContent") LogUtils.d("receivedName $receivedName textType $textType originalContent $originalContent")
return relayMessage(message, titleList, receivedName, originalContent, textType, nameList, extraText) return relayMessage(message, titleList, receivedName, originalContent, textType, nameList, extraText)
} }
for (title in titleList) { for (title in LinkedHashSet(titleList)) {
if (WeworkRoomUtil.intoRoom(title) || WeworkRoomUtil.intoRoom(title, fastIn = false)) { if (WeworkRoomUtil.intoRoom(title) || WeworkRoomUtil.intoRoom(title, fastIn = false)) {
var hasOpenMulti = false var hasOpenMulti = false
for (subMessageBean in messageList) { for (subMessageBean in messageList) {
@@ -1786,7 +1787,7 @@ object WeworkOperationImpl {
textType: Int textType: Int
): Boolean { ): Boolean {
val startTime = System.currentTimeMillis() val startTime = System.currentTimeMillis()
for (groupName in titleList) { for (groupName in LinkedHashSet(titleList)) {
if (WeworkRoomUtil.intoRoom(groupName) && WeworkRoomUtil.intoGroupManager()) { if (WeworkRoomUtil.intoRoom(groupName) && WeworkRoomUtil.intoGroupManager()) {
val groupInfo = WeworkGetImpl.getGroupInfoDetail() val groupInfo = WeworkGetImpl.getGroupInfoDetail()
groupInfo.titleList = arrayListOf(groupName) groupInfo.titleList = arrayListOf(groupName)
@@ -1826,7 +1827,7 @@ object WeworkOperationImpl {
AccessibilityUtil.performClick(multiButton) AccessibilityUtil.performClick(multiButton)
AccessibilityUtil.performClick(searchButton) AccessibilityUtil.performClick(searchButton)
var isSelect = false var isSelect = false
for (select in selectList) { for (select in LinkedHashSet(selectList)) {
val needTrim = select.contains(Constant.regTrimTitle) val needTrim = select.contains(Constant.regTrimTitle)
val trimTitle = select.replace(Constant.regTrimTitle, "") val trimTitle = select.replace(Constant.regTrimTitle, "")
AccessibilityUtil.findTextInput(getRoot(), trimTitle) AccessibilityUtil.findTextInput(getRoot(), trimTitle)
@@ -2030,7 +2031,7 @@ object WeworkOperationImpl {
if (textViewList.size >= 2) { if (textViewList.size >= 2) {
val multiButton = textViewList.lastOrNull() val multiButton = textViewList.lastOrNull()
var count = 0 var count = 0
for (select in selectList) { for (select in LinkedHashSet(selectList)) {
val needTrim = select.contains(Constant.regTrimTitle) val needTrim = select.contains(Constant.regTrimTitle)
val trimTitle = select.replace(Constant.regTrimTitle, "") val trimTitle = select.replace(Constant.regTrimTitle, "")
AccessibilityUtil.performClick(multiButton) AccessibilityUtil.performClick(multiButton)
@@ -2155,7 +2156,7 @@ object WeworkOperationImpl {
if (textViewList.size >= 2) { if (textViewList.size >= 2) {
val multiButton = textViewList.lastOrNull() val multiButton = textViewList.lastOrNull()
var count = 0 var count = 0
for (select in removeList) { for (select in LinkedHashSet(removeList)) {
val needTrim = select.contains(Constant.regTrimTitle) val needTrim = select.contains(Constant.regTrimTitle)
val trimTitle = select.replace(Constant.regTrimTitle, "") val trimTitle = select.replace(Constant.regTrimTitle, "")
AccessibilityUtil.performClick(multiButton) AccessibilityUtil.performClick(multiButton)
@@ -2423,7 +2424,7 @@ object WeworkOperationImpl {
} }
atList.removeIf { it.startsWith("#regex#") } atList.removeIf { it.startsWith("#regex#") }
LogUtils.v("atList: ${atList.joinToString()}") LogUtils.v("atList: ${atList.joinToString()}")
atList.forEachIndexed { index, at -> LinkedHashSet(atList).forEachIndexed { index, at ->
if (index == 0) { if (index == 0) {
AccessibilityUtil.findTextInput(getRoot(), "@") AccessibilityUtil.findTextInput(getRoot(), "@")
} else { } else {