Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-06-12 20:30:13 +02:00
parent 60f2e25007
commit 2438a09fd0

View File

@ -147,15 +147,20 @@ public class CallNotificationController extends BaseController {
@Override @Override
public void onNext(ParticipantsOverall participantsOverall) { public void onNext(ParticipantsOverall participantsOverall) {
boolean hasParticipantsInCall = false; boolean hasParticipantsInCall = false;
boolean inCallOnDifferentDevice = false;
List<Participant> participantList = participantsOverall.getOcs().getData(); List<Participant> participantList = participantsOverall.getOcs().getData();
for (Participant participant : participantList) { for (Participant participant : participantList) {
if (participant.isInCall()) { if (participant.isInCall()) {
hasParticipantsInCall = true; hasParticipantsInCall = true;
if (participant.getUserId().equals(userBeingCalled.getUserId())) {
inCallOnDifferentDevice = true;
}
break; break;
} }
} }
if (!hasParticipantsInCall) { if (!hasParticipantsInCall || inCallOnDifferentDevice) {
if (getActivity() != null) { if (getActivity() != null) {
getActivity().runOnUiThread(() -> hangup()); getActivity().runOnUiThread(() -> hangup());
} }