From 9080e051cca58d42d43e613181dff5634f8332d1 Mon Sep 17 00:00:00 2001 From: gallonyin Date: Thu, 23 Nov 2023 23:23:04 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E6=88=BF=E9=97=B4=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/org/yameida/worktool/Constant.kt | 1 + .../java/org/yameida/worktool/utils/WeworkRoomUtil.kt | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/yameida/worktool/Constant.kt b/app/src/main/java/org/yameida/worktool/Constant.kt index f0b3650..fcba8ac 100644 --- a/app/src/main/java/org/yameida/worktool/Constant.kt +++ b/app/src/main/java/org/yameida/worktool/Constant.kt @@ -30,6 +30,7 @@ object Constant { val wsRegex = "^ws".toRegex() val suffixString = "(-.*)?(…)?(\\(\\d+\\))?$" val suffixRegex = "(-.*)?(…)?(\\(\\d+\\))?$".toRegex() + val groupSuffixRegex = "(…)?(\\(\\d+\\))?$".toRegex() val digitalRegex = "\\(\\d+\\)\$".toRegex() var weworkCorpName: String get() = SPUtils.getInstance().getString("weworkCorpName", "") diff --git a/app/src/main/java/org/yameida/worktool/utils/WeworkRoomUtil.kt b/app/src/main/java/org/yameida/worktool/utils/WeworkRoomUtil.kt index 31378bf..ddda22a 100644 --- a/app/src/main/java/org/yameida/worktool/utils/WeworkRoomUtil.kt +++ b/app/src/main/java/org/yameida/worktool/utils/WeworkRoomUtil.kt @@ -290,11 +290,16 @@ object WeworkRoomUtil { 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()}") if (roomType != WeworkMessageBean.ROOM_TYPE_UNKNOWN - && (titleList.count { dealTitle == it.replace(Constant.suffixRegex, "") } > 0 - || ((!strict || !Constant.fullGroupName) && titleList.count { dealTitle.contains(it.replace(Constant.suffixRegex, "")) } > 0)) + && (titleList.count { dealTitle == it.replace(suffixRegex, "") } > 0 + || ((!strict || !Constant.fullGroupName) && titleList.count { dealTitle.contains(it.replace(suffixRegex, "")) } > 0)) ) { intoRoomPreInit() LogUtils.d("当前正在房间")