Use new Rust fields numUnreadMessages and numUnreadMentions, and iterate on the room badge rendering.

This commit is contained in:
Benoit Marty 2024-01-19 17:48:26 +01:00 committed by Benoit Marty
parent bee56c83ae
commit dd12071ea2
12 changed files with 159 additions and 62 deletions

View file

@ -40,7 +40,8 @@ data class RoomSummaryDetails(
val isDirect: Boolean,
val avatarUrl: String?,
val lastMessage: RoomMessage?,
val unreadNotificationCount: Int,
val numUnreadMessages: Int,
val numUnreadMentions: Int,
val inviter: RoomMember?,
val userDefinedNotificationMode: RoomNotificationMode?,
val hasRoomCall: Boolean,

View file

@ -35,7 +35,8 @@ class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFacto
canonicalAlias = roomInfo.canonicalAlias,
isDirect = roomInfo.isDirect,
avatarUrl = roomInfo.avatarUrl,
unreadNotificationCount = roomInfo.notificationCount.toInt(),
numUnreadMentions = roomInfo.numUnreadMentions.toInt(),
numUnreadMessages = roomInfo.numUnreadMessages.toInt(),
lastMessage = latestRoomMessage,
inviter = roomInfo.inviter?.let(RoomMemberMapper::map),
userDefinedNotificationMode = roomInfo.userDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),

View file

@ -37,7 +37,8 @@ fun aRoomSummaryFilled(
isDirect: Boolean = false,
avatarUrl: String? = null,
lastMessage: RoomMessage? = aRoomMessage(),
unreadNotificationCount: Int = 2,
numUnreadMentions: Int = 1,
numUnreadMessages: Int = 2,
notificationMode: RoomNotificationMode? = null,
) = RoomSummary.Filled(
aRoomSummaryDetails(
@ -46,7 +47,8 @@ fun aRoomSummaryFilled(
isDirect = isDirect,
avatarUrl = avatarUrl,
lastMessage = lastMessage,
unreadNotificationCount = unreadNotificationCount,
numUnreadMentions = numUnreadMentions,
numUnreadMessages = numUnreadMessages,
notificationMode = notificationMode,
)
)
@ -57,7 +59,8 @@ fun aRoomSummaryDetails(
isDirect: Boolean = false,
avatarUrl: String? = null,
lastMessage: RoomMessage? = aRoomMessage(),
unreadNotificationCount: Int = 2,
numUnreadMentions: Int = 0,
numUnreadMessages: Int = 0,
notificationMode: RoomNotificationMode? = null,
inviter: RoomMember? = null,
canonicalAlias: String? = null,
@ -69,7 +72,8 @@ fun aRoomSummaryDetails(
isDirect = isDirect,
avatarUrl = avatarUrl,
lastMessage = lastMessage,
unreadNotificationCount = unreadNotificationCount,
numUnreadMentions = numUnreadMentions,
numUnreadMessages = numUnreadMessages,
userDefinedNotificationMode = notificationMode,
inviter = inviter,
canonicalAlias = canonicalAlias,

View file

@ -113,7 +113,8 @@ fun aRoomSummaryDetails(
notificationMode: RoomNotificationMode? = null,
hasRoomCall: Boolean = false,
isDm: Boolean = false,
unreadNotificationCount: Int = 0
numUnreadMentions: Int = 0,
numUnreadMessages: Int = 0,
) = RoomSummaryDetails(
roomId = roomId,
name = name,
@ -125,5 +126,6 @@ fun aRoomSummaryDetails(
userDefinedNotificationMode = notificationMode,
hasRoomCall = hasRoomCall,
isDm = isDm,
unreadNotificationCount = unreadNotificationCount,
numUnreadMentions = numUnreadMentions,
numUnreadMessages = numUnreadMessages,
)