Ensure roomId are not rendered in the UI.

Add preview to see the effect.
Use RoomAvatar data fallback everywhere, to not use roomId (`!` char) for the avatar initial, but rather `#`.
This commit is contained in:
Benoit Marty 2024-04-25 11:47:00 +02:00
parent 3d29d8729a
commit ce7bb11724
23 changed files with 107 additions and 69 deletions

View file

@ -29,12 +29,13 @@ open class RoomSummaryDetailsProvider : PreviewParameterProvider<RoomSummaryDeta
override val values: Sequence<RoomSummaryDetails>
get() = sequenceOf(
aRoomSummaryDetails(),
aRoomSummaryDetails(name = null),
)
}
fun aRoomSummaryDetails(
roomId: RoomId = RoomId("!room:domain"),
name: String = "roomName",
name: String? = "roomName",
canonicalAlias: RoomAlias? = null,
isDirect: Boolean = true,
avatarUrl: String? = null,

View file

@ -62,7 +62,8 @@ fun SelectedRoom(
) {
Avatar(AvatarData(roomSummary.roomId.value, roomSummary.name, roomSummary.avatarUrl, AvatarSize.SelectedRoom))
Text(
text = roomSummary.name,
// If name is null, we do not have space to render "No room name", so just use `#` here.
text = roomSummary.name ?: "#",
overflow = TextOverflow.Ellipsis,
maxLines = 1,
style = MaterialTheme.typography.bodyLarge,