mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-22 21:15:30 +03:00
Move default nick out of PeerConnectionWrapper
If the nick is not known whether "Guest" or something else needs to be shown is a responsability of the UI, so now the PeerConnectionWrapper just returns an empty string and the UI shows the default guest nick if needed. Moreover, the nick stored in the PeerConnectionWrapper was not always correct, as if no nick was received it was returned as "Guest" even if the connection belonged to a user. Now "Guest" is used only for actual guests. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
68cf4ee028
commit
2eac8c2cba
3 changed files with 12 additions and 9 deletions
|
@ -2277,11 +2277,14 @@ public class CallActivity extends CallBaseActivity {
|
|||
}
|
||||
}
|
||||
|
||||
String defaultGuestNick = getResources().getString(R.string.nc_nick_guest);
|
||||
|
||||
ParticipantDisplayItem participantDisplayItem = new ParticipantDisplayItem(baseUrl,
|
||||
userId4Usage,
|
||||
session,
|
||||
connected,
|
||||
nick,
|
||||
defaultGuestNick,
|
||||
mediaStream,
|
||||
videoStreamType,
|
||||
videoStreamEnabled,
|
||||
|
|
|
@ -13,6 +13,7 @@ public class ParticipantDisplayItem {
|
|||
private String session;
|
||||
private boolean connected;
|
||||
private String nick;
|
||||
private final String defaultGuestNick;
|
||||
private String urlForAvatar;
|
||||
private MediaStream mediaStream;
|
||||
private String streamType;
|
||||
|
@ -20,12 +21,13 @@ public class ParticipantDisplayItem {
|
|||
private EglBase rootEglBase;
|
||||
private boolean isAudioEnabled;
|
||||
|
||||
public ParticipantDisplayItem(String baseUrl, String userId, String session, boolean connected, String nick, MediaStream mediaStream, String streamType, boolean streamEnabled, EglBase rootEglBase) {
|
||||
public ParticipantDisplayItem(String baseUrl, String userId, String session, boolean connected, String nick, String defaultGuestNick, MediaStream mediaStream, String streamType, boolean streamEnabled, EglBase rootEglBase) {
|
||||
this.baseUrl = baseUrl;
|
||||
this.userId = userId;
|
||||
this.session = session;
|
||||
this.connected = connected;
|
||||
this.nick = nick;
|
||||
this.defaultGuestNick = defaultGuestNick;
|
||||
this.mediaStream = mediaStream;
|
||||
this.streamType = streamType;
|
||||
this.streamEnabled = streamEnabled;
|
||||
|
@ -61,6 +63,10 @@ public class ParticipantDisplayItem {
|
|||
}
|
||||
|
||||
public String getNick() {
|
||||
if (TextUtils.isEmpty(userId) && TextUtils.isEmpty(nick)) {
|
||||
return defaultGuestNick;
|
||||
}
|
||||
|
||||
return nick;
|
||||
}
|
||||
|
||||
|
@ -78,7 +84,7 @@ public class ParticipantDisplayItem {
|
|||
if (!TextUtils.isEmpty(userId)) {
|
||||
urlForAvatar = ApiUtils.getUrlForAvatar(baseUrl, userId, true);
|
||||
} else {
|
||||
urlForAvatar = ApiUtils.getUrlForGuestAvatar(baseUrl, nick, true);
|
||||
urlForAvatar = ApiUtils.getUrlForGuestAvatar(baseUrl, getNick(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,9 @@
|
|||
package com.nextcloud.talk.webrtc;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.bluelinelabs.logansquare.LoganSquare;
|
||||
import com.nextcloud.talk.R;
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||
import com.nextcloud.talk.events.MediaStreamEvent;
|
||||
import com.nextcloud.talk.events.PeerConnectionEvent;
|
||||
|
@ -223,11 +221,7 @@ public class PeerConnectionWrapper {
|
|||
}
|
||||
|
||||
public String getNick() {
|
||||
if (!TextUtils.isEmpty(nick)) {
|
||||
return nick;
|
||||
} else {
|
||||
return Objects.requireNonNull(NextcloudTalkApplication.Companion.getSharedApplication()).getString(R.string.nc_nick_guest);
|
||||
}
|
||||
return nick;
|
||||
}
|
||||
|
||||
private void setNick(String nick) {
|
||||
|
|
Loading…
Reference in a new issue