Skip to content

Commit

Permalink
fix 群名过长发不出消息
Browse files Browse the repository at this point in the history
  • Loading branch information
gallonyin committed Jun 28, 2023
1 parent 8f6e87c commit 67db15c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/src/main/java/org/yameida/worktool/utils/WeworkRoomUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ object WeworkRoomUtil {
* 进入房间(单聊或群聊)
*/
fun intoRoom(title: String, fastIn: Boolean = true): Boolean {
if (checkRoom(title)) {
if (checkRoom(title, strict = true)) {
return true
}
goHome()
Expand All @@ -93,7 +93,7 @@ object WeworkRoomUtil {
LogUtils.d("快捷进入房间: $title")
AccessibilityUtil.waitForPageMissing("WwMainActivity", "GlobalSearchActivity")
sleep(Constant.CHANGE_PAGE_INTERVAL)
return checkRoom(title)
return checkRoom(title, strict = false)
}
}
}
Expand Down Expand Up @@ -136,7 +136,7 @@ object WeworkRoomUtil {
LogUtils.d("进入房间: $title")
AccessibilityUtil.waitForPageMissing("WwMainActivity", "GlobalSearchActivity")
sleep(Constant.CHANGE_PAGE_INTERVAL)
return checkRoom(title)
return checkRoom(title, strict = false)
} else {
LogUtils.e("搜索到已退出群聊")
}
Expand Down Expand Up @@ -247,15 +247,16 @@ object WeworkRoomUtil {
/**
* 检查当前房间
*/
private fun checkRoom(title: String): Boolean {
private fun checkRoom(title: String, strict: Boolean = false): Boolean {
LogUtils.d("checkRoom(): $title")
val titleList = getRoomTitle(false)
val roomType = getRoomType()
if (roomType != WeworkMessageBean.ROOM_TYPE_UNKNOWN
&& titleList.count {
&& (titleList.count {
it.replace("", "").replace("\\(.*?\\)".toRegex(), "") == title.replace("", "")
.replace("\\(.*?\\)".toRegex(), "")
} > 0
|| (!strict && titleList.count { title.contains(it.replace("", "").replace("\\(.*?\\)".toRegex(), "")) } > 0))
) {
intoRoomPreInit()
LogUtils.d("当前正在房间")
Expand Down

0 comments on commit 67db15c

Please sign in to comment.