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:
Mauro
2025-11-07 12:11:21 +01:00
committed by GitHub
parent 8974a4584a
commit 096e2d1713
22 changed files with 407 additions and 277 deletions
@@ -0,0 +1,48 @@
//
// Copyright 2025 Element Creations Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
enum LeaveSpaceViewAction {
case confirmLeaveSpace
case deselectAll
case selectAll
case toggleRoom(roomID: String)
case rolesAndPermissions
case cancel
}
struct LeaveSpaceViewState: BindableState {
let spaceName: String
let canEditRolesAndPermissions: Bool
let leaveHandle: LeaveSpaceHandleProxy
var title: String {
switch leaveHandle.mode {
case .lastSpaceAdmin: L10n.screenLeaveSpaceTitleLastAdmin(spaceName)
default: L10n.screenLeaveSpaceTitle(spaceName)
}
}
var subtitle: String? {
switch leaveHandle.mode {
case .manyRooms: L10n.screenLeaveSpaceSubtitle
case .onlyAdminRooms: L10n.screenLeaveSpaceSubtitleOnlyLastAdmin
case .noRooms: nil
case .lastSpaceAdmin: L10n.screenLeaveSpaceSubtitleLastAdmin
}
}
var confirmationTitle: String {
let selectedCount = leaveHandle.selectedCount
return selectedCount > 0 ? L10n.screenLeaveSpaceSubmit(selectedCount) : L10n.actionLeaveSpace
}
}
enum LeaveSpaceViewModelAction {
case didLeaveSpace
case presentRolesAndPermissions
case didCancel
}