Add manage mode to space view for removing child rooms, wip.

This commit is contained in:
ganfra 2026-01-13 22:08:48 +01:00
parent 9b2cd12c26
commit b7ff884838
11 changed files with 263 additions and 21 deletions

View file

@ -18,4 +18,12 @@ interface SpaceService {
fun spaceRoomList(id: RoomId): SpaceRoomList
fun getLeaveSpaceHandle(spaceId: RoomId): LeaveSpaceHandle
/**
* Remove a child room from a space.
* @param spaceId The space ID from which to remove the child.
* @param childId The room ID of the child to remove.
* @return A result indicating success or failure.
*/
suspend fun removeChildFromSpace(spaceId: RoomId, childId: RoomId): Result<Unit>
}

View file

@ -79,6 +79,12 @@ class RustSpaceService(
}
}
override suspend fun removeChildFromSpace(spaceId: RoomId, childId: RoomId): Result<Unit> = withContext(sessionDispatcher) {
runCatchingExceptions {
innerSpaceService.removeChildFromSpace(spaceId.value, childId.value)
}
}
init {
innerSpaceService
.spaceListUpdate()

View file

@ -23,6 +23,7 @@ class FakeSpaceService(
private val joinedSpacesResult: () -> Result<List<SpaceRoom>> = { lambdaError() },
private val spaceRoomListResult: (RoomId) -> SpaceRoomList = { lambdaError() },
private val leaveSpaceHandleResult: (RoomId) -> LeaveSpaceHandle = { lambdaError() },
private val removeChildFromSpaceResult: (RoomId, RoomId) -> Result<Unit> = { _, _ -> lambdaError() },
) : SpaceService {
private val _spaceRoomsFlow = MutableSharedFlow<List<SpaceRoom>>()
override val spaceRoomsFlow: SharedFlow<List<SpaceRoom>>
@ -43,4 +44,8 @@ class FakeSpaceService(
override fun getLeaveSpaceHandle(spaceId: RoomId): LeaveSpaceHandle {
return leaveSpaceHandleResult(spaceId)
}
override suspend fun removeChildFromSpace(spaceId: RoomId, childId: RoomId): Result<Unit> = simulateLongTask {
removeChildFromSpaceResult(spaceId, childId)
}
}

View file

@ -112,6 +112,7 @@
<string name="action_load_more">"Load more"</string>
<string name="action_manage_account">"Manage account"</string>
<string name="action_manage_devices">"Manage devices"</string>
<string name="action_manage_rooms">"Manage rooms"</string>
<string name="action_message">"Message"</string>
<string name="action_minimize">"Minimise"</string>
<string name="action_next">"Next"</string>