Room join : add presenter tests
This commit is contained in:
parent
fbb92f0c9a
commit
ab8c31541b
10 changed files with 410 additions and 88 deletions
|
|
@ -70,7 +70,7 @@ fun aRoomDescriptionList(): ImmutableList<RoomDescription> {
|
|||
name = "Element X Android",
|
||||
description = "Element X is a secure, private and decentralized messenger.",
|
||||
avatarUrl = null,
|
||||
canBeJoined = true,
|
||||
joinRule = RoomDescription.JoinRule.PUBLIC,
|
||||
numberOfMembers = 2765,
|
||||
),
|
||||
RoomDescription(
|
||||
|
|
@ -78,7 +78,7 @@ fun aRoomDescriptionList(): ImmutableList<RoomDescription> {
|
|||
name = "Element X iOS",
|
||||
description = "Element X is a secure, private and decentralized messenger.",
|
||||
avatarUrl = null,
|
||||
canBeJoined = false,
|
||||
joinRule = RoomDescription.JoinRule.UNKNOWN,
|
||||
numberOfMembers = 356,
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ private fun RoomDirectoryRoomRow(
|
|||
Row(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.clickable(enabled = roomDescription.canBeJoined, onClick = onClick)
|
||||
.clickable(onClick = onClick)
|
||||
.padding(
|
||||
top = 12.dp,
|
||||
bottom = 12.dp,
|
||||
|
|
@ -306,7 +306,7 @@ private fun RoomDirectoryRoomRow(
|
|||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
if (roomDescription.canBeJoined) {
|
||||
if (roomDescription.canBeJoined()) {
|
||||
Text(
|
||||
text = stringResource(id = CommonStrings.action_join),
|
||||
color = ElementTheme.colors.textSuccessPrimary,
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ fun MatrixRoomDescription.toFeatureModel(): RoomDescription {
|
|||
description = description(),
|
||||
avatarUrl = avatarUrl,
|
||||
numberOfMembers = numberOfMembers,
|
||||
canBeJoined = joinRule == MatrixRoomDescription.JoinRule.PUBLIC,
|
||||
joinRule = when (joinRule) {
|
||||
MatrixRoomDescription.JoinRule.PUBLIC -> RoomDescription.JoinRule.PUBLIC
|
||||
MatrixRoomDescription.JoinRule.KNOCK -> RoomDescription.JoinRule.KNOCK
|
||||
MatrixRoomDescription.JoinRule.UNKNOWN -> RoomDescription.JoinRule.UNKNOWN
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue