diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt index 3bf1c9ff97..18d040b90c 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt @@ -71,7 +71,7 @@ internal fun aRoomListRoomSummaryList(): ImmutableList { return persistentListOf( RoomListRoomSummary( name = "Room", - numUnreadMessages = 1, + numberOfUnreadMessages = 1, timestamp = "14:18", lastMessage = "A very very very very long message which suites on two lines", avatarData = AvatarData("!id", "R", size = AvatarSize.RoomListItem), @@ -80,7 +80,7 @@ internal fun aRoomListRoomSummaryList(): ImmutableList { ), RoomListRoomSummary( name = "Room#2", - numUnreadMessages = 0, + numberOfUnreadMessages = 0, timestamp = "14:16", lastMessage = "A short message", avatarData = AvatarData("!id", "Z", size = AvatarSize.RoomListItem), diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt index 7c9ecced2d..dd16a281c2 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt @@ -174,15 +174,23 @@ private fun RowScope.LastMessageAndIndicatorRow(room: RoomListRoomSummary) { verticalAlignment = Alignment.CenterVertically, ) { // Video call - OnGoingCallIcon(room) + OnGoingCallIcon( + room.hasRoomCall, + ) // Other indicators - NotificationIcons(room) + NotificationIcons( + room.userDefinedNotificationMode, + room.numberOfUnreadMessages, + room.numberOfUnreadMentions, + ) } } @Composable -private fun OnGoingCallIcon(room: RoomListRoomSummary) { - if (room.hasRoomCall) { +private fun OnGoingCallIcon( + hasRoomCall: Boolean, +) { + if (hasRoomCall) { Icon( modifier = Modifier.size(16.dp), imageVector = CompoundIcons.VideoCallSolid, @@ -193,11 +201,15 @@ private fun OnGoingCallIcon(room: RoomListRoomSummary) { } @Composable -private fun RowScope.NotificationIcons(room: RoomListRoomSummary) { - when (room.userDefinedNotificationMode) { +private fun RowScope.NotificationIcons( + userDefinedNotificationMode: RoomNotificationMode?, + numberOfUnreadMessages: Int, + numberOfUnreadMentions: Int, +) { + when (userDefinedNotificationMode) { null, RoomNotificationMode.ALL_MESSAGES -> { - if (room.numUnreadMentions > 0) { + if (numberOfUnreadMentions > 0) { Icon( modifier = Modifier.size(16.dp), contentDescription = null, @@ -205,12 +217,12 @@ private fun RowScope.NotificationIcons(room: RoomListRoomSummary) { tint = ElementTheme.colors.unreadIndicator, ) UnreadIndicatorAtom() - } else if (room.numUnreadMessages > 0) { + } else if (numberOfUnreadMessages > 0) { UnreadIndicatorAtom() } } RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY -> { - if (room.numUnreadMentions > 0) { + if (numberOfUnreadMentions > 0) { Icon( modifier = Modifier.size(16.dp), contentDescription = null, @@ -218,7 +230,7 @@ private fun RowScope.NotificationIcons(room: RoomListRoomSummary) { tint = ElementTheme.colors.unreadIndicator, ) UnreadIndicatorAtom() - } else if (room.numUnreadMessages > 0) { + } else if (numberOfUnreadMessages > 0) { UnreadIndicatorAtom(color = ElementTheme.colors.iconQuaternary) } } @@ -229,7 +241,7 @@ private fun RowScope.NotificationIcons(room: RoomListRoomSummary) { imageVector = CompoundIcons.NotificationsSolidOff, tint = ElementTheme.colors.iconQuaternary, ) - if (room.numUnreadMessages > 0 || room.numUnreadMentions > 0) { + if (numberOfUnreadMessages > 0 || numberOfUnreadMentions > 0) { UnreadIndicatorAtom(color = ElementTheme.colors.iconQuaternary) } } diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt index e8a6a5537d..419a003887 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/datasource/RoomListDataSource.kt @@ -154,8 +154,8 @@ class RoomListDataSource @Inject constructor( id = roomSummary.identifier(), roomId = RoomId(roomIdentifier), name = roomSummary.details.name, - numUnreadMessages = roomSummary.details.numUnreadMessages, - numUnreadMentions = roomSummary.details.numUnreadMentions, + numberOfUnreadMessages = roomSummary.details.numUnreadMessages, + numberOfUnreadMentions = roomSummary.details.numUnreadMentions, timestamp = lastMessageTimestampFormatter.format(roomSummary.details.lastMessageTimestamp), lastMessage = roomSummary.details.lastMessage?.let { message -> roomLastMessageFormatter.format(message.event, roomSummary.details.isDirect) diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt index 4c4fd53a97..826a9094ab 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt @@ -32,8 +32,8 @@ data class RoomListRoomSummary( val avatarData: AvatarData = AvatarData(id, name, size = AvatarSize.RoomListItem), val isPlaceholder: Boolean = false, val userDefinedNotificationMode: RoomNotificationMode? = null, - val numUnreadMessages: Int = 0, - val numUnreadMentions: Int = 0, + val numberOfUnreadMessages: Int = 0, + val numberOfUnreadMentions: Int = 0, val hasRoomCall: Boolean = false, ) @@ -41,8 +41,8 @@ fun RoomListRoomSummary.isTimestampHighlighted(): Boolean { return hasRoomCall || when (userDefinedNotificationMode) { null, - RoomNotificationMode.ALL_MESSAGES -> numUnreadMessages > 0 || numUnreadMentions > 0 - RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY -> numUnreadMentions > 0 + RoomNotificationMode.ALL_MESSAGES -> numberOfUnreadMessages > 0 || numberOfUnreadMentions > 0 + RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY -> numberOfUnreadMentions > 0 RoomNotificationMode.MUTE -> false } } diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt index f530a2a3c3..7c7082d6e5 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt @@ -35,7 +35,7 @@ open class RoomListRoomSummaryProvider : PreviewParameterProvider @@ -49,32 +49,32 @@ open class RoomListRoomSummaryProvider : PreviewParameterProvider