update 优化好友标签
This commit is contained in:
@@ -4,7 +4,8 @@ import com.blankj.utilcode.util.SPUtils
|
||||
|
||||
object Constant {
|
||||
|
||||
val AVAILABLE_VERSION = arrayListOf("4.0.2", "4.0.6", "4.0.8", "4.0.10", "4.0.12", "4.0.16", "4.0.18", "4.0.19", "4.0.20", "4.1.0", "4.1.2", "4.1.3", "4.1.6", "4.1.7")
|
||||
val AVAILABLE_VERSION = arrayListOf("4.0.2", "4.0.6", "4.0.8", "4.0.10", "4.0.12", "4.0.16", "4.0.18", "4.0.19", "4.0.20", "4.1.0", "4.1.2", "4.1.3", "4.1.6", "4.1.7", "4.1.8", "4.1.9")
|
||||
val AVAILABLE_VERSION_MAP = mapOf(Pair("4.0.2", 40002), Pair("4.0.6", 40006), Pair("4.0.8", 40008), Pair("4.0.10", 40010), Pair("4.0.12", 40012), Pair("4.0.16", 40016), Pair("4.0.18", 40018), Pair("4.0.19", 40019), Pair("4.0.20", 40020), Pair("4.1.0", 40100), Pair("4.1.2", 40102), Pair("4.1.3", 40103), Pair("4.1.6", 40106), Pair("4.1.7", 40107), Pair("4.1.8", 40108), Pair("4.1.9", 40109))
|
||||
const val PACKAGE_NAMES = "com.tencent.wework"
|
||||
const val WEWORK_NOTIFY = "wework_notify"
|
||||
const val BASE_LONG_INTERVAL = 5000L
|
||||
@@ -15,6 +16,7 @@ object Constant {
|
||||
var POP_WINDOW_INTERVAL = BASE_POP_WINDOW_INTERVAL
|
||||
private const val DEFAULT_HOST = "wss://worktool.asrtts.cn"
|
||||
|
||||
var version = Int.MAX_VALUE
|
||||
var myName = ""
|
||||
// var regTrimTitle = "(…$)|(-.*$)|(\\(.*?\\)$)".toRegex()
|
||||
var regMail = "\\S+@\\S+\\.\\S+".toRegex()
|
||||
|
||||
@@ -114,6 +114,7 @@ class ListenActivity : AppCompatActivity() {
|
||||
LogUtils.i("当前企业微信版本已适配: $workVersionName")
|
||||
val tip = "$workVersionName 已适配,可放心使用~"
|
||||
tv_work_version.text = tip
|
||||
Constant.version = Constant.AVAILABLE_VERSION_MAP[workVersionName] ?: Int.MAX_VALUE
|
||||
}
|
||||
else -> {
|
||||
LogUtils.e("当前企业微信版本未兼容: $workVersionName")
|
||||
@@ -121,6 +122,7 @@ class ListenActivity : AppCompatActivity() {
|
||||
tv_work_version.text = tip
|
||||
}
|
||||
}
|
||||
LogUtils.i("Constant.version: ${Constant.version}")
|
||||
SPUtils.getInstance().put("appVersion", version)
|
||||
SPUtils.getInstance().put("workVersion", workVersionName)
|
||||
SPUtils.getInstance().put("deviceRooted", deviceRooted)
|
||||
|
||||
@@ -2751,15 +2751,10 @@ object WeworkOperationImpl {
|
||||
return true
|
||||
}
|
||||
//添加联系人
|
||||
val imageView =
|
||||
AccessibilityUtil.findOneByClazz(getRoot(), Views.ImageView)
|
||||
val imageView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ImageView)
|
||||
if (imageView != null) {
|
||||
val textViewList = AccessibilityUtil.findAllOnceByClazz(
|
||||
imageView.parent,
|
||||
Views.TextView
|
||||
)
|
||||
val filter =
|
||||
textViewList.filter { it.text != null && it.text.toString() != "微信" }
|
||||
val textViewList = AccessibilityUtil.findAllOnceByClazz(imageView.parent, Views.TextView)
|
||||
val filter = textViewList.filter { it.text != null && it.text.toString() != "微信" }
|
||||
if (filter.isNotEmpty()) {
|
||||
val tvNick = filter[0]
|
||||
LogUtils.d("好友昵称或备注名: ${tvNick.text}")
|
||||
@@ -2800,6 +2795,11 @@ object WeworkOperationImpl {
|
||||
//不存在的标签先添加
|
||||
for (tag in tagList) {
|
||||
if (!oldTagList.contains(tag)) {
|
||||
if (Constant.version >= 40108) {
|
||||
AccessibilityUtil.findTextAndClick(getRoot(), " 十 ")
|
||||
AccessibilityUtil.findTextInput(getRoot(), tag)
|
||||
AccessibilityUtil.findTextAndClick(getRoot(), "确定")
|
||||
} else {
|
||||
AccessibilityUtil.findOneByText(getRoot(), "个人标签")
|
||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||
val tempList = AccessibilityUtil.findBackNode(
|
||||
@@ -2811,6 +2811,7 @@ object WeworkOperationImpl {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//确认只选择列表里的标签
|
||||
val count = list.childCount
|
||||
for (i in 0 until count) {
|
||||
@@ -2831,13 +2832,14 @@ object WeworkOperationImpl {
|
||||
}
|
||||
list.refresh()
|
||||
}
|
||||
if (AccessibilityUtil.findTextAndClick(getRoot(), "确定")) {
|
||||
if (AccessibilityUtil.findTextAndClick(getRoot(), "确定", "保存", exact = true)) {
|
||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||
//可能有两次确定 另一次为添加新tag
|
||||
val textNode = AccessibilityUtil.findOneByText(getRoot(), "确定", "个人信息")
|
||||
if (textNode?.text?.toString() == "确定") {
|
||||
val textNode = AccessibilityUtil.findOneByText(getRoot(), "确定", "保存", "个人信息", exact = true)
|
||||
if (textNode?.text?.toString() in arrayOf("确定", "保存")) {
|
||||
AccessibilityUtil.performClick(textNode)
|
||||
}
|
||||
LogUtils.d("设置标签完成")
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user