change (room avatar) : expose isTombstone where we need to display the RoomAvatar
This commit is contained in:
@@ -59,4 +59,6 @@ data class MessagesState(
|
||||
val roomMemberModerationState: RoomMemberModerationState,
|
||||
val successorRoom: SuccessorRoom?,
|
||||
val eventSink: (MessagesEvents) -> Unit
|
||||
)
|
||||
){
|
||||
val isTombstoned = successorRoom != null
|
||||
}
|
||||
|
||||
@@ -210,6 +210,7 @@ class RoomDetailsPresenter @Inject constructor(
|
||||
canShowSecurityAndPrivacy = canShowSecurityAndPrivacy,
|
||||
hasMemberVerificationViolations = hasMemberVerificationViolations,
|
||||
canReportRoom = canReportRoom,
|
||||
isTombstoned = roomInfo.successorRoom != null,
|
||||
eventSink = ::handleEvents,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ data class RoomDetailsState(
|
||||
val canShowSecurityAndPrivacy: Boolean,
|
||||
val hasMemberVerificationViolations: Boolean,
|
||||
val canReportRoom: Boolean,
|
||||
val isTombstoned: Boolean,
|
||||
val eventSink: (RoomDetailsEvent) -> Unit
|
||||
) {
|
||||
val roomBadges = buildList {
|
||||
|
||||
@@ -53,6 +53,7 @@ open class RoomDetailsStateProvider : PreviewParameterProvider<RoomDetailsState>
|
||||
aRoomDetailsState(knockRequestsCount = null, canShowKnockRequests = true),
|
||||
aRoomDetailsState(knockRequestsCount = 4, canShowKnockRequests = true),
|
||||
aRoomDetailsState(hasMemberVerificationViolations = true),
|
||||
aRoomDetailsState(isTombstoned = true),
|
||||
aDmRoomDetailsState(dmRoomMemberVerificationState = UserProfileVerificationState.VERIFIED),
|
||||
aDmRoomDetailsState(dmRoomMemberVerificationState = UserProfileVerificationState.VERIFICATION_VIOLATION),
|
||||
// Add other state here
|
||||
@@ -118,6 +119,7 @@ fun aRoomDetailsState(
|
||||
canShowSecurityAndPrivacy: Boolean = true,
|
||||
hasMemberVerificationViolations: Boolean = false,
|
||||
canReportRoom: Boolean = true,
|
||||
isTombstoned: Boolean = false,
|
||||
eventSink: (RoomDetailsEvent) -> Unit = {},
|
||||
) = RoomDetailsState(
|
||||
roomId = roomId,
|
||||
@@ -148,6 +150,7 @@ fun aRoomDetailsState(
|
||||
canShowSecurityAndPrivacy = canShowSecurityAndPrivacy,
|
||||
hasMemberVerificationViolations = hasMemberVerificationViolations,
|
||||
canReportRoom = canReportRoom,
|
||||
isTombstoned = isTombstoned,
|
||||
eventSink = eventSink,
|
||||
)
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ class RoomListRoomSummaryFactory @Inject constructor(
|
||||
heroes = roomInfo.heroes.map { user ->
|
||||
user.getAvatarData(size = AvatarSize.RoomListItem)
|
||||
}.toImmutableList(),
|
||||
isTombstoned = roomInfo.successorRoom != null,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ data class RoomListRoomSummary(
|
||||
val isDm: Boolean,
|
||||
val isFavorite: Boolean,
|
||||
val inviteSender: InviteSender?,
|
||||
val isTombstoned: Boolean,
|
||||
val heroes: ImmutableList<AvatarData>,
|
||||
) {
|
||||
val isHighlighted = userDefinedNotificationMode != RoomNotificationMode.MUTE &&
|
||||
|
||||
@@ -110,6 +110,11 @@ open class RoomListRoomSummaryProvider : PreviewParameterProvider<RoomListRoomSu
|
||||
name = "A knocked room with alias",
|
||||
canonicalAlias = RoomAlias("#knockable:matrix.org"),
|
||||
displayType = RoomSummaryDisplayType.KNOCKED,
|
||||
),
|
||||
aRoomListRoomSummary(
|
||||
name = "A tombstoned room",
|
||||
displayType = RoomSummaryDisplayType.ROOM,
|
||||
isTombstoned = true,
|
||||
)
|
||||
),
|
||||
).flatten()
|
||||
@@ -145,6 +150,7 @@ internal fun aRoomListRoomSummary(
|
||||
displayType: RoomSummaryDisplayType = RoomSummaryDisplayType.ROOM,
|
||||
canonicalAlias: RoomAlias? = null,
|
||||
heroes: List<AvatarData> = emptyList(),
|
||||
isTombstoned: Boolean = false,
|
||||
) = RoomListRoomSummary(
|
||||
id = id,
|
||||
roomId = RoomId(id),
|
||||
@@ -165,4 +171,5 @@ internal fun aRoomListRoomSummary(
|
||||
displayType = displayType,
|
||||
canonicalAlias = canonicalAlias,
|
||||
heroes = heroes.toImmutableList(),
|
||||
isTombstoned = isTombstoned,
|
||||
)
|
||||
|
||||
@@ -84,6 +84,7 @@ internal fun createRoomListRoomSummary(
|
||||
displayType: RoomSummaryDisplayType = RoomSummaryDisplayType.ROOM,
|
||||
heroes: List<AvatarData> = emptyList(),
|
||||
timestamp: String? = null,
|
||||
isTombstoned: Boolean = false,
|
||||
) = RoomListRoomSummary(
|
||||
id = A_ROOM_ID.value,
|
||||
roomId = A_ROOM_ID,
|
||||
@@ -104,4 +105,5 @@ internal fun createRoomListRoomSummary(
|
||||
inviteSender = null,
|
||||
isDm = false,
|
||||
heroes = heroes.toPersistentList(),
|
||||
isTombstoned = isTombstoned,
|
||||
)
|
||||
|
||||
@@ -30,10 +30,12 @@ fun aSelectRoomInfo(
|
||||
canonicalAlias: RoomAlias? = null,
|
||||
avatarUrl: String? = null,
|
||||
heroes: ImmutableList<MatrixUser> = persistentListOf(),
|
||||
isTombstoned: Boolean = false,
|
||||
) = SelectRoomInfo(
|
||||
roomId = roomId,
|
||||
name = name,
|
||||
canonicalAlias = canonicalAlias,
|
||||
avatarUrl = avatarUrl,
|
||||
heroes = heroes,
|
||||
isTombstoned = isTombstoned,
|
||||
)
|
||||
|
||||
@@ -21,6 +21,7 @@ data class SelectRoomInfo(
|
||||
val canonicalAlias: RoomAlias?,
|
||||
val avatarUrl: String?,
|
||||
val heroes: ImmutableList<MatrixUser>,
|
||||
val isTombstoned: Boolean,
|
||||
) {
|
||||
fun getAvatarData(size: AvatarSize) = AvatarData(
|
||||
id = roomId.value,
|
||||
@@ -36,4 +37,5 @@ fun RoomSummary.toSelectRoomInfo() = SelectRoomInfo(
|
||||
avatarUrl = info.avatarUrl,
|
||||
heroes = info.heroes,
|
||||
canonicalAlias = info.canonicalAlias,
|
||||
isTombstoned = info.successorRoom != null,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user