mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +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:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user