update 优化好友标签
This commit is contained in:
@@ -4,7 +4,8 @@ import com.blankj.utilcode.util.SPUtils
|
|||||||
|
|
||||||
object Constant {
|
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 PACKAGE_NAMES = "com.tencent.wework"
|
||||||
const val WEWORK_NOTIFY = "wework_notify"
|
const val WEWORK_NOTIFY = "wework_notify"
|
||||||
const val BASE_LONG_INTERVAL = 5000L
|
const val BASE_LONG_INTERVAL = 5000L
|
||||||
@@ -15,6 +16,7 @@ object Constant {
|
|||||||
var POP_WINDOW_INTERVAL = BASE_POP_WINDOW_INTERVAL
|
var POP_WINDOW_INTERVAL = BASE_POP_WINDOW_INTERVAL
|
||||||
private const val DEFAULT_HOST = "wss://worktool.asrtts.cn"
|
private const val DEFAULT_HOST = "wss://worktool.asrtts.cn"
|
||||||
|
|
||||||
|
var version = Int.MAX_VALUE
|
||||||
var myName = ""
|
var myName = ""
|
||||||
// var regTrimTitle = "(…$)|(-.*$)|(\\(.*?\\)$)".toRegex()
|
// var regTrimTitle = "(…$)|(-.*$)|(\\(.*?\\)$)".toRegex()
|
||||||
var regMail = "\\S+@\\S+\\.\\S+".toRegex()
|
var regMail = "\\S+@\\S+\\.\\S+".toRegex()
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ class ListenActivity : AppCompatActivity() {
|
|||||||
LogUtils.i("当前企业微信版本已适配: $workVersionName")
|
LogUtils.i("当前企业微信版本已适配: $workVersionName")
|
||||||
val tip = "$workVersionName 已适配,可放心使用~"
|
val tip = "$workVersionName 已适配,可放心使用~"
|
||||||
tv_work_version.text = tip
|
tv_work_version.text = tip
|
||||||
|
Constant.version = Constant.AVAILABLE_VERSION_MAP[workVersionName] ?: Int.MAX_VALUE
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
LogUtils.e("当前企业微信版本未兼容: $workVersionName")
|
LogUtils.e("当前企业微信版本未兼容: $workVersionName")
|
||||||
@@ -121,6 +122,7 @@ class ListenActivity : AppCompatActivity() {
|
|||||||
tv_work_version.text = tip
|
tv_work_version.text = tip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LogUtils.i("Constant.version: ${Constant.version}")
|
||||||
SPUtils.getInstance().put("appVersion", version)
|
SPUtils.getInstance().put("appVersion", version)
|
||||||
SPUtils.getInstance().put("workVersion", workVersionName)
|
SPUtils.getInstance().put("workVersion", workVersionName)
|
||||||
SPUtils.getInstance().put("deviceRooted", deviceRooted)
|
SPUtils.getInstance().put("deviceRooted", deviceRooted)
|
||||||
|
|||||||
@@ -2751,15 +2751,10 @@ object WeworkOperationImpl {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//添加联系人
|
//添加联系人
|
||||||
val imageView =
|
val imageView = AccessibilityUtil.findOneByClazz(getRoot(), Views.ImageView)
|
||||||
AccessibilityUtil.findOneByClazz(getRoot(), Views.ImageView)
|
|
||||||
if (imageView != null) {
|
if (imageView != null) {
|
||||||
val textViewList = AccessibilityUtil.findAllOnceByClazz(
|
val textViewList = AccessibilityUtil.findAllOnceByClazz(imageView.parent, Views.TextView)
|
||||||
imageView.parent,
|
val filter = textViewList.filter { it.text != null && it.text.toString() != "微信" }
|
||||||
Views.TextView
|
|
||||||
)
|
|
||||||
val filter =
|
|
||||||
textViewList.filter { it.text != null && it.text.toString() != "微信" }
|
|
||||||
if (filter.isNotEmpty()) {
|
if (filter.isNotEmpty()) {
|
||||||
val tvNick = filter[0]
|
val tvNick = filter[0]
|
||||||
LogUtils.d("好友昵称或备注名: ${tvNick.text}")
|
LogUtils.d("好友昵称或备注名: ${tvNick.text}")
|
||||||
@@ -2800,14 +2795,20 @@ object WeworkOperationImpl {
|
|||||||
//不存在的标签先添加
|
//不存在的标签先添加
|
||||||
for (tag in tagList) {
|
for (tag in tagList) {
|
||||||
if (!oldTagList.contains(tag)) {
|
if (!oldTagList.contains(tag)) {
|
||||||
AccessibilityUtil.findOneByText(getRoot(), "个人标签")
|
if (Constant.version >= 40108) {
|
||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
AccessibilityUtil.findTextAndClick(getRoot(), " 十 ")
|
||||||
val tempList = AccessibilityUtil.findBackNode(
|
|
||||||
AccessibilityUtil.findAllByText(getRoot(), "个人标签").lastOrNull())
|
|
||||||
if (tempList != null && tempList.childCount > 0) {
|
|
||||||
AccessibilityUtil.performClick(tempList.getChild(0))
|
|
||||||
AccessibilityUtil.findTextInput(getRoot(), tag)
|
AccessibilityUtil.findTextInput(getRoot(), tag)
|
||||||
AccessibilityUtil.findTextAndClick(getRoot(), "确定")
|
AccessibilityUtil.findTextAndClick(getRoot(), "确定")
|
||||||
|
} else {
|
||||||
|
AccessibilityUtil.findOneByText(getRoot(), "个人标签")
|
||||||
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
|
val tempList = AccessibilityUtil.findBackNode(
|
||||||
|
AccessibilityUtil.findAllByText(getRoot(), "个人标签").lastOrNull())
|
||||||
|
if (tempList != null && tempList.childCount > 0) {
|
||||||
|
AccessibilityUtil.performClick(tempList.getChild(0))
|
||||||
|
AccessibilityUtil.findTextInput(getRoot(), tag)
|
||||||
|
AccessibilityUtil.findTextAndClick(getRoot(), "确定")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2831,13 +2832,14 @@ object WeworkOperationImpl {
|
|||||||
}
|
}
|
||||||
list.refresh()
|
list.refresh()
|
||||||
}
|
}
|
||||||
if (AccessibilityUtil.findTextAndClick(getRoot(), "确定")) {
|
if (AccessibilityUtil.findTextAndClick(getRoot(), "确定", "保存", exact = true)) {
|
||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
//可能有两次确定 另一次为添加新tag
|
//可能有两次确定 另一次为添加新tag
|
||||||
val textNode = AccessibilityUtil.findOneByText(getRoot(), "确定", "个人信息")
|
val textNode = AccessibilityUtil.findOneByText(getRoot(), "确定", "保存", "个人信息", exact = true)
|
||||||
if (textNode?.text?.toString() == "确定") {
|
if (textNode?.text?.toString() in arrayOf("确定", "保存")) {
|
||||||
AccessibilityUtil.performClick(textNode)
|
AccessibilityUtil.performClick(textNode)
|
||||||
}
|
}
|
||||||
|
LogUtils.d("设置标签完成")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user