|
@@ -224,7 +224,7 @@ class WdKeepAliveService : AbsWorkService() {
|
|
|
|
|
|
//更新界面
|
|
|
if (mNewCallListActive) {
|
|
|
- EventBus.getDefault().post(MessageEvent(tcpModel, Constants.EVENT_NEW_CALL))
|
|
|
+ EventBus.getDefault().post(MessageEvent(tcpModel, Constants.EVENT_UPDATE_CALL))
|
|
|
} else {
|
|
|
val intent = Intent()
|
|
|
intent.setClass(this, NewCallListActivity::class.java)
|
|
@@ -240,14 +240,16 @@ class WdKeepAliveService : AbsWorkService() {
|
|
|
}
|
|
|
waitingCall = false
|
|
|
|
|
|
- //更新界面
|
|
|
- if (mNewCallListActive) {
|
|
|
- EventBus.getDefault().post(MessageEvent(tcpModel, Constants.EVENT_NEW_CALL))
|
|
|
- } else {
|
|
|
- val intent = Intent()
|
|
|
- intent.setClass(this, NewCallListActivity::class.java)
|
|
|
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
|
- startActivity(intent)
|
|
|
+ if (Constants.newCallList.size > 0) {
|
|
|
+ //更新界面
|
|
|
+ if (mNewCallListActive) {
|
|
|
+ EventBus.getDefault().post(MessageEvent(tcpModel, Constants.EVENT_UPDATE_CALL))
|
|
|
+ } else {
|
|
|
+ val intent = Intent()
|
|
|
+ intent.setClass(this, NewCallListActivity::class.java)
|
|
|
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
|
+ startActivity(intent)
|
|
|
+ }
|
|
|
}
|
|
|
}.start()
|
|
|
}
|
|
@@ -324,7 +326,9 @@ class WdKeepAliveService : AbsWorkService() {
|
|
|
if (tcpModel.getAction() == TcpAction.VoiceAction.SUCCESS) {
|
|
|
EventBus.getDefault().post(MessageEvent(tcpModel, 1))
|
|
|
} else if (tcpModel.getAction() == TcpAction.VoiceAction.CALL) {
|
|
|
- if (DeviceChannel.calling) {
|
|
|
+ EventBus.getDefault().post(MessageEvent(tcpModel, 1))
|
|
|
+
|
|
|
+ /*if (DeviceChannel.calling) {
|
|
|
Log.d(TAG, "通话中,来电 " + tcpModel.getFromId() + "<>" + DeviceChannel.callId)
|
|
|
//相同来源,重新建立通话
|
|
|
if (tcpModel.getFromId() == DeviceChannel.callId) {
|
|
@@ -332,13 +336,33 @@ class WdKeepAliveService : AbsWorkService() {
|
|
|
}
|
|
|
} else { //得到通话
|
|
|
EventBus.getDefault().post(MessageEvent(tcpModel, 1))
|
|
|
- }
|
|
|
+ }*/
|
|
|
} else if (tcpModel.getAction() == TcpAction.VoiceAction.ACCEPT //我方呼出,对方接受
|
|
|
|| tcpModel.getAction() == TcpAction.VoiceAction.REJECT //我方呼出,对方拒绝
|
|
|
|| tcpModel.getAction() == TcpAction.VoiceAction.CALLING //我方呼出,对方通话中
|
|
|
|| tcpModel.getAction() == TcpAction.VoiceAction.HANDOFF
|
|
|
|| tcpModel.getAction() == TcpAction.VoiceAction.FAILED //我方呼出,对方不在线,设备离线或其它错误
|
|
|
- || tcpModel.getAction() == TcpAction.VoiceAction.CANCEL) {
|
|
|
+ || tcpModel.getAction() == TcpAction.VoiceAction.CANCEL
|
|
|
+ || tcpModel.getAction() == TcpAction.VoiceAction.VOICE_OFF) {
|
|
|
+
|
|
|
+ if (tcpModel.getAction() === TcpAction.VoiceAction.CANCEL || tcpModel.action == TcpAction.VoiceAction.VOICE_OFF) {
|
|
|
+ //对方取消呼叫或者呼叫已被其他主机处理(接听或拒绝)
|
|
|
+ val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
|
+ val iterator = Constants.newCallList.iterator()
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ val it = iterator.next()
|
|
|
+ val interaction = Gson().fromJson(it.data.toString(), InteractionVO::class.java)
|
|
|
+ if (interaction.id.equals(interactionVO.id)) {
|
|
|
+ iterator.remove()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新界面
|
|
|
+ if (mNewCallListActive) {
|
|
|
+ EventBus.getDefault().post(MessageEvent(tcpModel, Constants.EVENT_UPDATE_CALL))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
EventBus.getDefault().post(MessageEvent(tcpModel, 2))
|
|
|
}
|
|
|
}
|