update 优化兼容鸿蒙
This commit is contained in:
@@ -442,9 +442,38 @@ object WeworkOperationImpl {
|
|||||||
AccessibilityUtil.performClick(imageViewList[1])
|
AccessibilityUtil.performClick(imageViewList[1])
|
||||||
val shareFileButton = AccessibilityUtil.findOneByDesc(getRoot(), "以原文件分享", "用其他应用打开")
|
val shareFileButton = AccessibilityUtil.findOneByDesc(getRoot(), "以原文件分享", "用其他应用打开")
|
||||||
AccessibilityUtil.performClick(shareFileButton)
|
AccessibilityUtil.performClick(shareFileButton)
|
||||||
var shareToWorkButton = AccessibilityUtil.findOneByText(getRoot(true, share = true), "发送给同事")
|
val tvFlag = AccessibilityUtil.findOneByText(getRoot(true, share = true), "发送给同事", "选择联系人", "选择参与人")
|
||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
val flagText = tvFlag?.text?.toString() ?: ""
|
||||||
if (shareToWorkButton == null) {
|
if (flagText.contains("发送给同事")) {
|
||||||
|
var shareToWorkButton = tvFlag
|
||||||
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
|
if (shareToWorkButton == null) {
|
||||||
|
LogUtils.e("未找到发送给同事: $objectName")
|
||||||
|
if (retryCount > 0) {
|
||||||
|
return pushMicroDiskImage(message, titleList, objectName, extraText, retryCount - 1)
|
||||||
|
}
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "未找到发送给同事: $objectName", startTime, listOf(), titleList)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
AccessibilityUtil.performClick(shareToWorkButton)
|
||||||
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
|
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
||||||
|
LogUtils.v("尝试发送给同事", shareToWorkButton == null, WeworkController.weworkService.currentPackage)
|
||||||
|
val time = System.currentTimeMillis()
|
||||||
|
var currentTime = time
|
||||||
|
while (currentTime - time < 5000) {
|
||||||
|
if (shareToWorkButton != null
|
||||||
|
&& WeworkController.weworkService.currentPackage != Constant.PACKAGE_NAMES) {
|
||||||
|
LogUtils.e("尝试手势点击!!!!!")
|
||||||
|
AccessibilityUtil.clickByNode(WeworkController.weworkService, shareToWorkButton)
|
||||||
|
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||||
|
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
currentTime = System.currentTimeMillis()
|
||||||
|
}
|
||||||
|
} else if (flagText !in arrayOf("选择联系人", "选择参与人")) {
|
||||||
LogUtils.e("未找到发送给同事: $objectName")
|
LogUtils.e("未找到发送给同事: $objectName")
|
||||||
if (retryCount > 0) {
|
if (retryCount > 0) {
|
||||||
return pushMicroDiskImage(message, titleList, objectName, extraText, retryCount - 1)
|
return pushMicroDiskImage(message, titleList, objectName, extraText, retryCount - 1)
|
||||||
@@ -452,24 +481,6 @@ object WeworkOperationImpl {
|
|||||||
uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "未找到发送给同事: $objectName", startTime, listOf(), titleList)
|
uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "未找到发送给同事: $objectName", startTime, listOf(), titleList)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
AccessibilityUtil.performClick(shareToWorkButton)
|
|
||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
|
||||||
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
|
||||||
LogUtils.v("尝试发送给同事", shareToWorkButton == null, WeworkController.weworkService.currentPackage)
|
|
||||||
val time = System.currentTimeMillis()
|
|
||||||
var currentTime = time
|
|
||||||
while (currentTime - time < 5000) {
|
|
||||||
if (shareToWorkButton != null
|
|
||||||
&& WeworkController.weworkService.currentPackage != Constant.PACKAGE_NAMES) {
|
|
||||||
LogUtils.e("尝试手势点击!!!!!")
|
|
||||||
AccessibilityUtil.clickByNode(WeworkController.weworkService, shareToWorkButton)
|
|
||||||
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
|
||||||
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
currentTime = System.currentTimeMillis()
|
|
||||||
}
|
|
||||||
if (relaySelectTarget(titleList, extraText, timeout = 10000)) {
|
if (relaySelectTarget(titleList, extraText, timeout = 10000)) {
|
||||||
val stayButton = AccessibilityUtil.findOneByText(getRoot(), "留在企业微信")
|
val stayButton = AccessibilityUtil.findOneByText(getRoot(), "留在企业微信")
|
||||||
AccessibilityUtil.performClick(stayButton)
|
AccessibilityUtil.performClick(stayButton)
|
||||||
@@ -710,9 +721,38 @@ object WeworkOperationImpl {
|
|||||||
newFile.writeBytes(body.bytes())
|
newFile.writeBytes(body.bytes())
|
||||||
LogUtils.i("文件存储本地成功 $filePath")
|
LogUtils.i("文件存储本地成功 $filePath")
|
||||||
ShareUtil.share("${if (fileType.isBlank()) "*" else fileType}/*", newFile)
|
ShareUtil.share("${if (fileType.isBlank()) "*" else fileType}/*", newFile)
|
||||||
var shareToWorkButton = AccessibilityUtil.findOneByText(getRoot(true, share = true), "发送给同事")
|
val tvFlag = AccessibilityUtil.findOneByText(getRoot(true, share = true), "发送给同事", "选择联系人", "选择参与人")
|
||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
val flagText = tvFlag?.text?.toString() ?: ""
|
||||||
if (shareToWorkButton == null) {
|
if (flagText.contains("发送给同事")) {
|
||||||
|
var shareToWorkButton = tvFlag
|
||||||
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
|
if (shareToWorkButton == null) {
|
||||||
|
LogUtils.e("未找到发送给同事: $objectName")
|
||||||
|
if (retryCount > 0) {
|
||||||
|
return pushFile(message, titleList, objectName, fileUrl, fileBase64, fileType, extraText, retryCount - 1)
|
||||||
|
}
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "未找到发送给同事: $objectName", startTime, listOf(), titleList)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
AccessibilityUtil.performClick(shareToWorkButton)
|
||||||
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
|
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
||||||
|
LogUtils.v("尝试发送给同事", shareToWorkButton == null, WeworkController.weworkService.currentPackage)
|
||||||
|
val time = System.currentTimeMillis()
|
||||||
|
var currentTime = time
|
||||||
|
while (currentTime - time < 5000) {
|
||||||
|
if (shareToWorkButton != null
|
||||||
|
&& WeworkController.weworkService.currentPackage != Constant.PACKAGE_NAMES) {
|
||||||
|
LogUtils.e("尝试手势点击!!!!!")
|
||||||
|
AccessibilityUtil.clickByNode(WeworkController.weworkService, shareToWorkButton)
|
||||||
|
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||||
|
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
currentTime = System.currentTimeMillis()
|
||||||
|
}
|
||||||
|
} else if (flagText !in arrayOf("选择联系人", "选择参与人")) {
|
||||||
LogUtils.e("未找到发送给同事: $objectName")
|
LogUtils.e("未找到发送给同事: $objectName")
|
||||||
if (retryCount > 0) {
|
if (retryCount > 0) {
|
||||||
return pushFile(message, titleList, objectName, fileUrl, fileBase64, fileType, extraText, retryCount - 1)
|
return pushFile(message, titleList, objectName, fileUrl, fileBase64, fileType, extraText, retryCount - 1)
|
||||||
@@ -720,24 +760,6 @@ object WeworkOperationImpl {
|
|||||||
uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "未找到发送给同事: $objectName", startTime, listOf(), titleList)
|
uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "未找到发送给同事: $objectName", startTime, listOf(), titleList)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
AccessibilityUtil.performClick(shareToWorkButton)
|
|
||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
|
||||||
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
|
||||||
LogUtils.v("尝试发送给同事", shareToWorkButton == null, WeworkController.weworkService.currentPackage)
|
|
||||||
val time = System.currentTimeMillis()
|
|
||||||
var currentTime = time
|
|
||||||
while (currentTime - time < 5000) {
|
|
||||||
if (shareToWorkButton != null
|
|
||||||
&& WeworkController.weworkService.currentPackage != Constant.PACKAGE_NAMES) {
|
|
||||||
LogUtils.e("尝试手势点击!!!!!")
|
|
||||||
AccessibilityUtil.clickByNode(WeworkController.weworkService, shareToWorkButton)
|
|
||||||
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
|
||||||
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
currentTime = System.currentTimeMillis()
|
|
||||||
}
|
|
||||||
if (relaySelectTarget(titleList, extraText, timeout = 10000)) {
|
if (relaySelectTarget(titleList, extraText, timeout = 10000)) {
|
||||||
val stayButton = AccessibilityUtil.findOneByText(getRoot(), "留在企业微信")
|
val stayButton = AccessibilityUtil.findOneByText(getRoot(), "留在企业微信")
|
||||||
AccessibilityUtil.performClick(stayButton)
|
AccessibilityUtil.performClick(stayButton)
|
||||||
@@ -780,9 +802,38 @@ object WeworkOperationImpl {
|
|||||||
newFile.writeBytes(EncodeUtils.base64Decode(fileBase64))
|
newFile.writeBytes(EncodeUtils.base64Decode(fileBase64))
|
||||||
LogUtils.i("文件存储本地成功 $filePath")
|
LogUtils.i("文件存储本地成功 $filePath")
|
||||||
ShareUtil.share("${if (fileType.isBlank()) "*" else fileType}/*", newFile)
|
ShareUtil.share("${if (fileType.isBlank()) "*" else fileType}/*", newFile)
|
||||||
var shareToWorkButton = AccessibilityUtil.findOneByText(getRoot(true, share = true), "发送给同事")
|
val tvFlag = AccessibilityUtil.findOneByText(getRoot(true, share = true), "发送给同事", "选择联系人", "选择参与人")
|
||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
val flagText = tvFlag?.text?.toString() ?: ""
|
||||||
if (shareToWorkButton == null) {
|
if (flagText.contains("发送给同事")) {
|
||||||
|
var shareToWorkButton = tvFlag
|
||||||
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
|
if (shareToWorkButton == null) {
|
||||||
|
LogUtils.e("未找到发送给同事: $objectName")
|
||||||
|
if (retryCount > 0) {
|
||||||
|
return pushFile(message, titleList, objectName, fileUrl, fileBase64, fileType, extraText, retryCount - 1)
|
||||||
|
}
|
||||||
|
uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "未找到发送给同事: $objectName", startTime, listOf(), titleList)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
AccessibilityUtil.performClick(shareToWorkButton)
|
||||||
|
sleep(Constant.POP_WINDOW_INTERVAL)
|
||||||
|
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
||||||
|
LogUtils.v("尝试发送给同事", shareToWorkButton == null, WeworkController.weworkService.currentPackage)
|
||||||
|
val time = System.currentTimeMillis()
|
||||||
|
var currentTime = time
|
||||||
|
while (currentTime - time < 5000) {
|
||||||
|
if (shareToWorkButton != null
|
||||||
|
&& WeworkController.weworkService.currentPackage != Constant.PACKAGE_NAMES) {
|
||||||
|
LogUtils.e("尝试手势点击!!!!!")
|
||||||
|
AccessibilityUtil.clickByNode(WeworkController.weworkService, shareToWorkButton)
|
||||||
|
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
||||||
|
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
currentTime = System.currentTimeMillis()
|
||||||
|
}
|
||||||
|
} else if (flagText !in arrayOf("选择联系人", "选择参与人")) {
|
||||||
LogUtils.e("未找到发送给同事: $objectName")
|
LogUtils.e("未找到发送给同事: $objectName")
|
||||||
if (retryCount > 0) {
|
if (retryCount > 0) {
|
||||||
return pushFile(message, titleList, objectName, fileUrl, fileBase64, fileType, extraText, retryCount - 1)
|
return pushFile(message, titleList, objectName, fileUrl, fileBase64, fileType, extraText, retryCount - 1)
|
||||||
@@ -790,24 +841,6 @@ object WeworkOperationImpl {
|
|||||||
uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "未找到发送给同事: $objectName", startTime, listOf(), titleList)
|
uploadCommandResult(message, ExecCallbackBean.ERROR_RELAY, "未找到发送给同事: $objectName", startTime, listOf(), titleList)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
AccessibilityUtil.performClick(shareToWorkButton)
|
|
||||||
sleep(Constant.POP_WINDOW_INTERVAL)
|
|
||||||
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
|
||||||
LogUtils.v("尝试发送给同事", shareToWorkButton == null, WeworkController.weworkService.currentPackage)
|
|
||||||
val time = System.currentTimeMillis()
|
|
||||||
var currentTime = time
|
|
||||||
while (currentTime - time < 5000) {
|
|
||||||
if (shareToWorkButton != null
|
|
||||||
&& WeworkController.weworkService.currentPackage != Constant.PACKAGE_NAMES) {
|
|
||||||
LogUtils.e("尝试手势点击!!!!!")
|
|
||||||
AccessibilityUtil.clickByNode(WeworkController.weworkService, shareToWorkButton)
|
|
||||||
sleep(Constant.CHANGE_PAGE_INTERVAL)
|
|
||||||
shareToWorkButton = AccessibilityUtil.findOnceByText(getRoot(true, share = true), "发送给同事")
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
currentTime = System.currentTimeMillis()
|
|
||||||
}
|
|
||||||
if (relaySelectTarget(titleList, extraText, timeout = 10000)) {
|
if (relaySelectTarget(titleList, extraText, timeout = 10000)) {
|
||||||
val stayButton = AccessibilityUtil.findOneByText(getRoot(), "留在企业微信")
|
val stayButton = AccessibilityUtil.findOneByText(getRoot(), "留在企业微信")
|
||||||
AccessibilityUtil.performClick(stayButton)
|
AccessibilityUtil.performClick(stayButton)
|
||||||
|
|||||||
Reference in New Issue
Block a user