fix 客户名称过长识别问题

This commit is contained in:
gallonyin
2023-08-15 22:29:51 +08:00
parent d06767dd42
commit dac046272f
3 changed files with 9 additions and 3 deletions

View File

@@ -143,8 +143,10 @@ fun getRoot(ignoreCheck: Boolean, share: Boolean = false): AccessibilityNodeInfo
if (!share) { if (!share) {
WeworkController.weworkService.currentPackage = root.packageName?.toString() ?: "" WeworkController.weworkService.currentPackage = root.packageName?.toString() ?: ""
if (System.currentTimeMillis() % 30 == 0L) { if (System.currentTimeMillis() % 30 == 0L) {
LogUtils.e("当前不在企业微信: ${root.packageName}")
error("当前不在企业微信: ${root.packageName}") error("当前不在企业微信: ${root.packageName}")
if (!FloatWindowHelper.isPause) { if (!FloatWindowHelper.isPause) {
LogUtils.e("当前不在企业微信: ${root.packageName}\n尝试跳转到企业微信")
ToastUtils.show("当前不在企业微信: ${root.packageName}\n尝试跳转到企业微信") ToastUtils.show("当前不在企业微信: ${root.packageName}\n尝试跳转到企业微信")
Utils.getApp().packageManager.getLaunchIntentForPackage(Constant.PACKAGE_NAMES) Utils.getApp().packageManager.getLaunchIntentForPackage(Constant.PACKAGE_NAMES)
?.apply { ?.apply {

View File

@@ -164,6 +164,7 @@ object WeworkLoopImpl {
val roomType = WeworkRoomUtil.getRoomType() val roomType = WeworkRoomUtil.getRoomType()
var titleList = WeworkRoomUtil.getRoomTitle() var titleList = WeworkRoomUtil.getRoomTitle()
if (titleList.count { it.endsWith("") } > 0) { if (titleList.count { it.endsWith("") } > 0) {
LogUtils.d("title too long... try get full name")
if (roomType == WeworkMessageBean.ROOM_TYPE_INTERNAL_CONTACT || roomType == WeworkMessageBean.ROOM_TYPE_EXTERNAL_CONTACT) { if (roomType == WeworkMessageBean.ROOM_TYPE_INTERNAL_CONTACT || roomType == WeworkMessageBean.ROOM_TYPE_EXTERNAL_CONTACT) {
titleList = WeworkRoomUtil.getFriendName() titleList = WeworkRoomUtil.getFriendName()
} else if (Constant.fullGroupName } else if (Constant.fullGroupName

View File

@@ -184,7 +184,7 @@ object WeworkRoomUtil {
* @return true 成功进入好友详情页 * @return true 成功进入好友详情页
*/ */
fun intoFriendDetail(): Boolean { fun intoFriendDetail(): Boolean {
if (AccessibilityUtil.findOneByText(getRoot(), "设置聊天背景") != null) { if (AccessibilityUtil.findOnceByText(getRoot(), "设置聊天背景") != null) {
return true return true
} }
//同群详情列表 //同群详情列表
@@ -217,10 +217,13 @@ object WeworkRoomUtil {
for (textView in tvList) { for (textView in tvList) {
if (textView.text != null) { if (textView.text != null) {
titleList.add(textView.text.toString()) titleList.add(textView.text.toString())
}
}
}
backPress() backPress()
} LogUtils.d("获取好友名称成功 ${titleList.joinToString()}")
} } else {
} LogUtils.e("获取好友名称失败")
} }
return titleList return titleList
} }
@@ -251,7 +254,7 @@ 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(false) val titleList = getRoomTitle(print = false)
val roomType = getRoomType() val roomType = getRoomType()
if (roomType != WeworkMessageBean.ROOM_TYPE_UNKNOWN if (roomType != WeworkMessageBean.ROOM_TYPE_UNKNOWN
&& (titleList.count { && (titleList.count {