Join room : change state and view

This commit is contained in:
ganfra 2024-04-12 14:09:57 +02:00
parent ab8c31541b
commit a2329fc7df
11 changed files with 228 additions and 165 deletions

View file

@ -68,7 +68,8 @@ fun aRoomDescriptionList(): ImmutableList<RoomDescription> {
RoomDescription(
roomId = RoomId("!exa:matrix.org"),
name = "Element X Android",
description = "Element X is a secure, private and decentralized messenger.",
topic = "Element X is a secure, private and decentralized messenger.",
alias = "#element-x-android:matrix.org",
avatarUrl = null,
joinRule = RoomDescription.JoinRule.PUBLIC,
numberOfMembers = 2765,
@ -76,7 +77,8 @@ fun aRoomDescriptionList(): ImmutableList<RoomDescription> {
RoomDescription(
roomId = RoomId("!exi:matrix.org"),
name = "Element X iOS",
description = "Element X is a secure, private and decentralized messenger.",
topic = "Element X is a secure, private and decentralized messenger.",
alias = "#element-x-ios:matrix.org",
avatarUrl = null,
joinRule = RoomDescription.JoinRule.UNKNOWN,
numberOfMembers = 356,

View file

@ -292,14 +292,14 @@ private fun RoomDirectoryRoomRow(
.padding(start = 16.dp)
) {
Text(
text = roomDescription.name,
text = roomDescription.computedName,
maxLines = 1,
style = ElementTheme.typography.fontBodyLgRegular,
color = ElementTheme.colors.textPrimary,
overflow = TextOverflow.Ellipsis,
)
Text(
text = roomDescription.description,
text = roomDescription.computedDescription,
maxLines = 1,
style = ElementTheme.typography.fontBodyMdRegular,
color = ElementTheme.colors.textSecondary,

View file

@ -17,31 +17,15 @@
package io.element.android.features.roomdirectory.impl.root.model
import io.element.android.features.roomdirectory.api.RoomDescription
import io.element.android.libraries.designsystem.components.avatar.AvatarData
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
import io.element.android.libraries.matrix.api.roomdirectory.RoomDescription as MatrixRoomDescription
fun MatrixRoomDescription.toFeatureModel(): RoomDescription {
fun name(): String {
return name ?: alias ?: roomId.value
}
fun description(): String {
val topic = topic
val alias = alias
val name = name
return when {
topic != null -> topic
name != null && alias != null -> alias
name == null && alias == null -> ""
else -> roomId.value
}
}
return RoomDescription(
roomId = roomId,
name = name(),
description = description(),
name = name,
alias = alias,
topic = topic,
avatarUrl = avatarUrl,
numberOfMembers = numberOfMembers,
joinRule = when (joinRule) {