Handle PR review.
This commit is contained in:
parent
3a7804b3b0
commit
02fe9c4580
6 changed files with 45 additions and 33 deletions
|
|
@ -71,7 +71,7 @@ internal fun aRoomListRoomSummaryList(): ImmutableList<RoomListRoomSummary> {
|
|||
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> {
|
|||
),
|
||||
RoomListRoomSummary(
|
||||
name = "Room#2",
|
||||
numUnreadMessages = 0,
|
||||
numberOfUnreadMessages = 0,
|
||||
timestamp = "14:16",
|
||||
lastMessage = "A short message",
|
||||
avatarData = AvatarData("!id", "Z", size = AvatarSize.RoomListItem),
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ open class RoomListRoomSummaryProvider : PreviewParameterProvider<RoomListRoomSu
|
|||
" ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea com" +
|
||||
"modo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
|
||||
timestamp = "yesterday",
|
||||
numUnreadMessages = 1,
|
||||
numberOfUnreadMessages = 1,
|
||||
),
|
||||
),
|
||||
listOf(false, true).map { hasCall ->
|
||||
|
|
@ -49,32 +49,32 @@ open class RoomListRoomSummaryProvider : PreviewParameterProvider<RoomListRoomSu
|
|||
name = roomNotificationMode.name,
|
||||
lastMessage = "No activity" + if (hasCall) ", call" else "",
|
||||
notificationMode = roomNotificationMode,
|
||||
numUnreadMessages = 0,
|
||||
numUnreadMentions = 0,
|
||||
numberOfUnreadMessages = 0,
|
||||
numberOfUnreadMentions = 0,
|
||||
hasOngoingCall = hasCall,
|
||||
),
|
||||
aRoomListRoomSummary(
|
||||
name = roomNotificationMode.name,
|
||||
lastMessage = "New messages" + if (hasCall) ", call" else "",
|
||||
notificationMode = roomNotificationMode,
|
||||
numUnreadMessages = 1,
|
||||
numUnreadMentions = 0,
|
||||
numberOfUnreadMessages = 1,
|
||||
numberOfUnreadMentions = 0,
|
||||
hasOngoingCall = hasCall,
|
||||
),
|
||||
aRoomListRoomSummary(
|
||||
name = roomNotificationMode.name,
|
||||
lastMessage = "New messages, mentions" + if (hasCall) ", call" else "",
|
||||
notificationMode = roomNotificationMode,
|
||||
numUnreadMessages = 1,
|
||||
numUnreadMentions = 1,
|
||||
numberOfUnreadMessages = 1,
|
||||
numberOfUnreadMentions = 1,
|
||||
hasOngoingCall = hasCall,
|
||||
),
|
||||
aRoomListRoomSummary(
|
||||
name = roomNotificationMode.name,
|
||||
lastMessage = "New mentions" + if (hasCall) ", call" else "",
|
||||
notificationMode = roomNotificationMode,
|
||||
numUnreadMessages = 0,
|
||||
numUnreadMentions = 1,
|
||||
numberOfUnreadMessages = 0,
|
||||
numberOfUnreadMentions = 1,
|
||||
hasOngoingCall = hasCall,
|
||||
),
|
||||
)
|
||||
|
|
@ -86,8 +86,8 @@ open class RoomListRoomSummaryProvider : PreviewParameterProvider<RoomListRoomSu
|
|||
fun aRoomListRoomSummary(
|
||||
lastMessage: String? = null,
|
||||
notificationMode: RoomNotificationMode? = null,
|
||||
numUnreadMessages: Int = 0,
|
||||
numUnreadMentions: Int = 0,
|
||||
numberOfUnreadMessages: Int = 0,
|
||||
numberOfUnreadMentions: Int = 0,
|
||||
timestamp: String? = "88:88",
|
||||
hasOngoingCall: Boolean = false,
|
||||
isPlaceholder: Boolean = false,
|
||||
|
|
@ -96,8 +96,8 @@ fun aRoomListRoomSummary(
|
|||
id = "!roomId",
|
||||
roomId = RoomId("!roomId:domain"),
|
||||
name = name,
|
||||
numUnreadMessages = numUnreadMessages,
|
||||
numUnreadMentions = numUnreadMentions,
|
||||
numberOfUnreadMessages = numberOfUnreadMessages,
|
||||
numberOfUnreadMentions = numberOfUnreadMentions,
|
||||
timestamp = timestamp,
|
||||
lastMessage = lastMessage,
|
||||
avatarData = AvatarData("!roomId", "Room name", size = AvatarSize.RoomListItem),
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ private val aRoomListRoomSummary = RoomListRoomSummary(
|
|||
id = A_ROOM_ID.value,
|
||||
roomId = A_ROOM_ID,
|
||||
name = A_ROOM_NAME,
|
||||
numUnreadMessages = 1,
|
||||
numberOfUnreadMessages = 1,
|
||||
timestamp = A_FORMATTED_DATE,
|
||||
lastMessage = "",
|
||||
avatarData = AvatarData(id = A_ROOM_ID.value, name = A_ROOM_NAME, size = AvatarSize.RoomListItem),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue