mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 20:01:55 +00:00
change (room avatar) : expose isTombstone where we need to display the RoomAvatar
This commit is contained in:
+3
-1
@@ -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
|
||||||
|
}
|
||||||
|
|||||||
+1
@@ -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,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -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 {
|
||||||
|
|||||||
+3
@@ -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,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
@@ -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,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -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 &&
|
||||||
|
|||||||
+7
@@ -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,
|
||||||
)
|
)
|
||||||
|
|||||||
+2
@@ -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,
|
||||||
)
|
)
|
||||||
|
|||||||
+2
@@ -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,
|
||||||
)
|
)
|
||||||
|
|||||||
+2
@@ -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,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user