From 7d644ae9c64d0d6b6fe005614944ec25b481bcb0 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Thu, 2 Feb 2017 18:53:45 -0800 Subject: [PATCH] Run local hangup events through view model Fixes #6143 // FREEBIE --- src/org/thoughtcrime/securesms/WebRtcCallActivity.java | 10 +++++----- .../securesms/service/WebRtcCallService.java | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/org/thoughtcrime/securesms/WebRtcCallActivity.java b/src/org/thoughtcrime/securesms/WebRtcCallActivity.java index ea9912ea68..2d3b287bb2 100644 --- a/src/org/thoughtcrime/securesms/WebRtcCallActivity.java +++ b/src/org/thoughtcrime/securesms/WebRtcCallActivity.java @@ -181,11 +181,11 @@ public class WebRtcCallActivity extends Activity { intent.setAction(WebRtcCallService.ACTION_LOCAL_HANGUP); startService(intent); - WebRtcViewModel event = EventBus.getDefault().getStickyEvent(WebRtcViewModel.class); - - if (event != null) { - WebRtcCallActivity.this.handleTerminate(event.getRecipient()); - } +// WebRtcViewModel event = EventBus.getDefault().getStickyEvent(WebRtcViewModel.class); +// +// if (event != null) { +// WebRtcCallActivity.this.handleTerminate(event.getRecipient()); +// } } private void handleIncomingCall(@NonNull WebRtcViewModel event) { diff --git a/src/org/thoughtcrime/securesms/service/WebRtcCallService.java b/src/org/thoughtcrime/securesms/service/WebRtcCallService.java index 40bdbcead0..233edc5c5d 100644 --- a/src/org/thoughtcrime/securesms/service/WebRtcCallService.java +++ b/src/org/thoughtcrime/securesms/service/WebRtcCallService.java @@ -569,6 +569,7 @@ public class WebRtcCallService extends Service implements InjectableType, CallSt this.dataChannel.send(new DataChannel.Buffer(ByteBuffer.wrap(Data.newBuilder().setHangup(Hangup.newBuilder().setId(this.callId)).build().toByteArray()), false)); sendMessage(this.recipient, SignalServiceCallMessage.forHangup(new HangupMessage(this.callId))); + sendMessage(WebRtcViewModel.State.CALL_DISCONNECTED, this.recipient, localVideoEnabled, remoteVideoEnabled); } terminate(); @@ -621,7 +622,7 @@ public class WebRtcCallService extends Service implements InjectableType, CallSt .setEnabled(localVideoEnabled)) .build().toByteArray()), false)); } - + sendMessage(viewModelStateFor(callState), this.recipient, localVideoEnabled, remoteVideoEnabled); }