mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 04:29:45 +01: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
@ -2277,11 +2277,14 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String defaultGuestNick = getResources().getString(R.string.nc_nick_guest);
|
||||||
|
|
||||||
ParticipantDisplayItem participantDisplayItem = new ParticipantDisplayItem(baseUrl,
|
ParticipantDisplayItem participantDisplayItem = new ParticipantDisplayItem(baseUrl,
|
||||||
userId4Usage,
|
userId4Usage,
|
||||||
session,
|
session,
|
||||||
connected,
|
connected,
|
||||||
nick,
|
nick,
|
||||||
|
defaultGuestNick,
|
||||||
mediaStream,
|
mediaStream,
|
||||||
videoStreamType,
|
videoStreamType,
|
||||||
videoStreamEnabled,
|
videoStreamEnabled,
|
||||||
|
@ -13,6 +13,7 @@ public class ParticipantDisplayItem {
|
|||||||
private String session;
|
private String session;
|
||||||
private boolean connected;
|
private boolean connected;
|
||||||
private String nick;
|
private String nick;
|
||||||
|
private final String defaultGuestNick;
|
||||||
private String urlForAvatar;
|
private String urlForAvatar;
|
||||||
private MediaStream mediaStream;
|
private MediaStream mediaStream;
|
||||||
private String streamType;
|
private String streamType;
|
||||||
@ -20,12 +21,13 @@ public class ParticipantDisplayItem {
|
|||||||
private EglBase rootEglBase;
|
private EglBase rootEglBase;
|
||||||
private boolean isAudioEnabled;
|
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.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.defaultGuestNick = defaultGuestNick;
|
||||||
this.mediaStream = mediaStream;
|
this.mediaStream = mediaStream;
|
||||||
this.streamType = streamType;
|
this.streamType = streamType;
|
||||||
this.streamEnabled = streamEnabled;
|
this.streamEnabled = streamEnabled;
|
||||||
@ -61,6 +63,10 @@ public class ParticipantDisplayItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getNick() {
|
public String getNick() {
|
||||||
|
if (TextUtils.isEmpty(userId) && TextUtils.isEmpty(nick)) {
|
||||||
|
return defaultGuestNick;
|
||||||
|
}
|
||||||
|
|
||||||
return nick;
|
return nick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +84,7 @@ public class ParticipantDisplayItem {
|
|||||||
if (!TextUtils.isEmpty(userId)) {
|
if (!TextUtils.isEmpty(userId)) {
|
||||||
urlForAvatar = ApiUtils.getUrlForAvatar(baseUrl, userId, true);
|
urlForAvatar = ApiUtils.getUrlForAvatar(baseUrl, userId, true);
|
||||||
} else {
|
} else {
|
||||||
urlForAvatar = ApiUtils.getUrlForGuestAvatar(baseUrl, nick, true);
|
urlForAvatar = ApiUtils.getUrlForGuestAvatar(baseUrl, getNick(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,11 +24,9 @@
|
|||||||
package com.nextcloud.talk.webrtc;
|
package com.nextcloud.talk.webrtc;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.LoganSquare;
|
import com.bluelinelabs.logansquare.LoganSquare;
|
||||||
import com.nextcloud.talk.R;
|
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||||
import com.nextcloud.talk.events.MediaStreamEvent;
|
import com.nextcloud.talk.events.MediaStreamEvent;
|
||||||
import com.nextcloud.talk.events.PeerConnectionEvent;
|
import com.nextcloud.talk.events.PeerConnectionEvent;
|
||||||
@ -223,11 +221,7 @@ public class PeerConnectionWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getNick() {
|
public String getNick() {
|
||||||
if (!TextUtils.isEmpty(nick)) {
|
|
||||||
return nick;
|
return nick;
|
||||||
} else {
|
|
||||||
return Objects.requireNonNull(NextcloudTalkApplication.Companion.getSharedApplication()).getString(R.string.nc_nick_guest);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNick(String nick) {
|
private void setNick(String nick) {
|
||||||
|
Loading…
Reference in New Issue
Block a user