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

@ -57,7 +57,7 @@ class RoomSelectPresenter @AssistedInject constructor(
LaunchedEffect(query, summaries) {
val filteredSummaries = summaries.filterIsInstance<RoomSummary.Filled>()
.map { it.details }
.filter { it.name.contains(query, ignoreCase = true) }
.filter { it.name.orEmpty().contains(query, ignoreCase = true) }
.distinctBy { it.roomId } // This should be removed once we're sure no duplicate Rooms can be received
.toPersistentList()
results = if (filteredSummaries.isNotEmpty()) {

View file

@ -68,4 +68,7 @@ private fun aForwardMessagesRoomList() = persistentListOf(
name = "Room with alias",
canonicalAlias = RoomAlias("#alias:example.org"),
),
aRoomSummaryDetails(
name = null,
),
)

View file

@ -235,7 +235,8 @@ private fun RoomSummaryView(
// Name
Text(
style = ElementTheme.typography.fontBodyLgRegular,
text = summary.name,
// If name is null, we do not have space to render "No room name", so just use `#` here.
text = summary.name ?: "#",
color = ElementTheme.colors.textPrimary,
maxLines = 1,
overflow = TextOverflow.Ellipsis