update 修复暂停跳转问题

This commit is contained in:
gallonyin
2023-01-05 10:01:43 +08:00
parent 96d73355f4
commit 8d66f14b21
2 changed files with 9 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ import org.yameida.worktool.model.ExecCallbackBean
import org.yameida.worktool.model.WeworkMessageBean
import org.yameida.worktool.model.WeworkMessageListBean
import org.yameida.worktool.utils.AccessibilityUtil
import org.yameida.worktool.utils.FloatWindowHelper
import org.yameida.worktool.utils.Views
import java.lang.Exception
@@ -106,10 +107,13 @@ fun getRoot(ignoreCheck: Boolean): AccessibilityNodeInfo {
if (System.currentTimeMillis() % 30 == 0L) {
error("当前不在企业微信: ${root.packageName}")
if (!root.packageName.contains("(worktool)|(settings)".toRegex())) {
ToastUtils.show("当前不在企业微信: ${root.packageName}\n尝试跳转到企业微信")
Utils.getApp().packageManager.getLaunchIntentForPackage(Constant.PACKAGE_NAMES)?.apply {
this.flags = Intent.FLAG_ACTIVITY_NEW_TASK
Utils.getApp().startActivity(this)
if (!FloatWindowHelper.isPause) {
ToastUtils.show("当前不在企业微信: ${root.packageName}\n尝试跳转到企业微信")
Utils.getApp().packageManager.getLaunchIntentForPackage(Constant.PACKAGE_NAMES)
?.apply {
this.flags = Intent.FLAG_ACTIVITY_NEW_TASK
Utils.getApp().startActivity(this)
}
}
}
}

View File

@@ -148,7 +148,7 @@ public class WebSocketManager {
lastConnectedTime = System.currentTimeMillis();
Runnable r = () -> {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
Log.e(url, "心跳检测" + df.format(new Date()));// new Date()为获取当前系统时间
Log.d(url, "心跳检测" + df.format(new Date()));// new Date()为获取当前系统时间
if (!connecting && (socket == null || !socket.send(HEARTBEAT))) {
//断开链接后关闭新消息接收
WeworkController.INSTANCE.setEnableLoopRunning(false);