update 删除联系人
This commit is contained in:
@@ -44,6 +44,8 @@ public class WeworkMessageBean {
|
|||||||
* 合并转发 RELAY_MERGE_MESSAGE
|
* 合并转发 RELAY_MERGE_MESSAGE
|
||||||
* 批量发送 SEND_MULTI_MESSAGE
|
* 批量发送 SEND_MULTI_MESSAGE
|
||||||
* 合并发送 SEND_MERGE_MESSAGE
|
* 合并发送 SEND_MERGE_MESSAGE
|
||||||
|
* 扫一扫 SCAN_QR_CODE
|
||||||
|
* 删除联系人 DELETE_CONTACT
|
||||||
* <p>
|
* <p>
|
||||||
* 非操作类型 300
|
* 非操作类型 300
|
||||||
* 机器人普通日志记录 ROBOT_LOG
|
* 机器人普通日志记录 ROBOT_LOG
|
||||||
@@ -97,6 +99,7 @@ public class WeworkMessageBean {
|
|||||||
public static final int VOICE_CALL = 231;
|
public static final int VOICE_CALL = 231;
|
||||||
public static final int VIDEO_CALL = 232;
|
public static final int VIDEO_CALL = 232;
|
||||||
public static final int SCAN_QR_CODE = 233;
|
public static final int SCAN_QR_CODE = 233;
|
||||||
|
public static final int DELETE_CONTACT = 234;
|
||||||
|
|
||||||
public static final int ROBOT_LOG = 301;
|
public static final int ROBOT_LOG = 301;
|
||||||
public static final int ROBOT_ERROR_LOG = 302;
|
public static final int ROBOT_ERROR_LOG = 302;
|
||||||
|
|||||||
@@ -193,6 +193,9 @@ object MyLooper {
|
|||||||
WeworkMessageBean.SCAN_QR_CODE -> {
|
WeworkMessageBean.SCAN_QR_CODE -> {
|
||||||
WeworkController.scanQrCode(message)
|
WeworkController.scanQrCode(message)
|
||||||
}
|
}
|
||||||
|
WeworkMessageBean.DELETE_CONTACT -> {
|
||||||
|
WeworkController.deleteContact(message)
|
||||||
|
}
|
||||||
WeworkMessageBean.DISMISS_GROUP -> {
|
WeworkMessageBean.DISMISS_GROUP -> {
|
||||||
WeworkController.dismissGroup(message)
|
WeworkController.dismissGroup(message)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -529,6 +529,17 @@ object WeworkController {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除联系人
|
||||||
|
* @see WeworkMessageBean.DELETE_CONTACT
|
||||||
|
* @param message#friend 待删除用户
|
||||||
|
*/
|
||||||
|
@RequestMapping
|
||||||
|
fun deleteContact(message: WeworkMessageBean): Boolean {
|
||||||
|
LogUtils.d("deleteContact(): ${message.friend}")
|
||||||
|
return WeworkOperationImpl.deleteContact(message, message.friend)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取群信息
|
* 获取群信息
|
||||||
* @see WeworkMessageBean.GET_GROUP_INFO
|
* @see WeworkMessageBean.GET_GROUP_INFO
|
||||||
|
|||||||
@@ -1776,6 +1776,61 @@ object WeworkOperationImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除联系人
|
||||||
|
* @see WeworkMessageBean.DELETE_CONTACT
|
||||||
|
* @param friend 待删除用户
|
||||||
|
*/
|
||||||
|
fun deleteContact(message: WeworkMessageBean, friend: WeworkMessageBean.Friend): Boolean {
|
||||||
|
val startTime = System.currentTimeMillis()
|
||||||
|
if (friend.phone == null && friend.name != null) {
|
||||||
|
if (getFriendInfo(friend.name) && AccessibilityExtraUtil.loadingPage("ContactDetailBaseContentActivity")) {
|
||||||
|
val imageView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ImageView)
|
||||||
|
val frontNode = AccessibilityUtil.findFrontNode(imageView?.parent)
|
||||||
|
val textViewList = AccessibilityUtil.findAllOnceByClazz(frontNode, Views.TextView)
|
||||||
|
if (textViewList.size >= 2) {
|
||||||
|
val multiButton: AccessibilityNodeInfo = textViewList[textViewList.size - 1]
|
||||||
|
AccessibilityUtil.performClick(multiButton)
|
||||||
|
if (AccessibilityExtraUtil.loadingPage("ContactDetailSettingActivity")) {
|
||||||
|
val tvDelete = AccessibilityUtil.scrollAndFindByText(WeworkController.weworkService, getRoot(), "删除", exact = true)
|
||||||
|
if (tvDelete != null) {
|
||||||
|
AccessibilityUtil.performClick(tvDelete)
|
||||||
|
if (AccessibilityUtil.findTextAndClick(getRoot(), "确认删除", exact = true)) {
|
||||||
|
LogUtils.d("删除联系人成功: ${friend.name}")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.SUCCESS, "", startTime, listOf(friend.name), listOf())
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
LogUtils.e("未找到确认删除按钮: ${friend.name}")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到确认删除按钮: ${friend.name}", startTime, listOf(), listOf(friend.name))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtils.e("未找到删除按钮: ${friend.name}")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到删除按钮: ${friend.name}", startTime, listOf(), listOf(friend.name))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtils.e("进入个人信息详情页失败: ${friend.name}")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "进入个人信息详情页失败: ${friend.name}", startTime, listOf(), listOf(friend.name))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtils.e("未找到更多按钮: ${friend.name}")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到更多按钮: ${friend.name}", startTime, listOf(), listOf(friend.name))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtils.e("未找到用户: ${friend.name}")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_TARGET, "未找到用户: ${friend.name}", startTime, listOf(), listOf(friend.name))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtils.e("数据异常: ${friend.name}")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_ILLEGAL_DATA, "数据异常: ${friend.name}", startTime, listOf(), listOf(friend.name))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 展示群信息
|
* 展示群信息
|
||||||
* @see WeworkMessageBean.SHOW_GROUP_INFO
|
* @see WeworkMessageBean.SHOW_GROUP_INFO
|
||||||
@@ -2525,6 +2580,7 @@ object WeworkOperationImpl {
|
|||||||
timeout = 2000,
|
timeout = 2000,
|
||||||
root = false
|
root = false
|
||||||
)
|
)
|
||||||
|
var isSelect = false
|
||||||
if (selectListView != null && matchSelect != null) {
|
if (selectListView != null && matchSelect != null) {
|
||||||
for (i in 0 until selectListView.childCount) {
|
for (i in 0 until selectListView.childCount) {
|
||||||
val item = selectListView.getChild(i)
|
val item = selectListView.getChild(i)
|
||||||
@@ -2534,12 +2590,14 @@ object WeworkOperationImpl {
|
|||||||
item.refresh()
|
item.refresh()
|
||||||
val imageView =
|
val imageView =
|
||||||
AccessibilityUtil.findOneByClazz(item, Views.ImageView, root = false)
|
AccessibilityUtil.findOneByClazz(item, Views.ImageView, root = false)
|
||||||
AccessibilityUtil.performClick(imageView)
|
AccessibilityUtil.clickByNode(WeworkController.weworkService, imageView)
|
||||||
|
LogUtils.d("选择联系人")
|
||||||
|
isSelect = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (matchSelect != null) {
|
if (isSelect) {
|
||||||
LogUtils.d("找到搜索结果: $title")
|
LogUtils.d("找到搜索结果: $title")
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user