mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 23:25:20 +03:00
Add handling for "event.participants.update.all"
In case a moderator of a restricted room ends the call for all participants a update participants event with the field 'all=true' will be thrown by the HPB. { "type": "event" "event": { "target": "participants", "type": "update", "update": [ "roomid": "the-room-id", "incall": new-incall-state, "all": true ] } } In that case the call can be ended directly without handling every single participant. Resolves: #1881 Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
parent
36a020d785
commit
4f5a344a20
2 changed files with 33 additions and 7 deletions
|
@ -93,9 +93,9 @@ import com.nextcloud.talk.utils.power.PowerManagerUtils;
|
|||
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
||||
import com.nextcloud.talk.utils.singletons.ApplicationWideCurrentRoomHolder;
|
||||
import com.nextcloud.talk.webrtc.MagicAudioManager;
|
||||
import com.nextcloud.talk.webrtc.PeerConnectionWrapper;
|
||||
import com.nextcloud.talk.webrtc.MagicWebRTCUtils;
|
||||
import com.nextcloud.talk.webrtc.MagicWebSocketInstance;
|
||||
import com.nextcloud.talk.webrtc.PeerConnectionWrapper;
|
||||
import com.nextcloud.talk.webrtc.WebSocketConnectionHelper;
|
||||
import com.wooplr.spotlight.SpotlightView;
|
||||
|
||||
|
@ -1481,11 +1481,24 @@ public class CallActivity extends CallBaseActivity {
|
|||
break;
|
||||
case "participantsUpdate":
|
||||
Log.d(TAG, "onMessageEvent 'participantsUpdate'");
|
||||
if (webSocketCommunicationEvent.getHashMap().get("roomToken").equals(roomToken)) {
|
||||
processUsersInRoom(
|
||||
(List<HashMap<String, Object>>) webSocketClient
|
||||
.getJobWithId(
|
||||
Integer.valueOf(webSocketCommunicationEvent.getHashMap().get("jobId"))));
|
||||
|
||||
// See MagicWebSocketInstance#onMessage in case "participants" how the 'updateParameters' are created
|
||||
Map<String, String> updateParameters = webSocketCommunicationEvent.getHashMap();
|
||||
|
||||
if (roomToken.equals(updateParameters.get("roomToken"))) {
|
||||
if (updateParameters.containsKey("all") && Boolean.parseBoolean(updateParameters.get("all"))) {
|
||||
if (updateParameters.containsKey("incall") && "0".equals(updateParameters.get("incall"))) {
|
||||
Log.d(TAG, "Most probably a moderator ended the call for all.");
|
||||
hangup(true);
|
||||
}
|
||||
} else if (updateParameters.containsKey("jobId")) {
|
||||
// In that case a list of users for the room is passed.
|
||||
processUsersInRoom(
|
||||
(List<HashMap<String, Object>>) webSocketClient
|
||||
.getJobWithId(
|
||||
Integer.valueOf(updateParameters.get("jobId"))));
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case "signalingMessage":
|
||||
|
|
|
@ -269,7 +269,20 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|||
HashMap<String, String> refreshChatHashMap = new HashMap<>();
|
||||
HashMap<String, Object> updateEventMap = (HashMap<String, Object>) eventOverallWebSocketMessage.getEventMap().get("update");
|
||||
refreshChatHashMap.put("roomToken", (String) updateEventMap.get("roomid"));
|
||||
refreshChatHashMap.put("jobId", Integer.toString(magicMap.add(updateEventMap.get("users"))));
|
||||
|
||||
if (updateEventMap.containsKey("users")) {
|
||||
refreshChatHashMap.put("jobId", Integer.toString(magicMap.add(updateEventMap.get("users"))));
|
||||
}
|
||||
|
||||
if (updateEventMap.containsKey("incall")) {
|
||||
refreshChatHashMap.put("incall",
|
||||
Long.toString((Long)updateEventMap.get("incall")));
|
||||
}
|
||||
|
||||
if (updateEventMap.containsKey("all")) {
|
||||
refreshChatHashMap.put("all", Boolean.toString((Boolean) updateEventMap.get("all")));
|
||||
}
|
||||
|
||||
eventBus.post(new WebSocketCommunicationEvent("participantsUpdate", refreshChatHashMap));
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue