File tree Expand file tree Collapse file tree 4 files changed +14
-6
lines changed
features/joinroom/impl/src/test/kotlin/io/element/android/features/joinroom/impl
api/src/main/kotlin/io/element/android/libraries/matrix/api/room/join
impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/join Expand file tree Collapse file tree 4 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ import io.element.android.tests.testutils.lambda.assert
58
58
import io.element.android.tests.testutils.lambda.lambdaRecorder
59
59
import io.element.android.tests.testutils.lambda.value
60
60
import io.element.android.tests.testutils.test
61
+ import kotlinx.collections.immutable.persistentListOf
61
62
import kotlinx.coroutines.flow.first
62
63
import kotlinx.coroutines.flow.flowOf
63
64
import kotlinx.coroutines.test.runTest
@@ -913,7 +914,7 @@ class JoinRoomPresenterTest {
913
914
val client = FakeMatrixClient (
914
915
getNotJoinedRoomResult = { _, _ ->
915
916
Result .success(
916
- aRoomPreview(info = aRoomPreviewInfo(joinRule = JoinRule .KnockRestricted (emptyList ())))
917
+ aRoomPreview(info = aRoomPreviewInfo(joinRule = JoinRule .KnockRestricted (persistentListOf ())))
917
918
)
918
919
}
919
920
)
@@ -933,7 +934,7 @@ class JoinRoomPresenterTest {
933
934
val client = FakeMatrixClient (
934
935
getNotJoinedRoomResult = { _, _ ->
935
936
Result .success(
936
- aRoomPreview(info = aRoomPreviewInfo(joinRule = JoinRule .Restricted (emptyList ())))
937
+ aRoomPreview(info = aRoomPreviewInfo(joinRule = JoinRule .Restricted (persistentListOf ())))
937
938
)
938
939
}
939
940
)
Original file line number Diff line number Diff line change 7
7
8
8
package io.element.android.libraries.matrix.api.room.join
9
9
10
+ import androidx.compose.runtime.Immutable
10
11
import io.element.android.libraries.matrix.api.core.RoomId
11
12
13
+ @Immutable
12
14
sealed interface AllowRule {
13
15
data class RoomMembership (val roomId : RoomId ) : AllowRule
14
16
data class Custom (val json : String ) : AllowRule
Original file line number Diff line number Diff line change 7
7
8
8
package io.element.android.libraries.matrix.api.room.join
9
9
10
+ import androidx.compose.runtime.Immutable
11
+ import kotlinx.collections.immutable.ImmutableList
12
+
13
+ @Immutable
10
14
sealed interface JoinRule {
11
15
data object Public : JoinRule
12
16
data object Private : JoinRule
13
17
data object Knock : JoinRule
14
18
data object Invite : JoinRule
15
- data class Restricted (val rules : List <AllowRule >) : JoinRule
16
- data class KnockRestricted (val rules : List <AllowRule >) : JoinRule
19
+ data class Restricted (val rules : ImmutableList <AllowRule >) : JoinRule
20
+ data class KnockRestricted (val rules : ImmutableList <AllowRule >) : JoinRule
17
21
data class Custom (val value : String ) : JoinRule
18
22
}
Original file line number Diff line number Diff line change 8
8
package io.element.android.libraries.matrix.impl.room.join
9
9
10
10
import io.element.android.libraries.matrix.api.room.join.JoinRule
11
+ import kotlinx.collections.immutable.toPersistentList
11
12
import org.matrix.rustcomponents.sdk.JoinRule as RustJoinRule
12
13
13
14
fun RustJoinRule.map (): JoinRule {
@@ -16,9 +17,9 @@ fun RustJoinRule.map(): JoinRule {
16
17
RustJoinRule .Private -> JoinRule .Private
17
18
RustJoinRule .Knock -> JoinRule .Knock
18
19
RustJoinRule .Invite -> JoinRule .Invite
19
- is RustJoinRule .Restricted -> JoinRule .Restricted (rules.map { it.map() })
20
+ is RustJoinRule .Restricted -> JoinRule .Restricted (rules.map { it.map() }.toPersistentList() )
20
21
is RustJoinRule .Custom -> JoinRule .Custom (repr)
21
- is RustJoinRule .KnockRestricted -> JoinRule .KnockRestricted (rules.map { it.map() })
22
+ is RustJoinRule .KnockRestricted -> JoinRule .KnockRestricted (rules.map { it.map() }.toPersistentList() )
22
23
}
23
24
}
24
25
You can’t perform that action at this time.
0 commit comments