mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +01:00
Merge pull request #2586 from nextcloud/fix-joining-call-when-signaling-messages-overtake-the-response
Fix joining call when signaling messages overtake the response
This commit is contained in:
commit
dfa2b66eec
@ -1442,7 +1442,9 @@ public class CallActivity extends CallBaseActivity {
|
||||
@Override
|
||||
public void onNext(@io.reactivex.annotations.NonNull GenericOverall genericOverall) {
|
||||
if (currentCallStatus != CallStatus.LEAVING) {
|
||||
setCallState(CallStatus.JOINED);
|
||||
if (currentCallStatus != CallStatus.IN_CONVERSATION) {
|
||||
setCallState(CallStatus.JOINED);
|
||||
}
|
||||
|
||||
ApplicationWideCurrentRoomHolder.getInstance().setInCall(true);
|
||||
ApplicationWideCurrentRoomHolder.getInstance().setDialing(false);
|
||||
@ -1851,6 +1853,8 @@ public class CallActivity extends CallBaseActivity {
|
||||
|
||||
Log.d(TAG, " currentSessionId is " + currentSessionId);
|
||||
|
||||
boolean isSelfInCall = false;
|
||||
|
||||
for (HashMap<String, Object> participant : users) {
|
||||
long inCallFlag = (long) participant.get("inCall");
|
||||
if (!participant.get("sessionId").equals(currentSessionId)) {
|
||||
@ -1874,9 +1878,12 @@ public class CallActivity extends CallBaseActivity {
|
||||
userIdsBySessionId.put(participant.get("sessionId").toString(), userId);
|
||||
} else {
|
||||
Log.d(TAG, " inCallFlag of currentSessionId: " + inCallFlag);
|
||||
isSelfInCall = inCallFlag != 0;
|
||||
if (inCallFlag == 0 && currentCallStatus != CallStatus.LEAVING && ApplicationWideCurrentRoomHolder.getInstance().isInCall()) {
|
||||
Log.d(TAG, "Most probably a moderator ended the call for all.");
|
||||
hangup(true);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1887,6 +1894,17 @@ public class CallActivity extends CallBaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
if (!isSelfInCall) {
|
||||
Log.d(TAG, "Self not in call, disconnecting from all other sessions");
|
||||
|
||||
for (String sessionId : oldSessions) {
|
||||
Log.d(TAG, " oldSession that will be removed is: " + sessionId);
|
||||
endPeerConnection(sessionId, false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate sessions that left the call
|
||||
List<String> disconnectedSessions = new ArrayList<>(oldSessions);
|
||||
disconnectedSessions.removeAll(newSessions);
|
||||
@ -1894,7 +1912,7 @@ public class CallActivity extends CallBaseActivity {
|
||||
// Calculate sessions that join the call
|
||||
newSessions.removeAll(oldSessions);
|
||||
|
||||
if (!isConnectionEstablished() && currentCallStatus != CallStatus.CONNECTING) {
|
||||
if (currentCallStatus == CallStatus.LEAVING) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user