implemented the presentation of transfer ownership screen from the space flow and update UI and preview tests

This commit is contained in:
Mauro Romito
2026-01-27 19:40:30 +01:00
committed by Mauro
parent 9de49bad9e
commit 9999cd24b8
34 changed files with 127 additions and 60 deletions
@@ -349,9 +349,8 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
stateMachine.tryEvent(.addRooms)
case .displayCreateChildRoomFlow(let space):
stateMachine.tryEvent(.startCreateChildRoomFlow, userInfo: space)
case .displayTransferOwnership(roomProxy: let roomProxy):
// TODO: Implement
break
case .displayTransferOwnership(let roomProxy):
presentTransferOwnershipScreen(roomProxy: roomProxy)
}
}
.store(in: &cancellables)
@@ -442,6 +441,27 @@ class SpaceFlowCoordinator: FlowCoordinatorProtocol {
}
}
private func presentTransferOwnershipScreen(roomProxy: JoinedRoomProxyProtocol) {
let parameters = RoomChangeRolesScreenCoordinatorParameters(mode: .owner,
roomProxy: roomProxy,
mediaProvider: flowParameters.userSession.mediaProvider,
userIndicatorController: flowParameters.userIndicatorController,
analytics: flowParameters.analytics)
let stackCoordinator = NavigationStackCoordinator()
let coordinator = RoomChangeRolesScreenCoordinator(parameters: parameters)
coordinator.actionsPublisher.sink { [weak self] action in
guard let self else { return }
switch action {
case .complete:
navigationStackCoordinator.setSheetCoordinator(nil)
}
}
.store(in: &cancellables)
stackCoordinator.setRootCoordinator(coordinator)
navigationStackCoordinator.setSheetCoordinator(stackCoordinator)
}
// MARK: - Other flows
private func startChildFlow(with entryPoint: SpaceFlowCoordinatorEntryPoint) {
@@ -222,10 +222,11 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol {
case .leftRoom:
leftRoom = true
navigationStackCoordinator.pop()
case .presentRecipientDetails, .presentNotificationSettingsScreen, .transferOwnership,
case .transferOwnership:
presentTransferOwnershipScreen()
case .presentRecipientDetails, .presentNotificationSettingsScreen, .presentReportRoomScreen,
.presentInviteUsersScreen, .presentPollsHistory, .presentCall,
.presentPinnedEventsTimeline, .presentMediaEventsTimeline, .presentKnockingRequestsListScreen,
.presentReportRoomScreen:
.presentPinnedEventsTimeline, .presentMediaEventsTimeline, .presentKnockingRequestsListScreen:
fatalError("Not handled in the space context")
}
}
@@ -326,6 +327,27 @@ final class SpaceSettingsFlowCoordinator: FlowCoordinatorProtocol {
}
}
private func presentTransferOwnershipScreen() {
let parameters = RoomChangeRolesScreenCoordinatorParameters(mode: .owner,
roomProxy: roomProxy,
mediaProvider: flowParameters.userSession.mediaProvider,
userIndicatorController: flowParameters.userIndicatorController,
analytics: flowParameters.analytics)
let stackCoordinator = NavigationStackCoordinator()
let coordinator = RoomChangeRolesScreenCoordinator(parameters: parameters)
coordinator.actionsPublisher.sink { [weak self] action in
guard let self else { return }
switch action {
case .complete:
navigationStackCoordinator.setSheetCoordinator(nil)
}
}
.store(in: &cancellables)
stackCoordinator.setRootCoordinator(coordinator)
navigationStackCoordinator.setSheetCoordinator(stackCoordinator, animated: true)
}
// MARK: - Other flows
private func startRolesAndPermissionsFlow() {