update 优化切换企业

This commit is contained in:
gallonyin
2023-09-04 22:07:29 +08:00
parent 8dcb91b5d7
commit f05ab9e992
3 changed files with 8 additions and 0 deletions

View File

@@ -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()

View File

@@ -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() ?: ""

View File

@@ -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)