mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-24 22:19:59 +01:00
Merge pull request #904 from nextcloud/fix-some-issues-related-to-guest-participants
[v8.0.x] Fix some issues related to guest participants
This commit is contained in:
commit
4f83d47f51
@ -1746,7 +1746,7 @@ public class CallController extends BaseController {
|
|||||||
}
|
}
|
||||||
} else if (peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent
|
} else if (peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent
|
||||||
.PeerConnectionEventType.NICK_CHANGE)) {
|
.PeerConnectionEventType.NICK_CHANGE)) {
|
||||||
gotNick(peerConnectionEvent.getSessionId(), peerConnectionEvent.getNick(), true, peerConnectionEvent.getVideoStreamType());
|
gotNick(peerConnectionEvent.getSessionId(), peerConnectionEvent.getNick(), peerConnectionEvent.getVideoStreamType());
|
||||||
} else if (peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent
|
} else if (peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent
|
||||||
.PeerConnectionEventType.VIDEO_CHANGE) && !isVoiceOnlyCall) {
|
.PeerConnectionEventType.VIDEO_CHANGE) && !isVoiceOnlyCall) {
|
||||||
gotAudioOrVideoChange(true, peerConnectionEvent.getSessionId() + "+" + peerConnectionEvent.getVideoStreamType(),
|
gotAudioOrVideoChange(true, peerConnectionEvent.getSessionId() + "+" + peerConnectionEvent.getVideoStreamType(),
|
||||||
@ -1914,23 +1914,35 @@ public class CallController extends BaseController {
|
|||||||
SimpleDraweeView avatarImageView = relativeLayout.findViewById(R.id.avatarImageView);
|
SimpleDraweeView avatarImageView = relativeLayout.findViewById(R.id.avatarImageView);
|
||||||
|
|
||||||
String userId;
|
String userId;
|
||||||
|
String displayName;
|
||||||
|
|
||||||
if (hasMCU) {
|
if (hasMCU) {
|
||||||
userId = webSocketClient.getUserIdForSession(session);
|
userId = webSocketClient.getUserIdForSession(session);
|
||||||
|
displayName = getPeerConnectionWrapperForSessionIdAndType(session, "video", false).getNick();
|
||||||
} else {
|
} else {
|
||||||
userId = participantMap.get(session).getUserId();
|
userId = participantMap.get(session).getUserId();
|
||||||
|
displayName = getPeerConnectionWrapperForSessionIdAndType(session, "video", false).getNick();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(userId)) {
|
if (!TextUtils.isEmpty(userId) || !TextUtils.isEmpty(displayName)) {
|
||||||
|
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
avatarImageView.setController(null);
|
avatarImageView.setController(null);
|
||||||
|
|
||||||
|
String urlForAvatar;
|
||||||
|
if (!TextUtils.isEmpty(userId)) {
|
||||||
|
urlForAvatar = ApiUtils.getUrlForAvatarWithName(baseUrl,
|
||||||
|
userId,
|
||||||
|
R.dimen.avatar_size_big);
|
||||||
|
} else {
|
||||||
|
urlForAvatar = ApiUtils.getUrlForAvatarWithNameForGuests(baseUrl,
|
||||||
|
displayName,
|
||||||
|
R.dimen.avatar_size_big);
|
||||||
|
}
|
||||||
|
|
||||||
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
|
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
|
||||||
.setOldController(avatarImageView.getController())
|
.setOldController(avatarImageView.getController())
|
||||||
.setImageRequest(DisplayUtils.getImageRequestForUrl(ApiUtils.getUrlForAvatarWithName(baseUrl,
|
.setImageRequest(DisplayUtils.getImageRequestForUrl(urlForAvatar, null))
|
||||||
userId,
|
|
||||||
R.dimen.avatar_size_big), null))
|
|
||||||
.build();
|
.build();
|
||||||
avatarImageView.setController(draweeController);
|
avatarImageView.setController(draweeController);
|
||||||
}
|
}
|
||||||
@ -2017,9 +2029,9 @@ public class CallController extends BaseController {
|
|||||||
surfaceViewRenderer.setOnClickListener(videoOnClickListener);
|
surfaceViewRenderer.setOnClickListener(videoOnClickListener);
|
||||||
remoteRenderersLayout.addView(relativeLayout);
|
remoteRenderersLayout.addView(relativeLayout);
|
||||||
if (hasExternalSignalingServer) {
|
if (hasExternalSignalingServer) {
|
||||||
gotNick(session, webSocketClient.getDisplayNameForSession(session), false, type);
|
gotNick(session, webSocketClient.getDisplayNameForSession(session), type);
|
||||||
} else {
|
} else {
|
||||||
gotNick(session, getPeerConnectionWrapperForSessionIdAndType(session, type, false).getNick(), false, type);
|
gotNick(session, getPeerConnectionWrapperForSessionIdAndType(session, type, false).getNick(), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("video".equals(type)) {
|
if ("video".equals(type)) {
|
||||||
@ -2031,19 +2043,18 @@ public class CallController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void gotNick(String sessionOrUserId, String nick, boolean isFromAnEvent, String type) {
|
private void gotNick(String sessionId, String nick, String type) {
|
||||||
if (isFromAnEvent && hasExternalSignalingServer) {
|
String remoteRendererTag = sessionId + "+" + type;
|
||||||
// get session based on userId
|
|
||||||
sessionOrUserId = webSocketClient.getSessionForUserId(sessionOrUserId);
|
|
||||||
}
|
|
||||||
|
|
||||||
sessionOrUserId += "+" + type;
|
|
||||||
|
|
||||||
if (relativeLayout != null) {
|
if (relativeLayout != null) {
|
||||||
RelativeLayout relativeLayout = remoteRenderersLayout.findViewWithTag(sessionOrUserId);
|
RelativeLayout relativeLayout = remoteRenderersLayout.findViewWithTag(remoteRendererTag);
|
||||||
TextView textView = relativeLayout.findViewById(R.id.peer_nick_text_view);
|
TextView textView = relativeLayout.findViewById(R.id.peer_nick_text_view);
|
||||||
if (!textView.getText().equals(nick)) {
|
if (!textView.getText().equals(nick)) {
|
||||||
textView.setText(nick);
|
textView.setText(nick);
|
||||||
|
|
||||||
|
if (getActivity() != null && type.equals("video")) {
|
||||||
|
getActivity().runOnUiThread(() -> setupAvatarForSession(sessionId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ public class MagicPeerConnectionWrapper {
|
|||||||
if (dataChannelMessage.getPayload() instanceof String) {
|
if (dataChannelMessage.getPayload() instanceof String) {
|
||||||
internalNick = (String) dataChannelMessage.getPayload();
|
internalNick = (String) dataChannelMessage.getPayload();
|
||||||
if (!internalNick.equals(nick)) {
|
if (!internalNick.equals(nick)) {
|
||||||
setNick(nick);
|
setNick(internalNick);
|
||||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
|
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
|
||||||
.NICK_CHANGE, sessionId, getNick(), null, videoStreamType));
|
.NICK_CHANGE, sessionId, getNick(), null, videoStreamType));
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ public class MagicPeerConnectionWrapper {
|
|||||||
if (dataChannelMessage.getPayload() != null) {
|
if (dataChannelMessage.getPayload() != null) {
|
||||||
HashMap<String, String> payloadHashMap = (HashMap<String, String>) dataChannelMessage.getPayload();
|
HashMap<String, String> payloadHashMap = (HashMap<String, String>) dataChannelMessage.getPayload();
|
||||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
|
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
|
||||||
.NICK_CHANGE, payloadHashMap.get("userid"), payloadHashMap.get("name"), null, videoStreamType));
|
.NICK_CHANGE, sessionId, payloadHashMap.get("name"), null, videoStreamType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,10 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|||||||
HashMap<String, Object> userMap = (HashMap<String, Object>) internalHashMap.get("user");
|
HashMap<String, Object> userMap = (HashMap<String, Object>) internalHashMap.get("user");
|
||||||
participant = new Participant();
|
participant = new Participant();
|
||||||
participant.setUserId((String) internalHashMap.get("userid"));
|
participant.setUserId((String) internalHashMap.get("userid"));
|
||||||
|
if (userMap != null) {
|
||||||
|
// There is no "user" attribute for guest participants.
|
||||||
participant.setDisplayName((String) userMap.get("displayname"));
|
participant.setDisplayName((String) userMap.get("displayname"));
|
||||||
|
}
|
||||||
usersHashMap.put((String) internalHashMap.get("sessionid"), participant);
|
usersHashMap.put((String) internalHashMap.get("sessionid"), participant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,16 +406,6 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|||||||
return NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_nick_guest);
|
return NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_nick_guest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSessionForUserId(String userId) {
|
|
||||||
for (String session : usersHashMap.keySet()) {
|
|
||||||
if (userId.equals(usersHashMap.get(session).getUserId())) {
|
|
||||||
return session;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserIdForSession(String session) {
|
public String getUserIdForSession(String session) {
|
||||||
if (usersHashMap.containsKey(session)) {
|
if (usersHashMap.containsKey(session)) {
|
||||||
return usersHashMap.get(session).getUserId();
|
return usersHashMap.get(session).getUserId();
|
||||||
|
Loading…
Reference in New Issue
Block a user