Remove RoomSummaryDetails.lastMessageTimestamp and replace by a getter on lastMessage
This commit is contained in:
parent
0e57fbf352
commit
371aec4427
8 changed files with 3 additions and 16 deletions
|
|
@ -431,7 +431,6 @@ class InviteListPresenterTests {
|
||||||
avatarUrl = null,
|
avatarUrl = null,
|
||||||
isDirect = false,
|
isDirect = false,
|
||||||
lastMessage = null,
|
lastMessage = null,
|
||||||
lastMessageTimestamp = null,
|
|
||||||
unreadNotificationCount = 0,
|
unreadNotificationCount = 0,
|
||||||
inviter = RoomMember(
|
inviter = RoomMember(
|
||||||
userId = A_USER_ID,
|
userId = A_USER_ID,
|
||||||
|
|
@ -460,7 +459,6 @@ class InviteListPresenterTests {
|
||||||
avatarUrl = null,
|
avatarUrl = null,
|
||||||
isDirect = true,
|
isDirect = true,
|
||||||
lastMessage = null,
|
lastMessage = null,
|
||||||
lastMessageTimestamp = null,
|
|
||||||
unreadNotificationCount = 0,
|
unreadNotificationCount = 0,
|
||||||
inviter = RoomMember(
|
inviter = RoomMember(
|
||||||
userId = A_USER_ID,
|
userId = A_USER_ID,
|
||||||
|
|
@ -486,7 +484,6 @@ class InviteListPresenterTests {
|
||||||
avatarUrl = null,
|
avatarUrl = null,
|
||||||
isDirect = false,
|
isDirect = false,
|
||||||
lastMessage = null,
|
lastMessage = null,
|
||||||
lastMessageTimestamp = null,
|
|
||||||
unreadNotificationCount = 0,
|
unreadNotificationCount = 0,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ fun aRoomDetailsState(
|
||||||
isDirect: Boolean = true,
|
isDirect: Boolean = true,
|
||||||
avatarUrl: String? = null,
|
avatarUrl: String? = null,
|
||||||
lastMessage: RoomMessage? = null,
|
lastMessage: RoomMessage? = null,
|
||||||
lastMessageTimestamp: Long? = null,
|
|
||||||
unreadNotificationCount: Int = 0,
|
unreadNotificationCount: Int = 0,
|
||||||
inviter: RoomMember? = null,
|
inviter: RoomMember? = null,
|
||||||
) = RoomSummaryDetails(
|
) = RoomSummaryDetails(
|
||||||
|
|
@ -74,7 +73,6 @@ fun aRoomDetailsState(
|
||||||
isDirect = isDirect,
|
isDirect = isDirect,
|
||||||
avatarUrl = avatarUrl,
|
avatarUrl = avatarUrl,
|
||||||
lastMessage = lastMessage,
|
lastMessage = lastMessage,
|
||||||
lastMessageTimestamp = lastMessageTimestamp,
|
|
||||||
unreadNotificationCount = unreadNotificationCount,
|
unreadNotificationCount = unreadNotificationCount,
|
||||||
inviter = inviter,
|
inviter = inviter,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,6 @@ private fun aRoomSummary() = RoomSummary.Filled(
|
||||||
avatarUrl = null,
|
avatarUrl = null,
|
||||||
isDirect = false,
|
isDirect = false,
|
||||||
lastMessage = null,
|
lastMessage = null,
|
||||||
lastMessageTimestamp = null,
|
|
||||||
unreadNotificationCount = 0,
|
unreadNotificationCount = 0,
|
||||||
notificationMode = RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY,
|
notificationMode = RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,11 @@ data class RoomSummaryDetails(
|
||||||
val isDirect: Boolean,
|
val isDirect: Boolean,
|
||||||
val avatarUrl: String?,
|
val avatarUrl: String?,
|
||||||
val lastMessage: RoomMessage?,
|
val lastMessage: RoomMessage?,
|
||||||
val lastMessageTimestamp: Long?,
|
|
||||||
val unreadNotificationCount: Int,
|
val unreadNotificationCount: Int,
|
||||||
val inviter: RoomMember? = null,
|
val inviter: RoomMember? = null,
|
||||||
val notificationMode: RoomNotificationMode? = null,
|
val notificationMode: RoomNotificationMode? = null,
|
||||||
val hasOngoingCall: Boolean = false,
|
val hasOngoingCall: Boolean = false,
|
||||||
val isDm: Boolean = false,
|
val isDm: Boolean = false,
|
||||||
)
|
) {
|
||||||
|
val lastMessageTimestamp = lastMessage?.originServerTs
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFacto
|
||||||
avatarUrl = roomInfo.avatarUrl,
|
avatarUrl = roomInfo.avatarUrl,
|
||||||
unreadNotificationCount = roomInfo.notificationCount.toInt(),
|
unreadNotificationCount = roomInfo.notificationCount.toInt(),
|
||||||
lastMessage = latestRoomMessage,
|
lastMessage = latestRoomMessage,
|
||||||
lastMessageTimestamp = latestRoomMessage?.originServerTs,
|
|
||||||
inviter = roomInfo.inviter?.let(RoomMemberMapper::map),
|
inviter = roomInfo.inviter?.let(RoomMemberMapper::map),
|
||||||
notificationMode = roomInfo.userDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
notificationMode = roomInfo.userDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
||||||
hasOngoingCall = roomInfo.hasRoomCall,
|
hasOngoingCall = roomInfo.hasRoomCall,
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ fun aRoomSummaryFilled(
|
||||||
isDirect: Boolean = false,
|
isDirect: Boolean = false,
|
||||||
avatarUrl: String? = null,
|
avatarUrl: String? = null,
|
||||||
lastMessage: RoomMessage? = aRoomMessage(),
|
lastMessage: RoomMessage? = aRoomMessage(),
|
||||||
lastMessageTimestamp: Long? = null,
|
|
||||||
unreadNotificationCount: Int = 2,
|
unreadNotificationCount: Int = 2,
|
||||||
notificationMode: RoomNotificationMode? = null,
|
notificationMode: RoomNotificationMode? = null,
|
||||||
) = RoomSummary.Filled(
|
) = RoomSummary.Filled(
|
||||||
|
|
@ -46,7 +45,6 @@ fun aRoomSummaryFilled(
|
||||||
isDirect = isDirect,
|
isDirect = isDirect,
|
||||||
avatarUrl = avatarUrl,
|
avatarUrl = avatarUrl,
|
||||||
lastMessage = lastMessage,
|
lastMessage = lastMessage,
|
||||||
lastMessageTimestamp = lastMessageTimestamp,
|
|
||||||
unreadNotificationCount = unreadNotificationCount,
|
unreadNotificationCount = unreadNotificationCount,
|
||||||
notificationMode = notificationMode,
|
notificationMode = notificationMode,
|
||||||
)
|
)
|
||||||
|
|
@ -58,7 +56,6 @@ fun aRoomSummaryDetails(
|
||||||
isDirect: Boolean = false,
|
isDirect: Boolean = false,
|
||||||
avatarUrl: String? = null,
|
avatarUrl: String? = null,
|
||||||
lastMessage: RoomMessage? = aRoomMessage(),
|
lastMessage: RoomMessage? = aRoomMessage(),
|
||||||
lastMessageTimestamp: Long? = null,
|
|
||||||
unreadNotificationCount: Int = 2,
|
unreadNotificationCount: Int = 2,
|
||||||
notificationMode: RoomNotificationMode? = null,
|
notificationMode: RoomNotificationMode? = null,
|
||||||
) = RoomSummaryDetails(
|
) = RoomSummaryDetails(
|
||||||
|
|
@ -67,7 +64,6 @@ fun aRoomSummaryDetails(
|
||||||
isDirect = isDirect,
|
isDirect = isDirect,
|
||||||
avatarUrl = avatarUrl,
|
avatarUrl = avatarUrl,
|
||||||
lastMessage = lastMessage,
|
lastMessage = lastMessage,
|
||||||
lastMessageTimestamp = lastMessageTimestamp,
|
|
||||||
unreadNotificationCount = unreadNotificationCount,
|
unreadNotificationCount = unreadNotificationCount,
|
||||||
notificationMode = notificationMode
|
notificationMode = notificationMode
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,6 @@ internal fun SelectedRoomPreview() = ElementPreview {
|
||||||
isDirect = true,
|
isDirect = true,
|
||||||
avatarUrl = null,
|
avatarUrl = null,
|
||||||
lastMessage = null,
|
lastMessage = null,
|
||||||
lastMessageTimestamp = null,
|
|
||||||
unreadNotificationCount = 0,
|
unreadNotificationCount = 0,
|
||||||
inviter = null,
|
inviter = null,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,6 @@ private fun aRoomDetailsState(
|
||||||
isDirect: Boolean = true,
|
isDirect: Boolean = true,
|
||||||
avatarUrl: String? = null,
|
avatarUrl: String? = null,
|
||||||
lastMessage: RoomMessage? = null,
|
lastMessage: RoomMessage? = null,
|
||||||
lastMessageTimestamp: Long? = null,
|
|
||||||
unreadNotificationCount: Int = 0,
|
unreadNotificationCount: Int = 0,
|
||||||
inviter: RoomMember? = null,
|
inviter: RoomMember? = null,
|
||||||
) = RoomSummaryDetails(
|
) = RoomSummaryDetails(
|
||||||
|
|
@ -87,7 +86,6 @@ private fun aRoomDetailsState(
|
||||||
isDirect = isDirect,
|
isDirect = isDirect,
|
||||||
avatarUrl = avatarUrl,
|
avatarUrl = avatarUrl,
|
||||||
lastMessage = lastMessage,
|
lastMessage = lastMessage,
|
||||||
lastMessageTimestamp = lastMessageTimestamp,
|
|
||||||
unreadNotificationCount = unreadNotificationCount,
|
unreadNotificationCount = unreadNotificationCount,
|
||||||
inviter = inviter,
|
inviter = inviter,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue