mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-25 19:10:49 +02:00
Configured and applied SwiftFormat
This commit is contained in:
committed by
Stefan Ceriu
parent
ff2e6ddfa7
commit
43c28d23b7
+2
-4
@@ -17,11 +17,10 @@
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
import UIKit
|
||||
|
||||
final class SpaceCreationMenuCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -63,12 +62,11 @@ final class SpaceCreationMenuCoordinator: Coordinator, Presentable {
|
||||
self.callback?(.cancel)
|
||||
case .back:
|
||||
self.callback?(.back)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.spaceCreationMenuHostingController
|
||||
spaceCreationMenuHostingController
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -38,4 +38,4 @@ struct SpaceCreationMenuRoomOption {
|
||||
let detail: String
|
||||
}
|
||||
|
||||
extension SpaceCreationMenuRoomOption: Identifiable, Equatable {}
|
||||
extension SpaceCreationMenuRoomOption: Identifiable, Equatable { }
|
||||
|
||||
+2
-3
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -19,5 +19,4 @@
|
||||
import Foundation
|
||||
|
||||
/// Actions to be performed on the `ViewModel` State
|
||||
enum SpaceCreationMenuStateAction {
|
||||
}
|
||||
enum SpaceCreationMenuStateAction { }
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
+17
-7
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -28,26 +28,31 @@ class SpaceCreationParameters {
|
||||
isModified = true
|
||||
}
|
||||
}
|
||||
|
||||
var topic: String? {
|
||||
didSet {
|
||||
isModified = true
|
||||
}
|
||||
}
|
||||
|
||||
var address: String? {
|
||||
didSet {
|
||||
isModified = true
|
||||
}
|
||||
}
|
||||
|
||||
var userDefinedAddress: String? {
|
||||
didSet {
|
||||
isModified = true
|
||||
}
|
||||
}
|
||||
var isPublic: Bool = false {
|
||||
|
||||
var isPublic = false {
|
||||
didSet {
|
||||
isModified = true
|
||||
}
|
||||
}
|
||||
|
||||
var showAddress: Bool {
|
||||
isPublic
|
||||
}
|
||||
@@ -57,7 +62,8 @@ class SpaceCreationParameters {
|
||||
isModified = true
|
||||
}
|
||||
}
|
||||
var isShared: Bool = false {
|
||||
|
||||
var isShared = false {
|
||||
didSet {
|
||||
isModified = true
|
||||
}
|
||||
@@ -84,22 +90,26 @@ class SpaceCreationParameters {
|
||||
isModified = true
|
||||
}
|
||||
}
|
||||
|
||||
var userDefinedEmailInvites: [String] {
|
||||
return emailInvites.filter { address in
|
||||
return !address.isEmpty
|
||||
emailInvites.filter { address in
|
||||
!address.isEmpty
|
||||
}
|
||||
}
|
||||
|
||||
var userIdInvites: [String] = [] {
|
||||
didSet {
|
||||
isModified = true
|
||||
}
|
||||
}
|
||||
|
||||
var inviteType: SpaceCreationInviteType = .email {
|
||||
didSet {
|
||||
isModified = true
|
||||
}
|
||||
}
|
||||
var isModified: Bool = false
|
||||
|
||||
var isModified = false
|
||||
}
|
||||
|
||||
struct SpaceCreationNewRoom: Equatable {
|
||||
@@ -107,6 +117,6 @@ struct SpaceCreationNewRoom: Equatable {
|
||||
var defaultName: String
|
||||
|
||||
static func == (lhs: Self, rhs: Self) -> Bool {
|
||||
return lhs.defaultName == rhs.defaultName && lhs.name == rhs.name
|
||||
lhs.defaultName == rhs.defaultName && lhs.name == rhs.name
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -16,14 +16,14 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class SpaceCreationMenuUITests: MockScreenTestCase {
|
||||
func testSpaceCreationMenuOptions() {
|
||||
app.goToScreenWithIdentifier(MockSpaceCreationMenuScreenState.options.title)
|
||||
|
||||
let optionButtonCount = app.buttons.matching(identifier:"optionButton").count
|
||||
let optionButtonCount = app.buttons.matching(identifier: "optionButton").count
|
||||
XCTAssertEqual(optionButtonCount, 2)
|
||||
|
||||
let titleText = app.staticTexts["titleText"]
|
||||
|
||||
+3
-4
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -16,14 +16,13 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import RiotSwiftUI
|
||||
|
||||
class SpaceCreationMenuViewModelTests: XCTestCase {
|
||||
private enum Constants {
|
||||
}
|
||||
private enum Constants { }
|
||||
|
||||
let navTitle = VectorL10n.spacesCreateSpaceTitle
|
||||
var creationParams = SpaceCreationParameters()
|
||||
|
||||
+1
-3
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -19,7 +19,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct SpaceCreationMenu: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
@ObservedObject var viewModel: SpaceCreationMenuViewModelType.Context
|
||||
@@ -100,7 +99,6 @@ struct SpaceCreationMenu: View {
|
||||
// MARK: - Previews
|
||||
|
||||
struct SpaceCreationMenu_Previews: PreviewProvider {
|
||||
|
||||
static let stateRenderer = MockSpaceCreationMenuScreenState.stateRenderer
|
||||
|
||||
static var previews: some View {
|
||||
|
||||
+9
-10
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -16,14 +16,13 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
typealias SpaceCreationMenuViewModelType = StateStoreViewModel<SpaceCreationMenuViewState,
|
||||
SpaceCreationMenuStateAction,
|
||||
SpaceCreationMenuViewAction>
|
||||
SpaceCreationMenuStateAction,
|
||||
SpaceCreationMenuViewAction>
|
||||
class SpaceCreationMenuViewModel: SpaceCreationMenuViewModelType, SpaceCreationMenuViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -43,7 +42,7 @@ class SpaceCreationMenuViewModel: SpaceCreationMenuViewModelType, SpaceCreationM
|
||||
}
|
||||
|
||||
private static func defaultState(navTitle: String?, creationParams: SpaceCreationParameters, title: String, detail: String, options: [SpaceCreationMenuRoomOption]) -> SpaceCreationMenuViewState {
|
||||
var navigationTitle: String = ""
|
||||
var navigationTitle = ""
|
||||
if let navTitle = navTitle {
|
||||
navigationTitle = navTitle
|
||||
} else {
|
||||
@@ -60,13 +59,13 @@ class SpaceCreationMenuViewModel: SpaceCreationMenuViewModelType, SpaceCreationM
|
||||
case .didSelectOption(let optionId):
|
||||
switch optionId {
|
||||
case .publicSpace:
|
||||
self.creationParams.isPublic = true
|
||||
creationParams.isPublic = true
|
||||
case .privateSpace:
|
||||
self.creationParams.isPublic = false
|
||||
creationParams.isPublic = false
|
||||
case .ownedPrivateSpace:
|
||||
self.creationParams.isShared = false
|
||||
creationParams.isShared = false
|
||||
case .sharedPrivateSpace:
|
||||
self.creationParams.isShared = true
|
||||
creationParams.isShared = true
|
||||
}
|
||||
|
||||
didSelectOption(withId: optionId)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// File created from TemplateAdvancedRoomsExample
|
||||
// $ createSwiftUITwoScreen.sh Spaces/SpaceCreation SpaceCreation SpaceCreationMenu SpaceCreationSettings
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
Reference in New Issue
Block a user