Merge pull request #2540 from nextcloud/fix-update-of-guest-avatars-in-call-participants

Fix update of guest avatars in call participants
This commit is contained in:
Tim Krüger 2022-11-07 12:15:37 +01:00 committed by GitHub
commit 3d89d6b22f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 17 deletions

View File

@ -2382,22 +2382,11 @@ public class CallActivity extends CallBaseActivity {
} }
} }
String urlForAvatar; ParticipantDisplayItem participantDisplayItem = new ParticipantDisplayItem(baseUrl,
if (!TextUtils.isEmpty(userId4Usage)) {
urlForAvatar = ApiUtils.getUrlForAvatar(baseUrl,
userId4Usage, userId4Usage,
true);
} else {
urlForAvatar = ApiUtils.getUrlForGuestAvatar(baseUrl,
nick,
true);
}
ParticipantDisplayItem participantDisplayItem = new ParticipantDisplayItem(userId4Usage,
session, session,
connected, connected,
nick, nick,
urlForAvatar,
mediaStream, mediaStream,
videoStreamType, videoStreamType,
videoStreamEnabled, videoStreamEnabled,

View File

@ -1,9 +1,14 @@
package com.nextcloud.talk.adapters; package com.nextcloud.talk.adapters;
import android.text.TextUtils;
import com.nextcloud.talk.utils.ApiUtils;
import org.webrtc.EglBase; import org.webrtc.EglBase;
import org.webrtc.MediaStream; import org.webrtc.MediaStream;
public class ParticipantDisplayItem { public class ParticipantDisplayItem {
private String baseUrl;
private String userId; private String userId;
private String session; private String session;
private boolean connected; private boolean connected;
@ -15,16 +20,18 @@ public class ParticipantDisplayItem {
private EglBase rootEglBase; private EglBase rootEglBase;
private boolean isAudioEnabled; private boolean isAudioEnabled;
public ParticipantDisplayItem(String userId, String session, boolean connected, String nick, String urlForAvatar, MediaStream mediaStream, String streamType, boolean streamEnabled, EglBase rootEglBase) { public ParticipantDisplayItem(String baseUrl, String userId, String session, boolean connected, String nick, MediaStream mediaStream, String streamType, boolean streamEnabled, EglBase rootEglBase) {
this.baseUrl = baseUrl;
this.userId = userId; this.userId = userId;
this.session = session; this.session = session;
this.connected = connected; this.connected = connected;
this.nick = nick; this.nick = nick;
this.urlForAvatar = urlForAvatar;
this.mediaStream = mediaStream; this.mediaStream = mediaStream;
this.streamType = streamType; this.streamType = streamType;
this.streamEnabled = streamEnabled; this.streamEnabled = streamEnabled;
this.rootEglBase = rootEglBase; this.rootEglBase = rootEglBase;
this.updateUrlForAvatar();
} }
public String getUserId() { public String getUserId() {
@ -33,6 +40,8 @@ public class ParticipantDisplayItem {
public void setUserId(String userId) { public void setUserId(String userId) {
this.userId = userId; this.userId = userId;
this.updateUrlForAvatar();
} }
public String getSession() { public String getSession() {
@ -57,14 +66,20 @@ public class ParticipantDisplayItem {
public void setNick(String nick) { public void setNick(String nick) {
this.nick = nick; this.nick = nick;
this.updateUrlForAvatar();
} }
public String getUrlForAvatar() { public String getUrlForAvatar() {
return urlForAvatar; return urlForAvatar;
} }
public void setUrlForAvatar(String urlForAvatar) { private void updateUrlForAvatar() {
this.urlForAvatar = urlForAvatar; if (!TextUtils.isEmpty(userId)) {
urlForAvatar = ApiUtils.getUrlForAvatar(baseUrl, userId, true);
} else {
urlForAvatar = ApiUtils.getUrlForGuestAvatar(baseUrl, nick, true);
}
} }
public MediaStream getMediaStream() { public MediaStream getMediaStream() {