Skip to content

Commit c1678b5

Browse files
committed
Cleanup to be able to merge.
1 parent b4232a8 commit c1678b5

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

features/space/impl/src/main/kotlin/io/element/android/features/space/impl/leave/LeaveSpacePresenter.kt

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,17 @@ import io.element.android.libraries.architecture.Presenter
2525
import io.element.android.libraries.architecture.runUpdatingState
2626
import io.element.android.libraries.matrix.api.MatrixClient
2727
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
2929
import kotlinx.collections.immutable.ImmutableList
3030
import kotlinx.collections.immutable.toPersistentList
3131
import kotlinx.coroutines.CoroutineScope
32-
import kotlinx.coroutines.delay
3332
import kotlinx.coroutines.launch
3433
import kotlin.jvm.optionals.getOrNull
3534

3635
@Inject
3736
class LeaveSpacePresenter(
3837
@Assisted private val inputs: SpaceEntryPoint.Inputs,
39-
private val matrixClient: MatrixClient,
38+
matrixClient: MatrixClient,
4039
) : Presenter<LeaveSpaceState> {
4140
@AssistedFactory
4241
fun interface Factory {
@@ -57,14 +56,7 @@ class LeaveSpacePresenter(
5756
}
5857
val joinedSpaceRooms by produceState(emptyList()) {
5958
// 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>()
6860
// By default select all rooms
6961
selectedRoomIds.value = rooms.map { it.roomId }.toSet()
7062
value = rooms
@@ -77,10 +69,10 @@ class LeaveSpacePresenter(
7769
value = AsyncData.Success(
7870
joinedSpaceRooms.map {
7971
SelectableSpaceRoom(
80-
it,
72+
spaceRoom = it,
8173
// TODO Get this value from the SDK
8274
isLastAdmin = false,
83-
selectedRoomIds.value.contains(it.roomId),
75+
isSelected = selectedRoomIds.value.contains(it.roomId),
8476
)
8577
}.toPersistentList()
8678
)
@@ -130,10 +122,7 @@ class LeaveSpacePresenter(
130122
) = launch {
131123
runUpdatingState(leaveSpaceAction) {
132124
// 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"))
137126
}
138127
}
139128
}

features/space/impl/src/main/kotlin/io/element/android/features/space/impl/root/SpaceView.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ private fun LoadingMoreIndicator(
157157
private fun SpaceViewTopBar(
158158
state: SpaceState,
159159
onBackClick: () -> Unit,
160-
onLeaveSpaceClick: () -> Unit,
160+
@Suppress("unused") onLeaveSpaceClick: () -> Unit,
161161
onShareSpace: () -> Unit,
162162
modifier: Modifier = Modifier,
163163
) {
@@ -203,6 +203,8 @@ private fun SpaceViewTopBar(
203203
)
204204
}
205205
)
206+
/*
207+
// TODO re-enable when we have SDK APIs to leave a space
206208
DropdownMenuItem(
207209
onClick = {
208210
showMenu = false
@@ -217,6 +219,7 @@ private fun SpaceViewTopBar(
217219
)
218220
}
219221
)
222+
*/
220223
}
221224
},
222225
)

0 commit comments

Comments
 (0)