update 优化目标房间检查

This commit is contained in:
gallonyin
2023-11-23 23:23:04 +08:00
parent de582eb533
commit 9080e051cc
2 changed files with 9 additions and 3 deletions

View File

@@ -30,6 +30,7 @@ object Constant {
val wsRegex = "^ws".toRegex() val wsRegex = "^ws".toRegex()
val suffixString = "(-.*)?(…)?(\\(\\d+\\))?$" val suffixString = "(-.*)?(…)?(\\(\\d+\\))?$"
val suffixRegex = "(-.*)?(…)?(\\(\\d+\\))?$".toRegex() val suffixRegex = "(-.*)?(…)?(\\(\\d+\\))?$".toRegex()
val groupSuffixRegex = "(…)?(\\(\\d+\\))?$".toRegex()
val digitalRegex = "\\(\\d+\\)\$".toRegex() val digitalRegex = "\\(\\d+\\)\$".toRegex()
var weworkCorpName: String var weworkCorpName: String
get() = SPUtils.getInstance().getString("weworkCorpName", "") get() = SPUtils.getInstance().getString("weworkCorpName", "")

View File

@@ -290,11 +290,16 @@ object WeworkRoomUtil {
titleList = getFullGroupTitle() titleList = getFullGroupTitle()
} }
} }
val dealTitle = title.replace(Constant.suffixRegex, "") val suffixRegex = if (roomType == WeworkMessageBean.ROOM_TYPE_EXTERNAL_GROUP || roomType == WeworkMessageBean.ROOM_TYPE_INTERNAL_GROUP) {
Constant.groupSuffixRegex
} else {
Constant.suffixRegex
}
val dealTitle = title.replace(suffixRegex, "")
LogUtils.d("dealTitle: $dealTitle", "titleList: ${titleList.joinToString()}") LogUtils.d("dealTitle: $dealTitle", "titleList: ${titleList.joinToString()}")
if (roomType != WeworkMessageBean.ROOM_TYPE_UNKNOWN if (roomType != WeworkMessageBean.ROOM_TYPE_UNKNOWN
&& (titleList.count { dealTitle == it.replace(Constant.suffixRegex, "") } > 0 && (titleList.count { dealTitle == it.replace(suffixRegex, "") } > 0
|| ((!strict || !Constant.fullGroupName) && titleList.count { dealTitle.contains(it.replace(Constant.suffixRegex, "")) } > 0)) || ((!strict || !Constant.fullGroupName) && titleList.count { dealTitle.contains(it.replace(suffixRegex, "")) } > 0))
) { ) {
intoRoomPreInit() intoRoomPreInit()
LogUtils.d("当前正在房间") LogUtils.d("当前正在房间")