@@ -25,18 +25,17 @@ import io.element.android.libraries.architecture.Presenter
25
25
import io.element.android.libraries.architecture.runUpdatingState
26
26
import io.element.android.libraries.matrix.api.MatrixClient
27
27
import io.element.android.libraries.matrix.api.core.RoomId
28
- import io.element.android.libraries.previewutils.room.aSpaceRoom
28
+ import io.element.android.libraries.matrix.api.spaces.SpaceRoom
29
29
import kotlinx.collections.immutable.ImmutableList
30
30
import kotlinx.collections.immutable.toPersistentList
31
31
import kotlinx.coroutines.CoroutineScope
32
- import kotlinx.coroutines.delay
33
32
import kotlinx.coroutines.launch
34
33
import kotlin.jvm.optionals.getOrNull
35
34
36
35
@Inject
37
36
class LeaveSpacePresenter (
38
37
@Assisted private val inputs : SpaceEntryPoint .Inputs ,
39
- private val matrixClient : MatrixClient ,
38
+ matrixClient : MatrixClient ,
40
39
) : Presenter<LeaveSpaceState> {
41
40
@AssistedFactory
42
41
fun interface Factory {
@@ -57,14 +56,7 @@ class LeaveSpacePresenter(
57
56
}
58
57
val joinedSpaceRooms by produceState(emptyList()) {
59
58
// TODO Get the joined room from the SDK, should also have the
60
- val rooms = listOf (
61
- aSpaceRoom(
62
- roomId = RoomId (" !roomId1:example.com" ),
63
- ),
64
- aSpaceRoom(
65
- roomId = RoomId (" !roomId2:example.com" ),
66
- ),
67
- )
59
+ val rooms = emptyList<SpaceRoom >()
68
60
// By default select all rooms
69
61
selectedRoomIds.value = rooms.map { it.roomId }.toSet()
70
62
value = rooms
@@ -77,10 +69,10 @@ class LeaveSpacePresenter(
77
69
value = AsyncData .Success (
78
70
joinedSpaceRooms.map {
79
71
SelectableSpaceRoom (
80
- it,
72
+ spaceRoom = it,
81
73
// TODO Get this value from the SDK
82
74
isLastAdmin = false ,
83
- selectedRoomIds.value.contains(it.roomId),
75
+ isSelected = selectedRoomIds.value.contains(it.roomId),
84
76
)
85
77
}.toPersistentList()
86
78
)
@@ -130,10 +122,7 @@ class LeaveSpacePresenter(
130
122
) = launch {
131
123
runUpdatingState(leaveSpaceAction) {
132
124
// TODO SDK API call to leave all the rooms and space
133
- delay(1000 )
134
- val room = matrixClient.getRoom(inputs.roomId)
135
- ? : return @runUpdatingState Result .failure(Exception (" Room not found" ))
136
- room.leave()
125
+ Result .failure(Exception (" Not implemented" ))
137
126
}
138
127
}
139
128
}
0 commit comments