mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 03:29:28 +01:00
Show proper avatar for federated users in calls
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
3b7c5e1d27
commit
0ff783ef0b
@ -2517,10 +2517,12 @@ class CallActivity : CallBaseActivity() {
|
|||||||
}
|
}
|
||||||
val defaultGuestNick = resources.getString(R.string.nc_nick_guest)
|
val defaultGuestNick = resources.getString(R.string.nc_nick_guest)
|
||||||
val participantDisplayItem = ParticipantDisplayItem(
|
val participantDisplayItem = ParticipantDisplayItem(
|
||||||
|
context,
|
||||||
baseUrl,
|
baseUrl,
|
||||||
defaultGuestNick,
|
defaultGuestNick,
|
||||||
rootEglBase,
|
rootEglBase,
|
||||||
videoStreamType,
|
videoStreamType,
|
||||||
|
roomToken,
|
||||||
callParticipantModel
|
callParticipantModel
|
||||||
)
|
)
|
||||||
val sessionId = callParticipantModel.sessionId
|
val sessionId = callParticipantModel.sessionId
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.nextcloud.talk.adapters;
|
package com.nextcloud.talk.adapters;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@ -16,6 +17,7 @@ import com.nextcloud.talk.call.CallParticipantModel;
|
|||||||
import com.nextcloud.talk.call.RaisedHand;
|
import com.nextcloud.talk.call.RaisedHand;
|
||||||
import com.nextcloud.talk.models.json.participants.Participant;
|
import com.nextcloud.talk.models.json.participants.Participant;
|
||||||
import com.nextcloud.talk.utils.ApiUtils;
|
import com.nextcloud.talk.utils.ApiUtils;
|
||||||
|
import com.nextcloud.talk.utils.DisplayUtils;
|
||||||
|
|
||||||
import org.webrtc.EglBase;
|
import org.webrtc.EglBase;
|
||||||
import org.webrtc.MediaStream;
|
import org.webrtc.MediaStream;
|
||||||
@ -30,6 +32,8 @@ public class ParticipantDisplayItem {
|
|||||||
|
|
||||||
private final ParticipantDisplayItemNotifier participantDisplayItemNotifier = new ParticipantDisplayItemNotifier();
|
private final ParticipantDisplayItemNotifier participantDisplayItemNotifier = new ParticipantDisplayItemNotifier();
|
||||||
|
|
||||||
|
private final Context context;
|
||||||
|
|
||||||
private final String baseUrl;
|
private final String baseUrl;
|
||||||
private final String defaultGuestNick;
|
private final String defaultGuestNick;
|
||||||
private final EglBase rootEglBase;
|
private final EglBase rootEglBase;
|
||||||
@ -37,6 +41,8 @@ public class ParticipantDisplayItem {
|
|||||||
private final String session;
|
private final String session;
|
||||||
private final String streamType;
|
private final String streamType;
|
||||||
|
|
||||||
|
private final String roomToken;
|
||||||
|
|
||||||
private final CallParticipantModel callParticipantModel;
|
private final CallParticipantModel callParticipantModel;
|
||||||
|
|
||||||
private Participant.ActorType actorType;
|
private Participant.ActorType actorType;
|
||||||
@ -65,8 +71,10 @@ public class ParticipantDisplayItem {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public ParticipantDisplayItem(String baseUrl, String defaultGuestNick, EglBase rootEglBase, String streamType,
|
public ParticipantDisplayItem(Context context, String baseUrl, String defaultGuestNick, EglBase rootEglBase,
|
||||||
CallParticipantModel callParticipantModel) {
|
String streamType, String roomToken, CallParticipantModel callParticipantModel) {
|
||||||
|
this.context = context;
|
||||||
|
|
||||||
this.baseUrl = baseUrl;
|
this.baseUrl = baseUrl;
|
||||||
this.defaultGuestNick = defaultGuestNick;
|
this.defaultGuestNick = defaultGuestNick;
|
||||||
this.rootEglBase = rootEglBase;
|
this.rootEglBase = rootEglBase;
|
||||||
@ -74,6 +82,8 @@ public class ParticipantDisplayItem {
|
|||||||
this.session = callParticipantModel.getSessionId();
|
this.session = callParticipantModel.getSessionId();
|
||||||
this.streamType = streamType;
|
this.streamType = streamType;
|
||||||
|
|
||||||
|
this.roomToken = roomToken;
|
||||||
|
|
||||||
this.callParticipantModel = callParticipantModel;
|
this.callParticipantModel = callParticipantModel;
|
||||||
this.callParticipantModel.addObserver(callParticipantModelObserver, handler);
|
this.callParticipantModel.addObserver(callParticipantModelObserver, handler);
|
||||||
|
|
||||||
@ -112,7 +122,10 @@ public class ParticipantDisplayItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateUrlForAvatar() {
|
private void updateUrlForAvatar() {
|
||||||
if (!TextUtils.isEmpty(userId)) {
|
if (actorType == Participant.ActorType.FEDERATED) {
|
||||||
|
int darkTheme = DisplayUtils.INSTANCE.isDarkModeOn(context) ? 1 : 0;
|
||||||
|
urlForAvatar = ApiUtils.getUrlForFederatedAvatar(baseUrl, roomToken, actorId, darkTheme, true);
|
||||||
|
} else if (!TextUtils.isEmpty(userId)) {
|
||||||
urlForAvatar = ApiUtils.getUrlForAvatar(baseUrl, userId, true);
|
urlForAvatar = ApiUtils.getUrlForAvatar(baseUrl, userId, true);
|
||||||
} else {
|
} else {
|
||||||
urlForAvatar = ApiUtils.getUrlForGuestAvatar(baseUrl, getNick(), true);
|
urlForAvatar = ApiUtils.getUrlForGuestAvatar(baseUrl, getNick(), true);
|
||||||
|
Loading…
Reference in New Issue
Block a user