update 优化房间名校验
This commit is contained in:
@@ -134,7 +134,7 @@ object WeworkRoomUtil {
|
|||||||
intoRoomPreInit()
|
intoRoomPreInit()
|
||||||
AccessibilityUtil.performClick(searchItem)
|
AccessibilityUtil.performClick(searchItem)
|
||||||
val text = AccessibilityUtil.findAllOnceByClazz(searchItem.parent, Views.TextView).firstOrNull { it.text != null && !it.text.isNullOrBlank() }
|
val text = AccessibilityUtil.findAllOnceByClazz(searchItem.parent, Views.TextView).firstOrNull { it.text != null && !it.text.isNullOrBlank() }
|
||||||
val title = text?.toString() ?: title
|
val title = text?.text?.toString() ?: title
|
||||||
LogUtils.d("进入房间: $title")
|
LogUtils.d("进入房间: $title")
|
||||||
AccessibilityUtil.waitForPageMissing("WwMainActivity", "GlobalSearchActivity")
|
AccessibilityUtil.waitForPageMissing("WwMainActivity", "GlobalSearchActivity")
|
||||||
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||||
@@ -274,13 +274,14 @@ object WeworkRoomUtil {
|
|||||||
private fun checkRoom(title: String, strict: Boolean = false): Boolean {
|
private fun checkRoom(title: String, strict: Boolean = false): Boolean {
|
||||||
LogUtils.d("checkRoom(): $title")
|
LogUtils.d("checkRoom(): $title")
|
||||||
val titleList = getRoomTitle(print = false)
|
val titleList = getRoomTitle(print = false)
|
||||||
|
if (titleList.isEmpty()) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
val roomType = getRoomType()
|
val roomType = getRoomType()
|
||||||
|
val dealTitle = title.replace("…", "").replace("\\(.*?\\)".toRegex(), "")
|
||||||
if (roomType != WeworkMessageBean.ROOM_TYPE_UNKNOWN
|
if (roomType != WeworkMessageBean.ROOM_TYPE_UNKNOWN
|
||||||
&& (titleList.count {
|
&& (titleList.count { dealTitle == it.replace("…", "").replace("\\(.*?\\)".toRegex(), "") } > 0
|
||||||
it.replace("…", "").replace("\\(.*?\\)".toRegex(), "") == title.replace("…", "")
|
|| (!strict && titleList.count { dealTitle.contains(it.replace("…", "").replace("\\(.*?\\)".toRegex(), "")) } > 0))
|
||||||
.replace("\\(.*?\\)".toRegex(), "")
|
|
||||||
} > 0
|
|
||||||
|| (!strict && titleList.count { title.contains(it.replace("…", "").replace("\\(.*?\\)".toRegex(), "")) } > 0))
|
|
||||||
) {
|
) {
|
||||||
intoRoomPreInit()
|
intoRoomPreInit()
|
||||||
LogUtils.d("当前正在房间")
|
LogUtils.d("当前正在房间")
|
||||||
|
|||||||
Reference in New Issue
Block a user