update 解散群;改群模板;过滤已退出群聊
This commit is contained in:
@@ -32,6 +32,8 @@ data class ExecCallbackBean(
|
|||||||
const val ERROR_ILLEGAL_DATA = 101011
|
const val ERROR_ILLEGAL_DATA = 101011
|
||||||
//非法操作
|
//非法操作
|
||||||
const val ERROR_ILLEGAL_OPERATION = 101012
|
const val ERROR_ILLEGAL_OPERATION = 101012
|
||||||
|
//非法权限
|
||||||
|
const val ERROR_ILLEGAL_PERMISSION = 101013
|
||||||
|
|
||||||
//创建群失败
|
//创建群失败
|
||||||
const val ERROR_CREATE_GROUP = 201011
|
const val ERROR_CREATE_GROUP = 201011
|
||||||
@@ -45,6 +47,8 @@ data class ExecCallbackBean(
|
|||||||
const val ERROR_GROUP_CHANGE_ANNOUNCEMENT = 201015
|
const val ERROR_GROUP_CHANGE_ANNOUNCEMENT = 201015
|
||||||
//改群备注失败
|
//改群备注失败
|
||||||
const val ERROR_GROUP_CHANGE_REMARK = 201016
|
const val ERROR_GROUP_CHANGE_REMARK = 201016
|
||||||
|
//改群模板失败
|
||||||
|
const val ERROR_GROUP_TEMPLATE = 201017
|
||||||
//查找聊天窗失败
|
//查找聊天窗失败
|
||||||
const val ERROR_INTO_ROOM = 201101
|
const val ERROR_INTO_ROOM = 201101
|
||||||
//发送消息失败
|
//发送消息失败
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public class WeworkMessageBean {
|
|||||||
public static final int UPDATE_ANTI_HARASSMENT_RULE = 216;
|
public static final int UPDATE_ANTI_HARASSMENT_RULE = 216;
|
||||||
public static final int DELETED_ANTI_HARASSMENT_RULE = 217;
|
public static final int DELETED_ANTI_HARASSMENT_RULE = 217;
|
||||||
public static final int PUSH_FILE = 218;
|
public static final int PUSH_FILE = 218;
|
||||||
|
public static final int DISMISS_GROUP = 219;
|
||||||
|
|
||||||
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;
|
||||||
|
|||||||
@@ -138,6 +138,9 @@ object MyLooper {
|
|||||||
WeworkMessageBean.PUSH_FILE -> {
|
WeworkMessageBean.PUSH_FILE -> {
|
||||||
WeworkController.pushFile(message)
|
WeworkController.pushFile(message)
|
||||||
}
|
}
|
||||||
|
WeworkMessageBean.DISMISS_GROUP -> {
|
||||||
|
WeworkController.dismissGroup(message)
|
||||||
|
}
|
||||||
WeworkMessageBean.PASS_ALL_FRIEND_REQUEST -> {
|
WeworkMessageBean.PASS_ALL_FRIEND_REQUEST -> {
|
||||||
}
|
}
|
||||||
WeworkMessageBean.ADD_FRIEND_BY_PHONE -> {
|
WeworkMessageBean.ADD_FRIEND_BY_PHONE -> {
|
||||||
|
|||||||
@@ -119,16 +119,18 @@ object WeworkController {
|
|||||||
* @param message#selectList 添加群成员名称列表 选填
|
* @param message#selectList 添加群成员名称列表 选填
|
||||||
* @param message#groupAnnouncement 修改群公告 选填
|
* @param message#groupAnnouncement 修改群公告 选填
|
||||||
* @param message#groupRemark 修改群备注 选填
|
* @param message#groupRemark 修改群备注 选填
|
||||||
|
* @param message#groupTemplate 修改群模板 选填
|
||||||
*/
|
*/
|
||||||
@RequestMapping
|
@RequestMapping
|
||||||
fun initGroup(message: WeworkMessageBean): Boolean {
|
fun initGroup(message: WeworkMessageBean): Boolean {
|
||||||
LogUtils.d("initGroup(): ${message.groupName} ${message.selectList} ${message.groupAnnouncement} ${message.groupRemark}")
|
LogUtils.d("initGroup(): ${message.groupName} ${message.selectList} ${message.groupAnnouncement} ${message.groupRemark} ${message.groupTemplate}")
|
||||||
return WeworkOperationImpl.initGroup(
|
return WeworkOperationImpl.initGroup(
|
||||||
message,
|
message,
|
||||||
message.groupName,
|
message.groupName,
|
||||||
message.selectList,
|
message.selectList,
|
||||||
message.groupAnnouncement,
|
message.groupAnnouncement,
|
||||||
message.groupRemark
|
message.groupRemark,
|
||||||
|
message.groupTemplate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,25 +152,41 @@ object WeworkController {
|
|||||||
* @param message#newGroupName 修改群名 选填
|
* @param message#newGroupName 修改群名 选填
|
||||||
* @param message#newGroupAnnouncement 修改群公告 选填
|
* @param message#newGroupAnnouncement 修改群公告 选填
|
||||||
* @param message#groupRemark 修改群备注 选填
|
* @param message#groupRemark 修改群备注 选填
|
||||||
|
* @param message#groupTemplate 修改群模板 选填
|
||||||
* @param message#selectList 添加群成员名称列表/拉人 选填
|
* @param message#selectList 添加群成员名称列表/拉人 选填
|
||||||
* @param message#showMessageHistory 拉人是否附带历史记录 选填
|
* @param message#showMessageHistory 拉人是否附带历史记录 选填
|
||||||
* @param message#removeList 移除群成员名称列表/踢人 选填
|
* @param message#removeList 移除群成员名称列表/踢人 选填
|
||||||
*/
|
*/
|
||||||
@RequestMapping
|
@RequestMapping
|
||||||
fun intoGroupAndConfig(message: WeworkMessageBean): Boolean {
|
fun intoGroupAndConfig(message: WeworkMessageBean): Boolean {
|
||||||
LogUtils.d("intoGroupAndConfig(): ${message.groupName} ${message.newGroupName} ${message.newGroupAnnouncement} ${message.selectList} ${message.showMessageHistory} ${message.removeList} ${message.groupRemark}")
|
LogUtils.d("intoGroupAndConfig(): ${message.groupName} ${message.newGroupName} ${message.newGroupAnnouncement} ${message.selectList} ${message.showMessageHistory} ${message.removeList} ${message.groupRemark} ${message.groupTemplate}")
|
||||||
return WeworkOperationImpl.intoGroupAndConfig(
|
return WeworkOperationImpl.intoGroupAndConfig(
|
||||||
message,
|
message,
|
||||||
message.groupName,
|
message.groupName,
|
||||||
message.newGroupName,
|
message.newGroupName,
|
||||||
message.newGroupAnnouncement,
|
message.newGroupAnnouncement,
|
||||||
message.groupRemark,
|
message.groupRemark,
|
||||||
|
message.groupTemplate,
|
||||||
message.selectList,
|
message.selectList,
|
||||||
message.showMessageHistory,
|
message.showMessageHistory,
|
||||||
message.removeList
|
message.removeList
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解散群聊
|
||||||
|
* @see WeworkMessageBean.DISMISS_GROUP
|
||||||
|
* @param message#groupName 待解散的群
|
||||||
|
*/
|
||||||
|
@RequestMapping
|
||||||
|
fun dismissGroup(message: WeworkMessageBean): Boolean {
|
||||||
|
LogUtils.d("dismissGroup(): ${message.groupName}")
|
||||||
|
return WeworkOperationImpl.dismissGroup(
|
||||||
|
message,
|
||||||
|
message.groupName
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送微盘图片
|
* 推送微盘图片
|
||||||
* @see WeworkMessageBean.PUSH_MICRO_DISK_IMAGE
|
* @see WeworkMessageBean.PUSH_MICRO_DISK_IMAGE
|
||||||
|
|||||||
@@ -195,23 +195,23 @@ object WeworkOperationImpl {
|
|||||||
* 7.设置入群欢迎语 默认为空
|
* 7.设置入群欢迎语 默认为空
|
||||||
* 8.拉入机器人 暂不开发
|
* 8.拉入机器人 暂不开发
|
||||||
* 9.防骚扰 默认警告模式
|
* 9.防骚扰 默认警告模式
|
||||||
* 10.使用群配置模板 延迟开发
|
* 10.使用群配置模板
|
||||||
* 11.消息免打扰 默认禁止
|
* 11.消息免打扰 默认禁止
|
||||||
* 12.保存到通讯录 默认开启
|
* 12.保存到通讯录 默认开启
|
||||||
* 注:群配置模板 1.群名称 2.禁群改名(使用) 3.设置管理员 4.入群欢迎语(使用) 5.自动回复 6.防骚扰规则(使用)
|
* 注:群配置模板 1.群名称 2.禁群改名(使用) 3.设置管理员 4.入群欢迎语(使用) 5.自动回复 6.防骚扰规则(使用)
|
||||||
* 必须人工给机器人预先设置防骚扰规则 规则名"机器人"
|
|
||||||
* 必须人工给机器人预先设置群配置模板 模板名"机器人"
|
|
||||||
* @param groupName 修改群名称
|
* @param groupName 修改群名称
|
||||||
* @param selectList 添加群成员名称列表 选填
|
* @param selectList 添加群成员名称列表 选填
|
||||||
* @param groupAnnouncement 修改群公告 选填
|
* @param groupAnnouncement 修改群公告 选填
|
||||||
* @param groupRemark 修改群备注 选填
|
* @param groupRemark 修改群备注 选填
|
||||||
|
* @param groupTemplate 修改群模板 选填
|
||||||
*/
|
*/
|
||||||
fun initGroup(
|
fun initGroup(
|
||||||
message: WeworkMessageBean,
|
message: WeworkMessageBean,
|
||||||
groupName: String,
|
groupName: String,
|
||||||
selectList: List<String>?,
|
selectList: List<String>?,
|
||||||
groupAnnouncement: String?,
|
groupAnnouncement: String?,
|
||||||
groupRemark: String?
|
groupRemark: String?,
|
||||||
|
groupTemplate: String
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val startTime = System.currentTimeMillis()
|
val startTime = System.currentTimeMillis()
|
||||||
if (!WeworkRoomUtil.isGroupExists(groupName)) {
|
if (!WeworkRoomUtil.isGroupExists(groupName)) {
|
||||||
@@ -236,6 +236,10 @@ object WeworkOperationImpl {
|
|||||||
uploadCommandResult(message, ExecCallbackBean.ERROR_GROUP_CHANGE_REMARK, "创建群成功 群改名成功 群拉人成功 群公告成功 群备注失败", startTime)
|
uploadCommandResult(message, ExecCallbackBean.ERROR_GROUP_CHANGE_REMARK, "创建群成功 群改名成功 群拉人成功 群公告成功 群备注失败", startTime)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if (!groupTemplate(groupTemplate)) {
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_GROUP_TEMPLATE, "创建群成功 群改名成功 群拉人成功 群公告成功 群备注成功 群模板失败", startTime)
|
||||||
|
return false
|
||||||
|
}
|
||||||
getGroupQrcode(groupName, groupRemark)
|
getGroupQrcode(groupName, groupRemark)
|
||||||
uploadCommandResult(message, ExecCallbackBean.SUCCESS, "", startTime)
|
uploadCommandResult(message, ExecCallbackBean.SUCCESS, "", startTime)
|
||||||
return true
|
return true
|
||||||
@@ -248,6 +252,7 @@ object WeworkOperationImpl {
|
|||||||
* @param newGroupName 修改群名 选填
|
* @param newGroupName 修改群名 选填
|
||||||
* @param newGroupAnnouncement 修改群公告 选填
|
* @param newGroupAnnouncement 修改群公告 选填
|
||||||
* @param groupRemark 修改群备注 选填
|
* @param groupRemark 修改群备注 选填
|
||||||
|
* @param groupTemplate 修改群模板 选填
|
||||||
* @param selectList 添加群成员名称列表/拉人 选填
|
* @param selectList 添加群成员名称列表/拉人 选填
|
||||||
* @param showMessageHistory 拉人是否附带历史记录 选填
|
* @param showMessageHistory 拉人是否附带历史记录 选填
|
||||||
* @param removeList 移除群成员名称列表/踢人 选填
|
* @param removeList 移除群成员名称列表/踢人 选填
|
||||||
@@ -258,6 +263,7 @@ object WeworkOperationImpl {
|
|||||||
newGroupName: String?,
|
newGroupName: String?,
|
||||||
newGroupAnnouncement: String?,
|
newGroupAnnouncement: String?,
|
||||||
groupRemark: String?,
|
groupRemark: String?,
|
||||||
|
groupTemplate: String?,
|
||||||
selectList: List<String>?,
|
selectList: List<String>?,
|
||||||
showMessageHistory: Boolean = false,
|
showMessageHistory: Boolean = false,
|
||||||
removeList: List<String>?
|
removeList: List<String>?
|
||||||
@@ -287,10 +293,56 @@ object WeworkOperationImpl {
|
|||||||
uploadCommandResult(message, ExecCallbackBean.ERROR_GROUP_CHANGE_REMARK, "进入房间成功 群改名成功 群拉人成功 群公告成功 群备注失败", startTime)
|
uploadCommandResult(message, ExecCallbackBean.ERROR_GROUP_CHANGE_REMARK, "进入房间成功 群改名成功 群拉人成功 群公告成功 群备注失败", startTime)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if (!groupTemplate(groupTemplate)) {
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_GROUP_TEMPLATE, "进入房间成功 群改名成功 群拉人成功 群公告成功 群备注成功 群模板失败", startTime)
|
||||||
|
return false
|
||||||
|
}
|
||||||
uploadCommandResult(message, ExecCallbackBean.SUCCESS, "", startTime)
|
uploadCommandResult(message, ExecCallbackBean.SUCCESS, "", startTime)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解散群聊
|
||||||
|
* @see WeworkMessageBean.DISMISS_GROUP
|
||||||
|
* @param groupName 待解散的群
|
||||||
|
*/
|
||||||
|
fun dismissGroup(
|
||||||
|
message: WeworkMessageBean,
|
||||||
|
groupName: String
|
||||||
|
): Boolean {
|
||||||
|
val startTime = System.currentTimeMillis()
|
||||||
|
if (WeworkRoomUtil.intoRoom(groupName) && WeworkRoomUtil.intoGroupManager()) {
|
||||||
|
val groupManagerTv =
|
||||||
|
AccessibilityUtil.findOneByText(getRoot(), "群管理", exact = true, timeout = 2000)
|
||||||
|
if (groupManagerTv != null) {
|
||||||
|
AccessibilityUtil.performClick(groupManagerTv)
|
||||||
|
val dismissTv =
|
||||||
|
AccessibilityUtil.findOneByText(getRoot(), "解散群聊", exact = true, timeout = 2000)
|
||||||
|
AccessibilityUtil.performClick(dismissTv)
|
||||||
|
if (dismissTv != null) {
|
||||||
|
val confirmTv = AccessibilityUtil.findOneByText(getRoot(), "解散", "确定", exact = true, timeout = 2000)
|
||||||
|
if (confirmTv != null) {
|
||||||
|
AccessibilityUtil.performClick(confirmTv)
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.SUCCESS, "", startTime)
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到解散按钮 $groupName", startTime)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到解散群聊按钮 $groupName", startTime)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_BUTTON, "未找到群管理按钮 $groupName", startTime)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_INTO_ROOM, "进入房间失败 $groupName", startTime)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送微盘图片(不推荐)
|
* 推送微盘图片(不推荐)
|
||||||
* @see pushFile
|
* @see pushFile
|
||||||
@@ -495,6 +547,11 @@ object WeworkOperationImpl {
|
|||||||
extraText: String? = null
|
extraText: String? = null
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val startTime = System.currentTimeMillis()
|
val startTime = System.currentTimeMillis()
|
||||||
|
if (!PermissionUtils.isGrantedDrawOverlays()) {
|
||||||
|
LogUtils.e("未打开悬浮窗权限")
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_ILLEGAL_PERMISSION, "未打开悬浮窗权限", startTime)
|
||||||
|
return false
|
||||||
|
}
|
||||||
LogUtils.i("下载开始 $fileUrl")
|
LogUtils.i("下载开始 $fileUrl")
|
||||||
val execute = OkGo.get<File>(fileUrl).execute()
|
val execute = OkGo.get<File>(fileUrl).execute()
|
||||||
LogUtils.i("下载完成 $fileUrl")
|
LogUtils.i("下载完成 $fileUrl")
|
||||||
@@ -745,7 +802,8 @@ object WeworkOperationImpl {
|
|||||||
for (i in 0 until selectListView.childCount) {
|
for (i in 0 until selectListView.childCount) {
|
||||||
val item = selectListView.getChild(i)
|
val item = selectListView.getChild(i)
|
||||||
val searchResult = AccessibilityUtil.findOnceByTextRegex(item, regex)
|
val searchResult = AccessibilityUtil.findOnceByTextRegex(item, regex)
|
||||||
if (searchResult != null) {
|
//过滤已退出的群聊
|
||||||
|
if (searchResult != null && searchResult.parent.childCount < 3) {
|
||||||
item.refresh()
|
item.refresh()
|
||||||
val imageView =
|
val imageView =
|
||||||
AccessibilityUtil.findOneByClazz(item, Views.ImageView, root = false)
|
AccessibilityUtil.findOneByClazz(item, Views.ImageView, root = false)
|
||||||
@@ -1107,6 +1165,43 @@ object WeworkOperationImpl {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改群模板
|
||||||
|
*/
|
||||||
|
private fun groupTemplate(groupTemplate: String?): Boolean {
|
||||||
|
if (groupTemplate == null) return true
|
||||||
|
if (WeworkRoomUtil.intoGroupManager()) {
|
||||||
|
val textView = AccessibilityUtil.findOneByText(getRoot(), "使用模板快速配置群", exact = true)
|
||||||
|
if (textView != null) {
|
||||||
|
AccessibilityUtil.performClick(textView)
|
||||||
|
val item = AccessibilityUtil.findOneByDesc(getRoot(), groupTemplate)
|
||||||
|
if (item != null) {
|
||||||
|
AccessibilityUtil.performClick(item)
|
||||||
|
val useTemplateTv = AccessibilityUtil.findOneByDesc(getRoot(), "使用该模板")
|
||||||
|
if (useTemplateTv != null) {
|
||||||
|
AccessibilityUtil.performClick(useTemplateTv)
|
||||||
|
val useTv = AccessibilityUtil.findOneByDesc(getRoot(), "使用")
|
||||||
|
if (useTv != null) {
|
||||||
|
AccessibilityUtil.performClick(useTv)
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
LogUtils.e("未找到使用按钮: $groupTemplate")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtils.e("未找到使用该模板按钮: $groupTemplate")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtils.e("未找到指定配置: $groupTemplate")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtils.e("未找到使用模板按钮")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogUtils.e("进入群管理页失败")
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送消息+@at
|
* 发送消息+@at
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,11 +5,17 @@ import com.blankj.utilcode.util.ToastUtils
|
|||||||
import com.lzy.okgo.OkGo
|
import com.lzy.okgo.OkGo
|
||||||
import com.lzy.okgo.callback.StringCallback
|
import com.lzy.okgo.callback.StringCallback
|
||||||
import com.lzy.okgo.model.Response
|
import com.lzy.okgo.model.Response
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.WebSocket
|
||||||
|
import okhttp3.WebSocketListener
|
||||||
|
import okio.ByteString
|
||||||
import org.yameida.worktool.Constant
|
import org.yameida.worktool.Constant
|
||||||
|
|
||||||
object HostTestHelper {
|
object HostTestHelper {
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
OkHttpUtil
|
||||||
OkGo.get<String>(Constant.getTestUrl())
|
OkGo.get<String>(Constant.getTestUrl())
|
||||||
.execute(object : StringCallback() {
|
.execute(object : StringCallback() {
|
||||||
override fun onSuccess(response: Response<String>) {
|
override fun onSuccess(response: Response<String>) {
|
||||||
@@ -25,4 +31,33 @@ object HostTestHelper {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testWs() {
|
||||||
|
val s = OkHttpClient().newWebSocket(Request.Builder().url(Constant.getWsUrl()).build(),
|
||||||
|
object : WebSocketListener() {
|
||||||
|
override fun onOpen(webSocket: WebSocket, response: okhttp3.Response) {
|
||||||
|
ToastUtils.showLong("链接: ${Constant.getWsUrl()}\nonOpen\n" + response.body())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onMessage(webSocket: WebSocket, text: String) {
|
||||||
|
ToastUtils.showLong("链接: ${Constant.getWsUrl()}\nonMessage\ntext:$text")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onMessage(webSocket: WebSocket, bytes: ByteString) {
|
||||||
|
ToastUtils.showLong("链接: ${Constant.getWsUrl()}\nonMessage\nbytes:$bytes")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClosing(webSocket: WebSocket, code: Int, reason: String) {
|
||||||
|
ToastUtils.showLong("链接: ${Constant.getWsUrl()}\nonClosing\ncode:$code reason:$reason")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClosed(webSocket: WebSocket, code: Int, reason: String) {
|
||||||
|
ToastUtils.showLong("链接: ${Constant.getWsUrl()}\nonClosed\ncode:$code reason:$reason")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(webSocket: WebSocket, t: Throwable, response: okhttp3.Response?) {
|
||||||
|
ToastUtils.showLong("链接: ${Constant.getWsUrl()}\nonClosed\nresponse:${response?.body()} t:${t.message}")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -106,17 +106,25 @@ object WeworkRoomUtil {
|
|||||||
val selectListView = findOneByClazz(getRoot(), Views.ListView)
|
val selectListView = findOneByClazz(getRoot(), Views.ListView)
|
||||||
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
val reverseRegexTitle = RegexHelper.reverseRegexTitle(trimTitle)
|
||||||
val regex = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
val regex = "^$reverseRegexTitle" + if (needTrim) ".*?" else "(-.*)?(…)?(\\(.*?\\))?$"
|
||||||
val searchResult = AccessibilityUtil.findOneByTextRegex(
|
val searchResult = AccessibilityUtil.findAllByTextRegex(
|
||||||
selectListView,
|
selectListView,
|
||||||
regex,
|
regex,
|
||||||
timeout = 2000,
|
timeout = 2000,
|
||||||
root = false
|
root = false
|
||||||
)
|
)
|
||||||
if (searchResult != null) {
|
if (searchResult.isNotEmpty()) {
|
||||||
AccessibilityUtil.performClick(searchResult)
|
//过滤已退出的群聊
|
||||||
|
val searchItem = searchResult.firstOrNull {
|
||||||
|
it.parent.childCount < 3
|
||||||
|
}
|
||||||
|
if (searchItem != null) {
|
||||||
|
AccessibilityUtil.performClick(searchItem)
|
||||||
LogUtils.d("进入房间: $title")
|
LogUtils.d("进入房间: $title")
|
||||||
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||||
return true
|
return true
|
||||||
|
} else {
|
||||||
|
LogUtils.e("搜索到已退出群聊")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LogUtils.e("未搜索到结果")
|
LogUtils.e("未搜索到结果")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user