Run SwiftFormat.

This commit is contained in:
Doug
2026-05-27 14:38:50 +01:00
committed by Doug
parent 5138e05e47
commit fa67713726
573 changed files with 2426 additions and 2426 deletions
@@ -49,7 +49,7 @@ class AppLockFlowCoordinator: CoordinatorProtocol {
/// The user failed to unlock the app (or forgot their PIN) and is being logged out.
case loggingOut
}
/// Events that can be triggered on the flow state machine
enum Event: EventType {
/// Starts the flow while the app is launching in the background.
@@ -145,7 +145,7 @@ class AppLockFlowCoordinator: CoordinatorProtocol {
switch (fromState, event) {
case (.initial, .start):
return .backgrounded
case (.unlocked, .willResignActive):
return .appObscured
case (.appObscured, .didBecomeActive):
@@ -169,14 +169,14 @@ class AppLockFlowCoordinator: CoordinatorProtocol {
return .unlocked
case (.attemptingPINUnlock, .forceLogout):
return .loggingOut
// Transition to a valid state when enabling the service for the first time.
case (.initial, .serviceEnabled):
return .unlocked
// Transition to a valid state once the service is disabled following a forced logout.
case (.loggingOut, .serviceDisabled):
return .unlocked
default:
return fromState
}
@@ -49,7 +49,7 @@ class AppLockSetupFlowCoordinator: FlowCoordinatorProtocol {
/// The user is being signed out. This is a final state.
case loggingOut
}
/// Events that can be triggered on the flow state machine
enum Event: EventType {
/// Start the flow.
@@ -170,7 +170,7 @@ class AppLockSetupFlowCoordinator: FlowCoordinatorProtocol {
fatalError("Unexpected transition from `\(context.fromState)` to `\(context.toState)` with event `\(String(describing: context.event))`.")
}
}
private func showCreatePIN() {
// Despite appLockService.isMandatory existing, we don't use that here,
// to allow for cancellation when changing the PIN code within settings.
@@ -304,7 +304,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
showOAuthAuthentication(oAuthData: oAuthData, presentationAnchor: window)
case .loginDirectlyWithPassword(let loginHint):
stateMachine.tryEvent(.continueWithPassword, userInfo: loginHint)
case .reportProblem:
stateMachine.tryEvent(.reportProblem)
case .developerOptions:
@@ -451,7 +451,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
coordinator.actions
.sink { [weak self] action in
guard let self else { return }
switch action {
case .signedIn(let userSession):
stateMachine.tryEvent(.signedIn, userInfo: userSession)
@@ -509,7 +509,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
}
// MARK: - Completion
private func userHasSignedIn(userSession: UserSessionProtocol) {
delegate?.authenticationFlowCoordinator(didLoginWithSession: userSession)
}
@@ -49,7 +49,7 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol {
private var cancellables = Set<AnyCancellable>()
private let sidebarNavigationStackCoordinator: NavigationStackCoordinator
private let selectedRoomSubject = CurrentValueSubject<String?, Never>(nil)
private let actionsSubject: PassthroughSubject<ChatsTabFlowCoordinatorAction, Never> = .init()
@@ -76,7 +76,7 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol {
}
func stop() { }
func isDisplayingRoomScreen(withRoomID roomID: String) -> Bool {
stateMachine.isDisplayingRoomScreen(withRoomID: roomID)
}
@@ -94,7 +94,7 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol {
func clearRoute(animated: Bool) {
roomFlowCoordinator?.clearRoute(animated: animated)
}
// MARK: - Private
func asyncHandleAppRoute(_ appRoute: AppRoute, animated: Bool) async {
@@ -204,7 +204,7 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol {
handleSelectRoomTransition(roomID: roomID, via: via, entryPoint: entryPoint, detailState: detailState, animated: animated)
case(.roomList, .deselectRoom, .roomList):
dismissRoomFlow(animated: animated)
case(.roomList, .startSpaceFlow, .roomList):
guard let spaceRoomListProxy = userInfo?.spaceRoomListProxy else { fatalError("A space room list proxy is required.") }
startSpaceFlow(spaceRoomListProxy: spaceRoomListProxy, animated: animated)
@@ -247,7 +247,7 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol {
presentRoomDirectorySearch()
case (.roomDirectorySearchScreen, .dismissedRoomDirectorySearchScreen, .roomList):
dismissRoomDirectorySearch()
case (_, .showUserProfileScreen(let userID), .userProfileScreen):
presentUserProfileScreen(userID: userID, animated: animated)
case (.userProfileScreen, .dismissedUserProfileScreen, .roomList):
@@ -572,7 +572,7 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol {
case .thread(let rootEventID, let focusEventID):
coordinator.handleAppRoute(.thread(roomID: roomID, threadRootEventID: rootEventID, focusEventID: focusEventID), animated: animated)
}
Task {
let _ = await userSession.clientProxy.trackRecentlyVisitedRoom(roomID)
@@ -637,7 +637,7 @@ class ChatsTabFlowCoordinator: FlowCoordinatorProtocol {
switch action {
case .finished(let result):
navigationSplitCoordinator.setSheetCoordinator(nil)
switch result {
case .room(let roomID):
stateMachine.processEvent(.selectRoom(roomID: roomID, via: [], entryPoint: .room))
@@ -15,15 +15,15 @@ class ChatsTabFlowCoordinatorStateMachine {
case room(roomID: String)
case space
}
/// States the AppCoordinator can find itself in
enum State: StateType {
/// The initial state, used before the coordinator starts
case initial
/// Showing the home screen. The `roomListSelectedRoomID` represents the timeline shown on the detail panel (if any)
case roomList(detailState: DetailState?)
/// Showing the feedback screen.
case feedbackScreen(detailState: DetailState?)
@@ -78,7 +78,7 @@ class ChatsTabFlowCoordinatorStateMachine {
let animated: Bool
var spaceRoomListProxy: SpaceRoomListProxyProtocol?
}
/// Events that can be triggered on the AppCoordinator state machine
enum Event: EventType {
/// Start the user session flows.
@@ -152,10 +152,10 @@ class ChatsTabFlowCoordinatorStateMachine {
stateMachine = StateMachine(state: .initial)
configure()
}
private func configure() {
stateMachine.addRoutes(event: .start, transitions: [.initial => .roomList(detailState: nil)])
stateMachine.addRouteMapping { event, fromState, _ in
switch (fromState, event) {
case (.roomList, .selectRoom(let roomID, _, _)):
@@ -163,7 +163,7 @@ class ChatsTabFlowCoordinatorStateMachine {
case (.roomList(let detailState), .deselectRoom):
// Ignore the flow's dismissal if it has already been replaced with a space.
return detailState == .space ? nil : .roomList(detailState: nil)
case (.roomList, .startSpaceFlow):
return .roomList(detailState: .space)
case (.roomList, .finishedSpaceFlow):
@@ -193,7 +193,7 @@ class ChatsTabFlowCoordinatorStateMachine {
return .roomDirectorySearchScreen(detailState: detailState)
case (.roomDirectorySearchScreen(let detailState), .dismissedRoomDirectorySearchScreen):
return .roomList(detailState: detailState)
case (_, .showUserProfileScreen):
return .userProfileScreen
case (.userProfileScreen, .dismissedUserProfileScreen):
@@ -113,7 +113,7 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol {
}
actionsSubject.send(.requestPresentation(animated: !isNewLogin))
stateMachine.tryEvent(.next)
}
@@ -203,7 +203,7 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol {
case (.notificationPermissions, _, _, _, _):
return .finished
default:
return nil
}
@@ -381,7 +381,7 @@ class OnboardingFlowCoordinator: FlowCoordinatorProtocol {
appLockFlowCoordinator = coordinator
coordinator.start()
}
private func presentAnalyticsPromptScreen() {
let coordinator = AnalyticsPromptScreenCoordinator(analytics: analyticsService, termsURL: appSettings.analyticsTermsURL)
@@ -156,7 +156,7 @@ class PinnedEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
.store(in: &cancellables)
stackCoordinator.setRootCoordinator(coordinator)
navigationStackCoordinator.setSheetCoordinator(stackCoordinator)
}
}
@@ -119,7 +119,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
setupStateMachine()
}
// MARK: - FlowCoordinatorProtocol
func start(animated: Bool) {
@@ -357,7 +357,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
MXLog.warning("Found an existing proxy, returning.")
return
}
await roomProxy.subscribeForUpdates()
// Make sure not to set this until after the subscription has succeeded, otherwise the
@@ -399,15 +399,15 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
}
case (_, .dismissFlow, .complete):
dismissFlow(animated: animated)
case (.room, .presentPinnedEventsTimeline, .pinnedEventsTimeline):
startPinnedEventsTimelineFlow()
// Thread List
case (.room, .presentThreadList, .threadList):
Task { await self.presentThreadList(animated: animated) }
// Thread
case (_, .presentThread(let threadRootEventID, let focusEventID), .thread):
@@ -443,13 +443,13 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
case (_, .presentMessageForwarding(let forwardingItem), .messageForwarding):
presentMessageForwarding(with: forwardingItem)
case (_, .presentMapNavigator(let mode), .mapNavigator):
guard let timelineController = (context.userInfo as? EventUserInfo)?.timelineController else {
fatalError("Missing required TimelineController")
}
presentMapNavigator(interactionMode: mode, timelineController: timelineController, animated: animated)
case (_, .presentPollForm(let mode), .pollForm):
guard let timelineController = (context.userInfo as? EventUserInfo)?.timelineController else {
fatalError("Missing required TimelineController")
@@ -460,7 +460,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
presentResolveSendFailure(failure: failure, sendHandle: sendHandle)
// Room Details
case (.initial, .presentRoomDetails, .roomDetails(let isRoot)),
(.room, .presentRoomDetails, .roomDetails(let isRoot)),
(.roomDetails, .presentRoomDetails, .roomDetails(let isRoot)):
@@ -482,7 +482,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
presentRolesAndPermissionsScreen()
case (.rolesAndPermissions, .dismissRolesAndPermissionsScreen, .roomDetails):
rolesAndPermissionsFlowCoordinator = nil
case (.roomDetails, .presentMediaEventsTimeline, .mediaEventsTimeline):
Task { await self.startMediaEventsTimelineFlow() }
@@ -519,7 +519,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
startMembersFlow(entryPoint: entryPoint, animated: animated)
case (.membersFlow, .stopMembersFlow, _):
membersFlowCoordinator = nil
case (_, .startChildFlow(let roomID, let via, let entryPoint), .presentingChild):
startChildFlow(for: roomID, via: via, entryPoint: entryPoint)
case (.presentingChild, .dismissChildFlow, _):
@@ -530,7 +530,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
case (.notificationSettings, .presentGlobalNotificationSettingsScreen, .globalNotificationSettings):
presentGlobalNotificationSettingsScreen()
case (.pollsHistory, .presentPollForm(let mode), .pollsHistoryForm):
guard let timelineController = (context.userInfo as? EventUserInfo)?.timelineController else {
fatalError("Missing required TimelineController")
@@ -549,7 +549,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
case (_, .presentTransferOwnershipScreen, .transferOwnershipScreen):
presentTransferOwnershipScreen()
default:
break
}
@@ -642,7 +642,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
self?.stateMachine.tryEvent(.dismissFlow)
}
}
switch presentationAction {
case .share(.mediaFiles(_, let mediaFiles)):
stateMachine.tryEvent(.presentMediaUploadPreview(mediaURLs: mediaFiles.map(\.url), caption: nil),
@@ -846,7 +846,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
}
}
.store(in: &cancellables)
navigationStackCoordinator.push(coordinator, animated: animated) { [weak self] in
guard let self else { return }
stateMachine.tryEvent(.dismissThread)
@@ -1098,16 +1098,16 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
userInfo: EventUserInfo(animated: animated, timelineController: timelineController))
}
}
stackCoordinator.setRootCoordinator(mediaPickerCoordinator)
navigationStackCoordinator.setSheetCoordinator(stackCoordinator) { [weak self] in
if case .mediaUploadPicker = self?.stateMachine.state {
self?.stateMachine.tryEvent(.dismissMediaUploadPicker)
}
}
}
private func presentMediaUploadPreviewScreen(for mediaURLs: [URL],
caption: NSAttributedString?,
timelineController: TimelineControllerProtocol,
@@ -1119,7 +1119,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
} else {
nil
}
let parameters = MediaUploadPreviewScreenCoordinatorParameters(mediaURLs: mediaURLs,
caption: caption,
title: title,
@@ -1129,7 +1129,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
timelineController: timelineController,
clientProxy: userSession.clientProxy,
userIndicatorController: flowParameters.userIndicatorController)
let mediaUploadPreviewScreenCoordinator = MediaUploadPreviewScreenCoordinator(parameters: parameters)
mediaUploadPreviewScreenCoordinator.actions
@@ -1142,7 +1142,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
}
}
.store(in: &cancellables)
stackCoordinator.setRootCoordinator(mediaUploadPreviewScreenCoordinator)
navigationStackCoordinator.setSheetCoordinator(stackCoordinator, animated: animated) { [weak self] in
@@ -1174,12 +1174,12 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
self?.stateMachine.tryEvent(.dismissEmojiPicker)
}
}
private func presentMapNavigator(interactionMode: LocationSharingInteractionMode,
timelineController: TimelineControllerProtocol,
animated: Bool) {
let stackCoordinator = NavigationStackCoordinator()
let params = LocationSharingScreenCoordinatorParameters(interactionMode: interactionMode,
mapURLBuilder: flowParameters.appSettings.mapTilerConfiguration,
roomProxy: roomProxy,
@@ -1214,7 +1214,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
analytics: flowParameters.analytics,
userIndicatorController: flowParameters.userIndicatorController))
stackCoordinator.setRootCoordinator(coordinator)
coordinator.actions
.sink { [weak self] action in
guard let self else { return }
@@ -1225,7 +1225,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
}
}
.store(in: &cancellables)
navigationStackCoordinator.setSheetCoordinator(stackCoordinator) { [weak self] in
self?.stateMachine.tryEvent(.dismissPollForm)
}
@@ -1237,7 +1237,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
let timelineItemFactory = RoomTimelineItemFactory(userID: userID,
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID))
let timelineController = flowParameters.timelineControllerFactory.buildTimelineController(roomProxy: roomProxy,
initialFocussedEventID: nil,
timelineItemFactory: timelineItemFactory,
@@ -1291,7 +1291,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
.store(in: &cancellables)
stackCoordinator.setRootCoordinator(coordinator)
navigationStackCoordinator.setSheetCoordinator(stackCoordinator) { [weak self] in
self?.stateMachine.tryEvent(.dismissMessageForwarding)
}
@@ -1341,12 +1341,12 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
private func presentInviteUsersScreen(flow: InviteUsersFlow = .existingRoom) {
let stackCoordinator = NavigationStackCoordinator()
let roomType: InviteUsersScreenRoomType = switch flow {
case .existingRoom: .existingRoom(roomProxy: roomProxy)
case .newRoom(let mandatoryInvitee): .draft(mandatoryInvitees: [mandatoryInvitee])
}
let inviteParameters = InviteUsersScreenCoordinatorParameters(userSession: userSession,
roomType: roomType,
isSkippable: false,
@@ -1617,7 +1617,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
case .viewInRoomTimeline(let itemID):
guard let eventID = itemID.eventID else {
MXLog.error("Unable to present room timeline for event \(itemID)")
return
}
stateMachine.tryEvent(.presentRoom(presentationAction: .eventFocus(.init(eventID: eventID, shouldSetPin: false))),
@@ -12,11 +12,11 @@ import SwiftState
extension RoomFlowCoordinator {
struct HashableRoomMemberWrapper: Hashable {
let value: RoomMemberProxyProtocol
static func == (lhs: HashableRoomMemberWrapper, rhs: HashableRoomMemberWrapper) -> Bool {
lhs.value.userID == rhs.value.userID
}
func hash(into hasher: inout Hasher) {
hasher.combine(value.userID)
}
@@ -54,7 +54,7 @@ extension RoomFlowCoordinator {
}
}
}
indirect enum State: StateType {
case initial
case joinRoomScreen
@@ -103,7 +103,7 @@ extension RoomFlowCoordinator {
var spaceRoomListProxy: SpaceRoomListProxyProtocol?
var authorizedSpacesSelection: AuthorizedSpacesSelection?
}
enum Event: EventType {
case presentJoinRoomScreen(via: [String])
case dismissJoinRoomScreen
@@ -114,7 +114,7 @@ extension RoomFlowCoordinator {
case presentThread(threadRootEventID: String, focusEventID: String?)
case dismissThread
case presentThreadList
case dismissThreadList
@@ -138,7 +138,7 @@ extension RoomFlowCoordinator {
case presentInviteUsersScreen(flow: InviteUsersFlow)
case dismissInviteUsersScreen
case presentMediaUploadPicker(mode: MediaPickerScreenMode, caption: NSAttributedString)
case dismissMediaUploadPicker
@@ -147,13 +147,13 @@ extension RoomFlowCoordinator {
case presentEmojiPicker(itemID: TimelineItemIdentifier, selectedEmojis: Set<String>)
case dismissEmojiPicker
case presentMapNavigator(interactionMode: LocationSharingInteractionMode)
case dismissMapNavigator
case presentMessageForwarding(forwardingItem: MessageForwardingItem)
case dismissMessageForwarding
case presentPollForm(mode: PollFormMode)
case dismissPollForm
@@ -212,21 +212,21 @@ extension RoomFlowCoordinator {
case (.room, .presentMediaUploadPicker(let mode, let caption)):
return .mediaUploadPicker(mode: mode, caption: caption, previousState: fromState)
case (.room, .presentMediaUploadPreview(let mediaURLs, let caption)):
return .mediaUploadPreview(mediaURLs: mediaURLs, caption: caption, previousState: fromState)
case (.room, .presentEmojiPicker(let itemID, let selectedEmoji)):
return .emojiPicker(itemID: itemID, selectedEmojis: selectedEmoji, previousState: fromState)
case (.room, .presentMessageForwarding(let forwardingItem)):
return .messageForwarding(forwardingItem: forwardingItem, previousState: fromState)
case (.mediaEventsTimeline, .presentMessageForwarding(forwardingItem: let forwardingItem)):
return .messageForwarding(forwardingItem: forwardingItem, previousState: fromState)
case (.room, .presentMapNavigator):
return .mapNavigator(previousState: fromState)
case (.room, .presentPollForm):
return .pollForm(previousState: fromState)
@@ -247,7 +247,7 @@ extension RoomFlowCoordinator {
return .room
case (.threadList, .presentThread(let threadRootEventID, _)):
return .thread(threadRootEventID: threadRootEventID, previousState: fromState)
// Thread
case (.room, .presentThread(let threadRootEventID, _)):
return .thread(threadRootEventID: threadRootEventID, previousState: fromState)
@@ -261,19 +261,19 @@ extension RoomFlowCoordinator {
case (.thread, .presentMediaUploadPicker(let mode, let caption)):
return .mediaUploadPicker(mode: mode, caption: caption, previousState: fromState)
case (.thread, .presentMediaUploadPreview(let mediaURLs, let caption)):
return .mediaUploadPreview(mediaURLs: mediaURLs, caption: caption, previousState: fromState)
case (.thread, .presentEmojiPicker(let itemID, let selectedEmoji)):
return .emojiPicker(itemID: itemID, selectedEmojis: selectedEmoji, previousState: fromState)
case (.thread, .presentMessageForwarding(let forwardingItem)):
return .messageForwarding(forwardingItem: forwardingItem, previousState: fromState)
case (.thread, .presentMapNavigator):
return .mapNavigator(previousState: fromState)
case (.thread, .presentPollForm):
return .pollForm(previousState: fromState)
@@ -372,7 +372,7 @@ extension RoomFlowCoordinator {
return .membersFlow(previousState: fromState)
case (.membersFlow(let previousState), .stopMembersFlow):
return previousState
case (_, .startChildFlow(let roomID, _, _)):
return .presentingChild(childRoomID: roomID, previousState: fromState)
case (.presentingChild(_, let previousState), .dismissChildFlow):
@@ -413,7 +413,7 @@ extension RoomFlowCoordinator {
return .transferOwnershipScreen(previousState: fromState)
case (.transferOwnershipScreen(let previousState), .dismissedTransferOwnershipScreen):
return previousState
default:
return nil
}
@@ -42,7 +42,7 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol {
case start
case presentRoomMembersList
case presentRoomMemberDetails(userID: String)
case dismissedRoomMemberDetails
@@ -246,7 +246,7 @@ final class RoomMembersFlowCoordinator: FlowCoordinatorProtocol {
}
}
.store(in: &cancellables)
navigationStackCoordinator.push(coordinator, animated: animated) { [weak self] in
guard let self else { return }
if case let .roomMemberDetails(_, previousState) = stateMachine.state,
@@ -238,7 +238,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
userIndicatorController: flowParameters.userIndicatorController))
navigationStackCoordinator.push(coordinator)
}
private func presentNotificationSettings() {
let notificationParameters = NotificationSettingsScreenCoordinatorParameters(navigationStackCoordinator: navigationStackCoordinator,
userSession: flowParameters.userSession,
@@ -203,22 +203,22 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
return .space
case (.initial, .startUnjoined):
return .joinSpace
case (.joinSpace, .joinedSpace):
return .space
case (.space, .leftSpace):
return .leftSpace
case (.space, .addRooms):
return .addingRooms
case (.addingRooms, .dismissedAddRooms):
return .space
case (.space, .presentTransferOwnership):
return .transferOwnership
case (.transferOwnership, .dismissedTransferOwnership):
return .space
case (.space, .startChildFlow):
guard let childEntryPoint = userInfo as? SpaceFlowCoordinatorEntryPoint else { fatalError("An entry point must be provided.") }
return .presentingChild(childSpaceID: childEntryPoint.spaceID, previousState: fromState)
@@ -227,34 +227,34 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
return .presentingChild(childSpaceID: childEntryPoint.spaceID, previousState: previousState)
case (.presentingChild(_, let previousState), .stopChildFlow):
return previousState
case (.space, .startRoomFlow):
return .roomFlow(previousState: fromState)
case (.roomFlow, .startRoomFlow):
return fromState // Ignore tapping on multiple rooms at the same time
case (.roomFlow(let previousState), .stopRoomFlow):
return previousState
case (.space, .startMembersFlow):
return .membersFlow
case (.membersFlow, .stopMembersFlow):
return .space
case (.space, .startSettingsFlow):
return .settingsFlow
case (.settingsFlow, .stopSettingsFlow):
return .space
case (.space, .startRolesAndPermissionsFlow):
return .rolesAndPermissionsFlow
case (.rolesAndPermissionsFlow, .stopRolesAndPermissionsFlow):
return .space
case (.space, .startCreateChildRoomFlow):
return .createChildRoomFlow
case (.createChildRoomFlow, .stopCreateChildRoomFlow):
return .space
default:
return nil
}
@@ -268,23 +268,23 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
presentSpace()
case (.initial, .startUnjoined, .joinSpace):
presentJoinSpaceScreen()
case (.joinSpace, .joinedSpace, .space):
presentSpaceAfterJoining()
case (.space, .leftSpace, .leftSpace):
clearRoute(animated: true)
case (.space, .addRooms, .addingRooms):
presentSpaceAddRoomsScreen()
case (.addingRooms, .dismissedAddRooms, .space):
break
case (.space, .presentTransferOwnership, .transferOwnership):
guard let roomProxy = context.userInfo as? JoinedRoomProxyProtocol else { return }
presentTransferOwnershipScreen(roomProxy: roomProxy)
case (.transferOwnership, .dismissedTransferOwnership, .space):
break
case (.space, .startChildFlow, .presentingChild),
(.roomFlow, .startChildFlow, .presentingChild):
guard let entryPoint = context.userInfo as? SpaceFlowCoordinatorEntryPoint else { return }
@@ -292,7 +292,7 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
case (.presentingChild, .stopChildFlow, _):
childSpaceFlowCoordinator = nil
selectedSpaceRoomSubject.send(nil)
case (.space, .startRoomFlow(let roomID), .roomFlow):
startRoomFlow(roomID: roomID)
case (.roomFlow, .startRoomFlow, .roomFlow):
@@ -300,7 +300,7 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
case (.roomFlow, .stopRoomFlow, _):
roomFlowCoordinator = nil
selectedSpaceRoomSubject.send(nil)
case (.space, .startMembersFlow, .membersFlow):
guard let roomProxy = context.userInfo as? JoinedRoomProxyProtocol else {
fatalError("The room proxy must always be provided")
@@ -308,25 +308,25 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
startMembersFlow(roomProxy: roomProxy)
case (.membersFlow, .stopMembersFlow, .space):
membersFlowCoordinator = nil
case (.space, .startSettingsFlow, .settingsFlow):
guard let roomProxy = context.userInfo as? JoinedRoomProxyProtocol else { return }
startSettingsFlow(roomProxy: roomProxy)
case (.settingsFlow, .stopSettingsFlow, .space):
settingsFlowCoordinator = nil
case (.space, .startRolesAndPermissionsFlow, .rolesAndPermissionsFlow):
guard let roomProxy = context.userInfo as? JoinedRoomProxyProtocol else { return }
startRolesAndPermissionsFlow(roomProxy: roomProxy)
case (.rolesAndPermissionsFlow, .stopRolesAndPermissionsFlow, .space):
rolesAndPermissionsFlowCoordinator = nil
case (.space, .startCreateChildRoomFlow, .createChildRoomFlow):
guard let space = context.userInfo as? SpaceServiceRoom else { fatalError("The space is missing") }
startCreateChildFlow(space: space)
case (.createChildRoomFlow, .stopCreateChildRoomFlow, .space):
createChildRoomFlowCoordinator = nil
default:
break
}
@@ -55,7 +55,7 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol {
case presentManageAuthorizedSpacesScreen
case dismissedManageAuthorizedSpacesScreen
case presentTransferOwnership
case dismissedTransferOwnership
@@ -84,7 +84,7 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol {
var actions: AnyPublisher<SpaceSettingsFlowCoordinatorAction, Never> {
actionsSubject.eraseToAnyPublisher()
}
init(roomProxy: JoinedRoomProxyProtocol,
navigationStackCoordinator: NavigationStackCoordinator,
flowParameters: CommonFlowParameters) {
@@ -140,7 +140,7 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol {
return .manageAuthorizedSpacesScreen
case (.manageAuthorizedSpacesScreen, .dismissedManageAuthorizedSpacesScreen):
return .securityAndPrivacy
case (.spaceSettings, .presentTransferOwnership):
return .transferOwnership
case (.transferOwnership, .dismissedTransferOwnership):
@@ -191,12 +191,12 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol {
presentManageAuthorizedSpacesScreen(selection: selection)
case (.manageAuthorizedSpacesScreen, .dismissedManageAuthorizedSpacesScreen, .securityAndPrivacy):
break
case (.spaceSettings, .presentTransferOwnership, .transferOwnership):
presentTransferOwnershipScreen()
case (.transferOwnership, .dismissedTransferOwnership, .spaceSettings):
break
case (.spaceSettings, .startMembersListFlow, .membersFlow):
startMembersListFlow()
case (.membersFlow, .stopMembersListFlow, .spaceSettings):
@@ -100,7 +100,7 @@ class SpacesTabFlowCoordinator: FlowCoordinatorProtocol {
stateMachine.addRoutes(event: .start, transitions: [.initial => .spacesScreen(selectedSpaceID: nil)]) { [weak self] _ in
self?.presentSpacesScreen()
}
stateMachine.addRouteMapping { event, fromState, userInfo in
guard event == .selectSpace, case .spacesScreen = fromState else { return nil }
guard let spaceRoomListProxy = userInfo as? SpaceRoomListProxyProtocol else { fatalError("A space proxy must be provided.") }
@@ -478,7 +478,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
navigationTabCoordinator.setOverlayCoordinator(nil)
}
// MARK: - Logout
private func runLogoutFlow() async {