Tidy up the naming of spaces a bit more. (#4955)

* Rename SpaceListScreen to SpacesScreen

To avoid confusion with the SpaceRoomListProxy.

* Rename SpaceExplorerFlowCoordinator to SpacesTabFlowCoordinator and ChatsFlowCoordinator to ChatsTabFlowCoordinator.
This commit is contained in:
Doug
2026-01-14 13:45:25 +00:00
committed by GitHub
parent cde9714a83
commit 1feae5100a
30 changed files with 221 additions and 223 deletions
@@ -74,7 +74,7 @@ struct SpaceRoomCell: View {
.accessibilityElement(children: .combine)
}
.buttonStyle(SpaceRoomCellButtonStyle(isSelected: isSelected))
.accessibilityIdentifier(A11yIdentifiers.spaceListScreen.spaceRoomName(spaceServiceRoom.name))
.accessibilityIdentifier(A11yIdentifiers.spacesScreen.spaceRoomName(spaceServiceRoom.name))
}
@ViewBuilder @MainActor
@@ -6,41 +6,39 @@
// Please see LICENSE files in the repository root for full details.
//
// periphery:ignore:all - this is just a spaceList remove this comment once generating the final file
import Combine
import SwiftUI
struct SpaceListScreenCoordinatorParameters {
struct SpacesScreenCoordinatorParameters {
let userSession: UserSessionProtocol
let selectedSpacePublisher: CurrentValuePublisher<String?, Never>
let appSettings: AppSettings
let userIndicatorController: UserIndicatorControllerProtocol
}
enum SpaceListScreenCoordinatorAction {
enum SpacesScreenCoordinatorAction {
case selectSpace(SpaceRoomListProxyProtocol)
case showSettings
}
final class SpaceListScreenCoordinator: CoordinatorProtocol {
private let parameters: SpaceListScreenCoordinatorParameters
private let viewModel: SpaceListScreenViewModelProtocol
final class SpacesScreenCoordinator: CoordinatorProtocol {
private let parameters: SpacesScreenCoordinatorParameters
private let viewModel: SpacesScreenViewModelProtocol
private var cancellables = Set<AnyCancellable>()
private let actionsSubject: PassthroughSubject<SpaceListScreenCoordinatorAction, Never> = .init()
var actionsPublisher: AnyPublisher<SpaceListScreenCoordinatorAction, Never> {
private let actionsSubject: PassthroughSubject<SpacesScreenCoordinatorAction, Never> = .init()
var actionsPublisher: AnyPublisher<SpacesScreenCoordinatorAction, Never> {
actionsSubject.eraseToAnyPublisher()
}
init(parameters: SpaceListScreenCoordinatorParameters) {
init(parameters: SpacesScreenCoordinatorParameters) {
self.parameters = parameters
viewModel = SpaceListScreenViewModel(userSession: parameters.userSession,
selectedSpacePublisher: parameters.selectedSpacePublisher,
appSettings: parameters.appSettings,
userIndicatorController: parameters.userIndicatorController)
viewModel = SpacesScreenViewModel(userSession: parameters.userSession,
selectedSpacePublisher: parameters.selectedSpacePublisher,
appSettings: parameters.appSettings,
userIndicatorController: parameters.userIndicatorController)
}
func start() {
@@ -59,6 +57,6 @@ final class SpaceListScreenCoordinator: CoordinatorProtocol {
}
func toPresentable() -> AnyView {
AnyView(SpaceListScreen(context: viewModel.context))
AnyView(SpacesScreen(context: viewModel.context))
}
}
@@ -8,12 +8,12 @@
import Foundation
enum SpaceListScreenViewModelAction {
enum SpacesScreenViewModelAction {
case selectSpace(SpaceRoomListProxyProtocol)
case showSettings
}
struct SpaceListScreenViewState: BindableState {
struct SpacesScreenViewState: BindableState {
let userID: String
var userDisplayName: String?
var userAvatarURL: URL?
@@ -23,14 +23,14 @@ struct SpaceListScreenViewState: BindableState {
var isCreateSpaceEnabled: Bool
var bindings: SpaceListScreenViewStateBindings
var bindings: SpacesScreenViewStateBindings
}
struct SpaceListScreenViewStateBindings {
struct SpacesScreenViewStateBindings {
var isPresentingFeatureAnnouncement = false
}
enum SpaceListScreenViewAction {
enum SpacesScreenViewAction {
case spaceAction(SpaceRoomCell.Action)
case showSettings
case screenAppeared
@@ -9,15 +9,15 @@
import Combine
import SwiftUI
typealias SpaceListScreenViewModelType = StateStoreViewModelV2<SpaceListScreenViewState, SpaceListScreenViewAction>
typealias SpacesScreenViewModelType = StateStoreViewModelV2<SpacesScreenViewState, SpacesScreenViewAction>
class SpaceListScreenViewModel: SpaceListScreenViewModelType, SpaceListScreenViewModelProtocol {
class SpacesScreenViewModel: SpacesScreenViewModelType, SpacesScreenViewModelProtocol {
private let spaceServiceProxy: SpaceServiceProxyProtocol
private let appSettings: AppSettings
private let userIndicatorController: UserIndicatorControllerProtocol
private let actionsSubject: PassthroughSubject<SpaceListScreenViewModelAction, Never> = .init()
var actionsPublisher: AnyPublisher<SpaceListScreenViewModelAction, Never> {
private let actionsSubject: PassthroughSubject<SpacesScreenViewModelAction, Never> = .init()
var actionsPublisher: AnyPublisher<SpacesScreenViewModelAction, Never> {
actionsSubject.eraseToAnyPublisher()
}
@@ -29,10 +29,10 @@ class SpaceListScreenViewModel: SpaceListScreenViewModelType, SpaceListScreenVie
self.appSettings = appSettings
self.userIndicatorController = userIndicatorController
super.init(initialViewState: SpaceListScreenViewState(userID: userSession.clientProxy.userID,
topLevelSpaces: spaceServiceProxy.topLevelSpacesPublisher.value,
isCreateSpaceEnabled: appSettings.createSpaceEnabled,
bindings: .init()),
super.init(initialViewState: SpacesScreenViewState(userID: userSession.clientProxy.userID,
topLevelSpaces: spaceServiceProxy.topLevelSpacesPublisher.value,
isCreateSpaceEnabled: appSettings.createSpaceEnabled,
bindings: .init()),
mediaProvider: userSession.mediaProvider)
spaceServiceProxy.topLevelSpacesPublisher
@@ -61,7 +61,7 @@ class SpaceListScreenViewModel: SpaceListScreenViewModelType, SpaceListScreenVie
// MARK: - Public
override func process(viewAction: SpaceListScreenViewAction) {
override func process(viewAction: SpacesScreenViewAction) {
MXLog.info("View model: received view action: \(viewAction)")
switch viewAction {
@@ -9,7 +9,7 @@
import Combine
@MainActor
protocol SpaceListScreenViewModelProtocol {
var actionsPublisher: AnyPublisher<SpaceListScreenViewModelAction, Never> { get }
var context: SpaceListScreenViewModelType.Context { get }
protocol SpacesScreenViewModelProtocol {
var actionsPublisher: AnyPublisher<SpacesScreenViewModelAction, Never> { get }
var context: SpacesScreenViewModelType.Context { get }
}
@@ -12,7 +12,7 @@ import SwiftUI
struct SpacesAnnouncementSheetView: View {
@Environment(\.dismiss) private var dismiss
let context: SpaceListScreenViewModel.Context
let context: SpacesScreenViewModel.Context
var body: some View {
FullscreenDialog(topPadding: 44, horizontalPadding: 24) {
@@ -105,10 +105,10 @@ struct SpacesAnnouncementSheetView: View {
// MARK: - Previews
struct SpacesAnnouncementSheetView_Previews: PreviewProvider, TestablePreview {
static let viewModel = SpaceListScreenViewModel(userSession: UserSessionMock(.init()),
selectedSpacePublisher: .init(nil),
appSettings: ServiceLocator.shared.settings,
userIndicatorController: UserIndicatorControllerMock())
static let viewModel = SpacesScreenViewModel(userSession: UserSessionMock(.init()),
selectedSpacePublisher: .init(nil),
appSettings: ServiceLocator.shared.settings,
userIndicatorController: UserIndicatorControllerMock())
static var previews: some View {
SpacesAnnouncementSheetView(context: viewModel.context)
@@ -9,8 +9,8 @@
import Compound
import SwiftUI
struct SpaceListScreen: View {
@Bindable var context: SpaceListScreenViewModel.Context
struct SpacesScreen: View {
@Bindable var context: SpacesScreenViewModel.Context
var body: some View {
mainContent
@@ -134,22 +134,22 @@ struct SpaceListScreen: View {
// MARK: - Previews
struct SpaceListScreen_Previews: PreviewProvider, TestablePreview {
struct SpacesScreen_Previews: PreviewProvider, TestablePreview {
static let viewModel = makeViewModel()
static let emptyViewModel = makeViewModel(isEmpty: true)
static var previews: some View {
NavigationStack {
SpaceListScreen(context: viewModel.context)
SpacesScreen(context: viewModel.context)
}
NavigationStack {
SpaceListScreen(context: emptyViewModel.context)
SpacesScreen(context: emptyViewModel.context)
}
.previewDisplayName("Empty")
}
static func makeViewModel(isEmpty: Bool = false) -> SpaceListScreenViewModel {
static func makeViewModel(isEmpty: Bool = false) -> SpacesScreenViewModel {
AppSettings.resetAllSettings()
let appSettings = AppSettings()
appSettings.createSpaceEnabled = true
@@ -158,10 +158,10 @@ struct SpaceListScreen_Previews: PreviewProvider, TestablePreview {
let clientProxy = ClientProxyMock(.init())
clientProxy.spaceService = SpaceServiceProxyMock(.init(topLevelSpaces: isEmpty ? [] : .mockJoinedSpaces))
let viewModel = SpaceListScreenViewModel(userSession: UserSessionMock(.init(clientProxy: clientProxy)),
selectedSpacePublisher: .init(nil),
appSettings: appSettings,
userIndicatorController: UserIndicatorControllerMock())
let viewModel = SpacesScreenViewModel(userSession: UserSessionMock(.init(clientProxy: clientProxy)),
selectedSpacePublisher: .init(nil),
appSettings: appSettings,
userIndicatorController: UserIndicatorControllerMock())
return viewModel
}