mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 19:36:08 +03:00
Call: fix wrong opponent name
This commit is contained in:
parent
3b1249c489
commit
d3e4a3c010
1 changed files with 6 additions and 3 deletions
|
@ -16,17 +16,20 @@
|
||||||
|
|
||||||
package im.vector.app.features.call.webrtc
|
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.session.Session
|
||||||
import org.matrix.android.sdk.api.util.MatrixItem
|
import org.matrix.android.sdk.api.util.MatrixItem
|
||||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||||
|
|
||||||
fun WebRtcCall.getOpponentAsMatrixItem(session: Session): MatrixItem? {
|
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.
|
// Fallback to RoomSummary if there is no other member.
|
||||||
if (roomSummary.otherMemberIds.isEmpty()) {
|
if (roomSummary.otherMemberIds.isEmpty().orFalse()) {
|
||||||
roomSummary.toMatrixItem()
|
roomSummary.toMatrixItem()
|
||||||
} else {
|
} else {
|
||||||
roomSummary.otherMemberIds.first().let { session.getUser(it)?.toMatrixItem() }
|
val userId = roomSummary.otherMemberIds.first()
|
||||||
|
return room.getRoomMember(userId)?.toMatrixItem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue