[3.2.0][Fix]解决首次安装Tts不播报的问题

原因:
先分发数据且没缓存,而后才去监听,没有收到sn相关的事件
This commit is contained in:
chenfufeng
2023-05-24 17:02:31 +08:00
parent db7a48302b
commit beacde1fed
4 changed files with 22 additions and 4 deletions

View File

@@ -6,10 +6,25 @@ import com.mogo.eagle.core.function.call.base.CallerBase
object CallerCloudListenerManager : CallerBase<IMoGoCloudListener>() {
@Volatile
private var token: String? = null
@Volatile
private var sn: String? = null
override fun doSomeAfterAddListener(tag: String, listener: IMoGoCloudListener) {
super.doSomeAfterAddListener(tag, listener)
if (!token.isNullOrEmpty() && !sn.isNullOrEmpty()) {
listener.tokenGot(token!!, sn!!)
}
}
/**
* 分发获取到的设备sn
*/
fun invokeCloudTokenGot(token: String, sn: String) {
this.token = token
this.sn = sn
M_LISTENERS.forEach {
val listener = it.value
listener.tokenGot(token, sn)