mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-23 01:52:44 +02:00
Configured and applied SwiftFormat
This commit is contained in:
committed by
Stefan Ceriu
parent
ff2e6ddfa7
commit
43c28d23b7
+11
-13
@@ -24,7 +24,6 @@ enum RoomSuggestionCoordinatorCoordinatorAction {
|
||||
|
||||
@objcMembers
|
||||
final class RoomSuggestionCoordinator: Coordinator {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -32,7 +31,7 @@ final class RoomSuggestionCoordinator: Coordinator {
|
||||
private let parameters: RoomSuggestionCoordinatorParameters
|
||||
|
||||
private var navigationRouter: NavigationRouterType {
|
||||
return self.parameters.navigationRouter
|
||||
parameters.navigationRouter
|
||||
}
|
||||
|
||||
// MARK: Public
|
||||
@@ -46,31 +45,30 @@ final class RoomSuggestionCoordinator: Coordinator {
|
||||
|
||||
init(parameters: RoomSuggestionCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
|
||||
func start() {
|
||||
MXLog.debug("[RoomSuggestionCoordinator] did start.")
|
||||
let rootCoordinator = self.createRoomSuggestionSpaceChooser()
|
||||
let rootCoordinator = createRoomSuggestionSpaceChooser()
|
||||
rootCoordinator.start()
|
||||
|
||||
self.add(childCoordinator: rootCoordinator)
|
||||
add(childCoordinator: rootCoordinator)
|
||||
|
||||
if self.navigationRouter.modules.isEmpty == false {
|
||||
self.navigationRouter.push(rootCoordinator, animated: true, popCompletion: { [weak self] in
|
||||
if navigationRouter.modules.isEmpty == false {
|
||||
navigationRouter.push(rootCoordinator, animated: true, popCompletion: { [weak self] in
|
||||
self?.remove(childCoordinator: rootCoordinator)
|
||||
})
|
||||
} else {
|
||||
self.navigationRouter.setRootModule(rootCoordinator) { [weak self] in
|
||||
navigationRouter.setRootModule(rootCoordinator) { [weak self] in
|
||||
self?.remove(childCoordinator: rootCoordinator)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.navigationRouter.toPresentable()
|
||||
navigationRouter.toPresentable()
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
@@ -78,7 +76,7 @@ final class RoomSuggestionCoordinator: Coordinator {
|
||||
func pushScreen(with coordinator: Coordinator & Presentable) {
|
||||
add(childCoordinator: coordinator)
|
||||
|
||||
self.navigationRouter.push(coordinator, animated: true, popCompletion: { [weak self] in
|
||||
navigationRouter.push(coordinator, animated: true, popCompletion: { [weak self] in
|
||||
self?.remove(childCoordinator: coordinator)
|
||||
})
|
||||
|
||||
@@ -91,7 +89,8 @@ final class RoomSuggestionCoordinator: Coordinator {
|
||||
title: VectorL10n.roomSuggestionSettingsScreenTitle,
|
||||
detail: VectorL10n.roomSuggestionSettingsScreenMessage,
|
||||
viewProvider: RoomSuggestionSpaceChooserViewProvider(navTitle: VectorL10n.roomAccessSettingsScreenNavTitle),
|
||||
itemsProcessor: RoomSuggestionSpaceChooserItemsProcessor(roomId: parameters.room.roomId, session: parameters.room.mxSession))
|
||||
itemsProcessor: RoomSuggestionSpaceChooserItemsProcessor(roomId: parameters.room.roomId, session: parameters.room.mxSession)
|
||||
)
|
||||
let coordinator = MatrixItemChooserCoordinator(parameters: paramaters)
|
||||
coordinator.completion = { [weak self] result in
|
||||
guard let self = self else { return }
|
||||
@@ -107,5 +106,4 @@ final class RoomSuggestionCoordinator: Coordinator {
|
||||
}
|
||||
return coordinator
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-5
@@ -26,7 +26,6 @@ import UIKit
|
||||
/// Each bridge should be removed once the underlying Coordinator has been integrated by another Coordinator.
|
||||
@objcMembers
|
||||
final class RoomSuggestionCoordinatorBridgePresenter: NSObject {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -70,7 +69,7 @@ final class RoomSuggestionCoordinatorBridgePresenter: NSObject {
|
||||
}
|
||||
|
||||
func dismiss(animated: Bool, completion: (() -> Void)?) {
|
||||
guard let coordinator = self.coordinator else {
|
||||
guard let coordinator = coordinator else {
|
||||
return
|
||||
}
|
||||
coordinator.toPresentable().dismiss(animated: animated) {
|
||||
@@ -86,9 +85,7 @@ final class RoomSuggestionCoordinatorBridgePresenter: NSObject {
|
||||
// MARK: - UIAdaptivePresentationControllerDelegate
|
||||
|
||||
extension RoomSuggestionCoordinatorBridgePresenter: UIAdaptivePresentationControllerDelegate {
|
||||
|
||||
func roomNotificationSettingsCoordinatorDidComplete(_ presentationController: UIPresentationController) {
|
||||
self.delegate?.roomSuggestionCoordinatorBridgePresenterDelegateDidCancel(self)
|
||||
delegate?.roomSuggestionCoordinatorBridgePresenterDelegateDidCancel(self)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-1
@@ -18,7 +18,6 @@ import Foundation
|
||||
|
||||
/// RoomSuggestionCoordinator input parameters
|
||||
struct RoomSuggestionCoordinatorParameters {
|
||||
|
||||
/// The Matrix room
|
||||
let room: MXRoom
|
||||
|
||||
|
||||
+2
-3
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
class RoomSuggestionSpaceChooserViewProvider: MatrixItemChooserCoordinatorViewProvider {
|
||||
|
||||
private let navTitle: String?
|
||||
|
||||
init(navTitle: String?) {
|
||||
@@ -25,6 +24,6 @@ class RoomSuggestionSpaceChooserViewProvider: MatrixItemChooserCoordinatorViewPr
|
||||
}
|
||||
|
||||
func view(with viewModel: MatrixItemChooserViewModelType.Context) -> AnyView {
|
||||
return AnyView(RoomSuggestionSpaceChooserSelector(viewModel: viewModel, navTitle: navTitle))
|
||||
AnyView(RoomSuggestionSpaceChooserSelector(viewModel: viewModel, navTitle: navTitle))
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -22,7 +22,6 @@ public enum RoomSuggestionSpaceChooserItemsProcessorError: Int, Error {
|
||||
}
|
||||
|
||||
class RoomSuggestionSpaceChooserItemsProcessor: MatrixItemChooserProcessorProtocol {
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private let roomId: String
|
||||
@@ -35,7 +34,7 @@ class RoomSuggestionSpaceChooserItemsProcessor: MatrixItemChooserProcessorProtoc
|
||||
init(roomId: String, session: MXSession) {
|
||||
self.roomId = roomId
|
||||
self.session = session
|
||||
self.dataSource = MatrixItemChooserRoomDirectParentsDataSource(roomId: roomId, preselectionMode: .suggestedRoom)
|
||||
dataSource = MatrixItemChooserRoomDirectParentsDataSource(roomId: roomId, preselectionMode: .suggestedRoom)
|
||||
}
|
||||
|
||||
deinit {
|
||||
@@ -43,6 +42,7 @@ class RoomSuggestionSpaceChooserItemsProcessor: MatrixItemChooserProcessorProtoc
|
||||
NotificationCenter.default.removeObserver(observer)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: MatrixItemChooserSelectionProcessorProtocol
|
||||
|
||||
private(set) var dataSource: MatrixItemChooserDataSource
|
||||
@@ -53,11 +53,11 @@ class RoomSuggestionSpaceChooserItemsProcessor: MatrixItemChooserProcessorProtoc
|
||||
let unselectedItems: [String]
|
||||
let selectedItems: [String]
|
||||
if let preselectedItems = dataSource.preselectedItemIds {
|
||||
unselectedItems = preselectedItems.compactMap({ itemId in
|
||||
return !itemsIds.contains(itemId) ? itemId : nil
|
||||
})
|
||||
unselectedItems = preselectedItems.compactMap { itemId in
|
||||
!itemsIds.contains(itemId) ? itemId : nil
|
||||
}
|
||||
selectedItems = itemsIds.compactMap { itemId in
|
||||
return !preselectedItems.contains(itemId) ? itemId : nil
|
||||
!preselectedItems.contains(itemId) ? itemId : nil
|
||||
}
|
||||
} else {
|
||||
unselectedItems = []
|
||||
@@ -78,7 +78,7 @@ class RoomSuggestionSpaceChooserItemsProcessor: MatrixItemChooserProcessorProtoc
|
||||
if let firstError = self.computationErrorList.first {
|
||||
completion(.failure(firstError))
|
||||
} else {
|
||||
self.didBuildSpaceGraphObserver = NotificationCenter.default.addObserver(forName: MXSpaceService.didBuildSpaceGraph, object: nil, queue: OperationQueue.main) { [weak self] notification in
|
||||
self.didBuildSpaceGraphObserver = NotificationCenter.default.addObserver(forName: MXSpaceService.didBuildSpaceGraph, object: nil, queue: OperationQueue.main) { [weak self] _ in
|
||||
guard let self = self else { return }
|
||||
|
||||
if let observer = self.didBuildSpaceGraphObserver {
|
||||
@@ -93,8 +93,8 @@ class RoomSuggestionSpaceChooserItemsProcessor: MatrixItemChooserProcessorProtoc
|
||||
}
|
||||
}
|
||||
|
||||
func isItemIncluded(_ item: (MatrixListItemData)) -> Bool {
|
||||
return true
|
||||
func isItemIncluded(_ item: MatrixListItemData) -> Bool {
|
||||
true
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
+1
-3
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct RoomSuggestionSpaceChooserSelector: View {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
@ObservedObject var viewModel: MatrixItemChooserViewModel.Context
|
||||
@@ -48,5 +47,4 @@ struct RoomSuggestionSpaceChooserSelector: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user