update 优化切换企业
This commit is contained in:
@@ -18,6 +18,7 @@ object Constant {
|
||||
|
||||
var version = Int.MAX_VALUE
|
||||
var myName = ""
|
||||
var myCorp = ""
|
||||
// var regTrimTitle = "(…$)|(-.*$)|(\\(.*?\\)$)".toRegex()
|
||||
var regMail = "\\S+@\\S+\\.\\S+".toRegex()
|
||||
var regTrimTitle = "(…$)".toRegex()
|
||||
|
||||
@@ -242,6 +242,7 @@ object WeworkGetImpl {
|
||||
}
|
||||
}
|
||||
Constant.myName = nickname
|
||||
Constant.myCorp = corp ?: ""
|
||||
LogUtils.d("我的昵称: ${Constant.myName}")
|
||||
val weworkMessageBean = WeworkMessageBean()
|
||||
weworkMessageBean.type = WeworkMessageBean.GET_MY_INFO
|
||||
@@ -285,6 +286,7 @@ object WeworkGetImpl {
|
||||
}
|
||||
if (firstText == "所在企业" && myInfo.corporation == null) {
|
||||
myInfo.corporation = textViewList[1].text?.toString() ?: ""
|
||||
Constant.myCorp = myInfo.corporation
|
||||
}
|
||||
if (firstText == "手机" && myInfo.phone == null) {
|
||||
myInfo.phone = textViewList[1].text?.toString() ?: ""
|
||||
|
||||
@@ -1790,6 +1790,11 @@ object WeworkOperationImpl {
|
||||
fun switchCorp(message: WeworkMessageBean, objectName: String): Boolean {
|
||||
val startTime = System.currentTimeMillis()
|
||||
goHomeTab("消息")
|
||||
if (Constant.myCorp == objectName) {
|
||||
LogUtils.d("当前已在目标企业: $objectName")
|
||||
uploadCommandResult(message, ExecCallbackBean.SUCCESS, "切换企业成功: $objectName", startTime, listOf(objectName), listOf())
|
||||
return true
|
||||
}
|
||||
val firstTv = AccessibilityUtil.findAllByClazz(getRoot(), Views.TextView)
|
||||
.firstOrNull { it.text == null }
|
||||
AccessibilityUtil.performClick(firstTv, retry = false)
|
||||
|
||||
Reference in New Issue
Block a user