mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-05 22:00:08 +00:00
Always render either "Not encrypted" or "Encrypted" badge in the room detail screen.
This commit is contained in:
+4
-6
@@ -48,12 +48,10 @@ data class RoomDetailsState(
|
|||||||
val eventSink: (RoomDetailsEvent) -> Unit
|
val eventSink: (RoomDetailsEvent) -> Unit
|
||||||
) {
|
) {
|
||||||
val roomBadges = buildList {
|
val roomBadges = buildList {
|
||||||
if (isEncrypted || isPublic) {
|
if (isEncrypted) {
|
||||||
if (isEncrypted) {
|
add(RoomBadge.ENCRYPTED)
|
||||||
add(RoomBadge.ENCRYPTED)
|
} else {
|
||||||
} else {
|
add(RoomBadge.NOT_ENCRYPTED)
|
||||||
add(RoomBadge.NOT_ENCRYPTED)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (isPublic) {
|
if (isPublic) {
|
||||||
add(RoomBadge.PUBLIC)
|
add(RoomBadge.PUBLIC)
|
||||||
|
|||||||
+4
-2
@@ -13,12 +13,14 @@ import org.junit.Test
|
|||||||
|
|
||||||
class RoomDetailsStateTest {
|
class RoomDetailsStateTest {
|
||||||
@Test
|
@Test
|
||||||
fun `room not public not encrypted should have no badges`() {
|
fun `room not public not encrypted should have not encrypted badge`() {
|
||||||
val sut = aRoomDetailsState(
|
val sut = aRoomDetailsState(
|
||||||
isPublic = false,
|
isPublic = false,
|
||||||
isEncrypted = false,
|
isEncrypted = false,
|
||||||
)
|
)
|
||||||
assertThat(sut.roomBadges).isEmpty()
|
assertThat(sut.roomBadges).isEqualTo(
|
||||||
|
persistentListOf(RoomBadge.NOT_ENCRYPTED)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user