Files
letro-ios/ElementX/Sources/Screens/Spaces/SpaceScreen/SpaceScreenModels.swift
Mauro 6b19d109c7 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
2025-11-07 12:11:21 +01:00

52 lines
1.5 KiB
Swift

//
// Copyright 2025 Element Creations Ltd.
// Copyright 2025 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
import Foundation
enum SpaceScreenViewModelAction {
case selectSpace(SpaceRoomListProxyProtocol)
case selectUnjoinedSpace(SpaceRoomProxyProtocol)
case selectRoom(roomID: String)
case leftSpace
case presentRolesAndPermissions(roomProxy: JoinedRoomProxyProtocol)
case displayMembers(roomProxy: JoinedRoomProxyProtocol)
case displaySpaceSettings(roomProxy: JoinedRoomProxyProtocol)
}
struct SpaceScreenViewState: BindableState {
var space: SpaceRoomProxyProtocol
var permalink: URL?
var roomProxy: JoinedRoomProxyProtocol?
var isPaginating = false
var rooms: [SpaceRoomProxyProtocol]
var selectedSpaceRoomID: String?
var joiningRoomIDs: Set<String> = []
var canEditBaseInfo = false
var canEditRolesAndPermissions = false
var isSpaceManagementEnabled: Bool {
canEditBaseInfo || canEditRolesAndPermissions
}
var bindings = SpaceScreenViewStateBindings()
}
struct SpaceScreenViewStateBindings {
var leaveSpaceViewModel: LeaveSpaceViewModel?
}
enum SpaceScreenViewAction {
case spaceAction(SpaceRoomCell.Action)
case leaveSpace
case spaceSettings(roomProxy: JoinedRoomProxyProtocol)
case displayMembers(roomProxy: JoinedRoomProxyProtocol)
}