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