refactor(servicing): 重构推送消息处理机制
- 移除 PushMessageLiveData,改为使用 PushListener 接口 - 在 ServiceManager 中实现消息分发逻辑- 更新 PushMessageActivity 以接收广播消息 - 优化 JPushReceiver 和 MyMqttClient 的消息处理 - 调整 GlobalData 中的 isLoginRecognition 默认值 - 重构 SpeechManager 中的语音播放逻辑
This commit is contained in:
@ -73,10 +73,10 @@ object GlobalData : GlobalLocalData() {
|
||||
//是否已经完成登录后的人脸识别
|
||||
var isLoginRecognition : Boolean? = null
|
||||
get() {
|
||||
return mmkv.decodeBool("isLoginRecognition", false)
|
||||
return mmkv.decodeBool("isLoginRecognition", true)
|
||||
}
|
||||
set(value) {
|
||||
mmkv.encode("isLoginRecognition", value ?: false)
|
||||
mmkv.encode("isLoginRecognition", value ?: true)
|
||||
field = value
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ object GlobalData : GlobalLocalData() {
|
||||
currentLocation = null
|
||||
driverInfoBean = null
|
||||
loginTime = null
|
||||
isLoginRecognition = null
|
||||
// isLoginRecognition = null
|
||||
}
|
||||
|
||||
fun clearAllOrderCache() {
|
||||
|
@ -16,10 +16,7 @@ import com.za.room.db.user.LocalResourceBean
|
||||
import com.za.servicing.R
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
object SpeechManager {
|
||||
private var mContext : Application? = null
|
||||
@ -182,7 +179,7 @@ object SpeechManager {
|
||||
val localUrlResource = localResourceDao?.getLocalResourceByName(content)
|
||||
if (localUrlResource != null && ! localUrlResource.resourceUrl.isNullOrBlank()) {
|
||||
speechNewOrderLooper(content) {
|
||||
playNewOrderFromNet(localUrlResource.resourceUrl ?: "")
|
||||
playNewOrderFromNet(localUrlResource.resourceUrl)
|
||||
}
|
||||
LogUtil.print("handlerNewOrderVoice", "播放本地语音");
|
||||
return
|
||||
@ -210,11 +207,11 @@ object SpeechManager {
|
||||
}
|
||||
|
||||
private fun speechNewOrderLooper(content : String, play : () -> Unit) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
thread {
|
||||
val startTime = System.currentTimeMillis()
|
||||
while (System.currentTimeMillis() - startTime < 1000 * 60 * 3 && GlobalData.isHandlerNewOrder == false) {
|
||||
play()
|
||||
delay(250L * content.length)
|
||||
Thread.sleep(250L * content.length)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user