* handling the history visibility flag * better logic to handle visibility * better handling of the visibility options state * added some copies, and the public room directory visibility state * completed the UI added also the preview tests * improved the handling of the directory visibility * added the space users case and improved handling of the access -> vsibility reaction. Also added a simple error handling for the public directory toggle * added the edit room address view but is missing its full implementation * implement the UI for the edit room address screen * implemented error checking when editing the address * updated preview tests and improved code * typo fix * Fix various issues after rebasing. * Fix build errors and broken snapshot tests * Adopt latest room privacy and canonical alias setting APIs * Add support for creating and editing the room's alias. * Add support for saving room privacy setting changes. * Fix room alias screen snapshot tests following recent changes. --------- Co-authored-by: Stefan Ceriu <stefanc@matrix.org>
54 lines
1.8 KiB
Swift
54 lines
1.8 KiB
Swift
//
|
|
// Copyright 2022-2024 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 Combine
|
|
import SwiftUI
|
|
|
|
struct SecurityAndPrivacyScreenCoordinatorParameters {
|
|
let roomProxy: JoinedRoomProxyProtocol
|
|
let clientProxy: ClientProxyProtocol
|
|
let userIndicatorController: UserIndicatorControllerProtocol
|
|
}
|
|
|
|
enum SecurityAndPrivacyScreenCoordinatorAction {
|
|
case displayEditAddressScreen
|
|
}
|
|
|
|
final class SecurityAndPrivacyScreenCoordinator: CoordinatorProtocol {
|
|
private let viewModel: SecurityAndPrivacyScreenViewModelProtocol
|
|
|
|
private var cancellables = Set<AnyCancellable>()
|
|
|
|
private let actionsSubject: PassthroughSubject<SecurityAndPrivacyScreenCoordinatorAction, Never> = .init()
|
|
var actionsPublisher: AnyPublisher<SecurityAndPrivacyScreenCoordinatorAction, Never> {
|
|
actionsSubject.eraseToAnyPublisher()
|
|
}
|
|
|
|
init(parameters: SecurityAndPrivacyScreenCoordinatorParameters) {
|
|
viewModel = SecurityAndPrivacyScreenViewModel(roomProxy: parameters.roomProxy,
|
|
clientProxy: parameters.clientProxy,
|
|
userIndicatorController: parameters.userIndicatorController)
|
|
}
|
|
|
|
func start() {
|
|
viewModel.actionsPublisher.sink { [weak self] action in
|
|
MXLog.info("Coordinator: received view model action: \(action)")
|
|
|
|
guard let self else { return }
|
|
switch action {
|
|
case .displayEditAddressScreen:
|
|
actionsSubject.send(.displayEditAddressScreen)
|
|
}
|
|
}
|
|
.store(in: &cancellables)
|
|
}
|
|
|
|
func toPresentable() -> AnyView {
|
|
AnyView(SecurityAndPrivacyScreen(context: viewModel.context))
|
|
}
|
|
}
|