mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Space Settings: Leave Room (#4700)
* Implementation for all navigations inside the space settings aside the left space action # Conflicts: # ElementX/Sources/FlowCoordinators/SpaceSettingsFlowCoordinator.swift * refactored the leave space view to use its own view model # Conflicts: # ElementX.xcodeproj/project.pbxproj * implemented the leave space view model also in the settings screen, and corrected some tests * reusing the details coordinator for the space settings screen * leave space from settings implemented * fix project * minor pr fixes * code improvements
This commit is contained in:
@@ -209,10 +209,29 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
|
||||
private func processLeaveSpace() async {
|
||||
switch await userSession.clientProxy.spaceService.leaveSpace(spaceID: roomProxy.id) {
|
||||
case .success:
|
||||
// TODO: Handle leave space
|
||||
break
|
||||
case .failure(let failure):
|
||||
case .success(let leaveHandle):
|
||||
let leaveSpaceViewModel = LeaveSpaceViewModel(spaceName: state.details.name ?? state.details.id,
|
||||
canEditRolesAndPermissions: state.canEditRolesOrPermissions,
|
||||
leaveHandle: leaveHandle,
|
||||
userIndicatorController: userIndicatorController,
|
||||
mediaProvider: userSession.mediaProvider)
|
||||
leaveSpaceViewModel.actions.sink { [weak self] action in
|
||||
guard let self else { return }
|
||||
switch action {
|
||||
case .didCancel:
|
||||
state.bindings.leaveSpaceViewModel = nil
|
||||
case .presentRolesAndPermissions:
|
||||
state.bindings.leaveSpaceViewModel = nil
|
||||
actionsSubject.send(.requestRolesAndPermissionsPresentation)
|
||||
case .didLeaveSpace:
|
||||
state.bindings.leaveSpaceViewModel = nil
|
||||
actionsSubject.send(.leftRoom)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
state.bindings.leaveSpaceViewModel = leaveSpaceViewModel
|
||||
case .failure:
|
||||
userIndicatorController.submitIndicator(.init(title: L10n.errorUnknown))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user