Call: fix wrong opponent name
This commit is contained in:
parent
3b1249c489
commit
d3e4a3c010
@ -16,17 +16,20 @@
|
||||
|
||||
package im.vector.app.features.call.webrtc
|
||||
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
import org.matrix.android.sdk.api.util.MatrixItem
|
||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||
|
||||
fun WebRtcCall.getOpponentAsMatrixItem(session: Session): MatrixItem? {
|
||||
return session.getRoomSummary(nativeRoomId)?.let { roomSummary ->
|
||||
return session.getRoom(nativeRoomId)?.let { room ->
|
||||
val roomSummary = room.roomSummary() ?: return@let null
|
||||
// Fallback to RoomSummary if there is no other member.
|
||||
if (roomSummary.otherMemberIds.isEmpty()) {
|
||||
if (roomSummary.otherMemberIds.isEmpty().orFalse()) {
|
||||
roomSummary.toMatrixItem()
|
||||
} else {
|
||||
roomSummary.otherMemberIds.first().let { session.getUser(it)?.toMatrixItem() }
|
||||
val userId = roomSummary.otherMemberIds.first()
|
||||
return room.getRoomMember(userId)?.toMatrixItem()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user