feature(space): compute space room name locally
This commit is contained in:
parent
68700d9bf9
commit
8d94df09ac
7 changed files with 37 additions and 14 deletions
|
|
@ -15,7 +15,7 @@ import io.element.android.libraries.matrix.api.room.join.JoinRule
|
|||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
||||
|
||||
data class SpaceRoom(
|
||||
val name: String?,
|
||||
val rawName: String?,
|
||||
val avatarUrl: String?,
|
||||
val canonicalAlias: RoomAlias?,
|
||||
val childrenCount: Int,
|
||||
|
|
@ -32,6 +32,18 @@ data class SpaceRoom(
|
|||
* The via parameters of the room.
|
||||
*/
|
||||
val via: List<String>,
|
||||
val isDirect: Boolean?,
|
||||
) {
|
||||
val isSpace = roomType == RoomType.Space
|
||||
|
||||
/**
|
||||
* Temporary logic to compute a name for direct rooms with no name.
|
||||
* This will be replaced by sdk logic in the future.
|
||||
*/
|
||||
val name = if (rawName == null && isDirect == true && heroes.size == 1) {
|
||||
val dmRecipient = heroes.first()
|
||||
dmRecipient.displayName
|
||||
} else {
|
||||
rawName
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class SpaceRoomMapper {
|
|||
guestCanJoin = spaceRoom.guestCanJoin,
|
||||
heroes = spaceRoom.heroes.orEmpty().map { it.map() },
|
||||
joinRule = spaceRoom.joinRule?.map(),
|
||||
name = spaceRoom.name,
|
||||
rawName = spaceRoom.name,
|
||||
numJoinedMembers = spaceRoom.numJoinedMembers.toInt(),
|
||||
roomId = RoomId(spaceRoom.roomId),
|
||||
roomType = spaceRoom.roomType.map(),
|
||||
|
|
@ -32,6 +32,7 @@ class SpaceRoomMapper {
|
|||
topic = spaceRoom.topic,
|
||||
worldReadable = spaceRoom.worldReadable.orFalse(),
|
||||
via = spaceRoom.via,
|
||||
isDirect = spaceRoom.isDirect,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue