fix(WeworkService): 修复重连后无法检测新消息的问题
重连成功时恢复主循环运行状态并重新发送循环消息,避免服务假运行
This commit is contained in:
@@ -6,6 +6,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.FileObserver
|
||||
import android.os.Message
|
||||
import android.util.Log
|
||||
import android.view.accessibility.AccessibilityEvent
|
||||
import com.blankj.utilcode.util.*
|
||||
@@ -144,6 +145,13 @@ class WeworkService : AccessibilityService() {
|
||||
val hook = SPUtils.getInstance().getBoolean("hook", false)
|
||||
LogUtils.i("连接建立: $robotId appVersion: $appVersion workVersion: $workVersion deviceRooted: $deviceRooted hook: $hook")
|
||||
log("连接建立: $robotId appVersion: $appVersion workVersion: $workVersion deviceRooted: $deviceRooted hook: $hook")
|
||||
// 断线后会被置为false;重连成功时主动恢复主循环,避免出现“提示运行中但未检测消息”
|
||||
WeworkController.enableLoopRunning = true
|
||||
MyLooper.getInstance().removeMessages(WeworkMessageBean.LOOP_RECEIVE_NEW_MESSAGE)
|
||||
MyLooper.getInstance().sendMessage(Message.obtain().apply {
|
||||
what = WeworkMessageBean.LOOP_RECEIVE_NEW_MESSAGE
|
||||
obj = WeworkMessageBean().apply { type = WeworkMessageBean.LOOP_RECEIVE_NEW_MESSAGE }
|
||||
})
|
||||
LogUtils.i("设置自动跳转企业微信")
|
||||
sendBroadcast(true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user