Merge together SwiftUI template model files and update folder structure.

This commit is contained in:
Stefan Ceriu
2021-12-07 14:43:39 +02:00
committed by Stefan Ceriu
parent 9752e3af85
commit 480ad52f60
43 changed files with 244 additions and 692 deletions

View File

@@ -1,23 +1,27 @@
/*
Copyright 2021 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
import UIKit
import SwiftUI
struct TemplateUserProfileCoordinatorParameters {
let session: MXSession
}
final class TemplateUserProfileCoordinator: Coordinator {
// MARK: - Properties

View File

@@ -1,21 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
struct TemplateUserProfileCoordinatorParameters {
let session: MXSession
}

View File

@@ -1,22 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
enum TemplateUserProfileStateAction {
case viewAction(TemplateUserProfileViewAction)
case updatePresence(TemplateUserProfilePresence)
}

View File

@@ -1,24 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
enum TemplateUserProfileViewAction {
case incrementCount
case decrementCount
case cancel
case done
}

View File

@@ -1,22 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
enum TemplateUserProfileViewModelResult {
case cancel
case done
}

View File

@@ -1,24 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
struct TemplateUserProfileViewState: BindableState {
let avatar: AvatarInputProtocol?
let displayName: String?
var presence: TemplateUserProfilePresence
var count: Int
}

View File

@@ -16,13 +16,17 @@
import Foundation
// MARK: - Coordinator
enum TemplateUserProfilePresence {
case online
case idle
case offline
}
extension TemplateUserProfilePresence {
extension TemplateUserProfilePresence: Identifiable, CaseIterable {
var id: Self { self }
var title: String {
switch self {
case .online:
@@ -35,8 +39,30 @@ extension TemplateUserProfilePresence {
}
}
extension TemplateUserProfilePresence: CaseIterable { }
// MARK: View model
extension TemplateUserProfilePresence: Identifiable {
var id: Self { self }
enum TemplateUserProfileStateAction {
case viewAction(TemplateUserProfileViewAction)
case updatePresence(TemplateUserProfilePresence)
}
enum TemplateUserProfileViewModelResult {
case cancel
case done
}
// MARK: View
struct TemplateUserProfileViewState: BindableState {
let avatar: AvatarInputProtocol?
let displayName: String?
var presence: TemplateUserProfilePresence
var count: Int
}
enum TemplateUserProfileViewAction {
case incrementCount
case decrementCount
case cancel
case done
}

View File

@@ -17,8 +17,6 @@
import SwiftUI
import Combine
@available(iOS 14, *)
typealias TemplateUserProfileViewModelType = StateStoreViewModel<TemplateUserProfileViewState,
TemplateUserProfileStateAction,

View File

@@ -1,23 +1,27 @@
/*
Copyright 2021 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
import UIKit
import SwiftUI
struct TemplateRoomChatCoordinatorParameters {
let room: MXRoom
}
final class TemplateRoomChatCoordinator: Coordinator, Presentable {
// MARK: - Properties

View File

@@ -1,21 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
struct TemplateRoomChatCoordinatorParameters {
let room: MXRoom
}

View File

@@ -17,7 +17,6 @@
import Foundation
import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)

View File

@@ -1,26 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// Represents a grouped bubble in the View(For example multiple message of different time sent close together).
struct TemplateRoomChatBubble {
let id: String
let sender: TemplateRoomChatMember
var items: [TemplateRoomChatBubbleItem]
}
extension TemplateRoomChatBubble: Identifiable, Equatable { }

View File

@@ -1,24 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import UIKit
/// An image sent as a message.
struct TemplateRoomChatMessageImageContent {
var image: UIImage
}
extension TemplateRoomChatMessageImageContent: Equatable { }

View File

@@ -1,28 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import UIKit
/// One of the items grouped within a bubble(could be message types like text, image or video, or could be other items like url previews).
struct TemplateRoomChatBubbleItem {
let id: String
var timestamp: Date
var content: TemplateRoomChatBubbleItemContent
}
extension TemplateRoomChatBubbleItem: Identifiable, Equatable { }

View File

@@ -1,23 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
enum TemplateRoomChatBubbleItemContent {
case message(TemplateRoomChatMessageContent)
}
extension TemplateRoomChatBubbleItemContent: Equatable { }

View File

@@ -1,36 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// A user who is a member of the room.
struct TemplateRoomChatMember {
let id: String
let avatarUrl: String?
let displayName: String?
}
extension TemplateRoomChatMember: Avatarable {
var mxContentUri: String? {
avatarUrl
}
var matrixItemId: String {
id
}
}
extension TemplateRoomChatMember: Identifiable, Equatable {}

View File

@@ -1,27 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// A chat message send to the timeline within a room.
struct TemplateRoomChatMessage {
let id: String
let content: TemplateRoomChatMessageContent
let sender: TemplateRoomChatMember
let timestamp: Date
}
extension TemplateRoomChatMessage: Identifiable {}

View File

@@ -1,25 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// The type of message a long with it's content.
enum TemplateRoomChatMessageContent {
case text(TemplateRoomChatMessageTextContent)
case image(TemplateRoomChatMessageImageContent)
}
extension TemplateRoomChatMessageContent: Equatable { }

View File

@@ -1,25 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// The text content of a message sent by a user.
struct TemplateRoomChatMessageTextContent {
var body: String
}
extension TemplateRoomChatMessageTextContent: Equatable { }

View File

@@ -1,23 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
enum TemplateRoomChatRoomInitializationStatus {
case notInitialized
case initialized
case failedToInitialize
}

View File

@@ -1,24 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// Actions to be performed on the `ViewModel` State
enum TemplateRoomChatStateAction {
case updateRoomInitializationStatus(TemplateRoomChatRoomInitializationStatus)
case updateBubbles([TemplateRoomChatBubble])
case clearMessageInput
}

View File

@@ -1,23 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// Actions send from the `View` to the `ViewModel`.
enum TemplateRoomChatViewAction {
case sendMessage
case done
}

View File

@@ -1,22 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// Actions sent by the `ViewModel` to the `Coordinator`
enum TemplateRoomChatViewModelAction {
case done
}

View File

@@ -1,22 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// State bound directly to SwiftUI elements.
struct TemplateRoomChatViewModelBindings {
var messageInput: String
}

View File

@@ -1,32 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// State managed by the `ViewModel` delivered to the `View`.
struct TemplateRoomChatViewState: BindableState {
var roomInitializationStatus: TemplateRoomChatRoomInitializationStatus
let roomName: String?
var bubbles: [TemplateRoomChatBubble]
var bindings: TemplateRoomChatViewModelBindings
}
extension TemplateRoomChatViewState {
var sendButtonEnabled: Bool {
!bindings.messageInput.isEmpty
}
}

View File

@@ -0,0 +1,122 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import UIKit
// MARK: - Coordinator
/// An image sent as a message.
struct TemplateRoomChatMessageImageContent: Equatable {
var image: UIImage
}
/// The text content of a message sent by a user.
struct TemplateRoomChatMessageTextContent: Equatable {
var body: String
}
/// The type of message a long with it's content.
enum TemplateRoomChatMessageContent: Equatable {
case text(TemplateRoomChatMessageTextContent)
case image(TemplateRoomChatMessageImageContent)
}
enum TemplateRoomChatBubbleItemContent: Equatable {
case message(TemplateRoomChatMessageContent)
}
/// One of the items grouped within a bubble(could be message types like text, image or video, or could be other items like url previews).
struct TemplateRoomChatBubbleItem: Identifiable, Equatable {
let id: String
var timestamp: Date
var content: TemplateRoomChatBubbleItemContent
}
/// A user who is a member of the room.
struct TemplateRoomChatMember: Identifiable, Equatable, Avatarable {
let id: String
let avatarUrl: String?
let displayName: String?
var mxContentUri: String? {
avatarUrl
}
var matrixItemId: String {
id
}
}
/// Represents a grouped bubble in the View(For example multiple message of different time sent close together).
struct TemplateRoomChatBubble: Identifiable, Equatable {
let id: String
let sender: TemplateRoomChatMember
var items: [TemplateRoomChatBubbleItem]
}
/// A chat message send to the timeline within a room.
struct TemplateRoomChatMessage: Identifiable {
let id: String
let content: TemplateRoomChatMessageContent
let sender: TemplateRoomChatMember
let timestamp: Date
}
// MARK: - View model
enum TemplateRoomChatRoomInitializationStatus {
case notInitialized
case initialized
case failedToInitialize
}
/// Actions to be performed on the `ViewModel` State
enum TemplateRoomChatStateAction {
case updateRoomInitializationStatus(TemplateRoomChatRoomInitializationStatus)
case updateBubbles([TemplateRoomChatBubble])
case clearMessageInput
}
/// Actions sent by the `ViewModel` to the `Coordinator`
enum TemplateRoomChatViewModelAction {
case done
}
// MARK: - View
/// Actions send from the `View` to the `ViewModel`.
enum TemplateRoomChatViewAction {
case sendMessage
case done
}
/// State managed by the `ViewModel` delivered to the `View`.
struct TemplateRoomChatViewState: BindableState {
var roomInitializationStatus: TemplateRoomChatRoomInitializationStatus
let roomName: String?
var bubbles: [TemplateRoomChatBubble]
var bindings: TemplateRoomChatViewModelBindings
var sendButtonEnabled: Bool {
!bindings.messageInput.isEmpty
}
}
/// State bound directly to SwiftUI elements.
struct TemplateRoomChatViewModelBindings {
var messageInput: String
}

View File

@@ -1,23 +1,27 @@
/*
Copyright 2021 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
import UIKit
import SwiftUI
struct TemplateRoomListCoordinatorParameters {
let session: MXSession
}
final class TemplateRoomListCoordinator: Coordinator, Presentable {
// MARK: - Properties

View File

@@ -1,21 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
struct TemplateRoomListCoordinatorParameters {
let session: MXSession
}

View File

@@ -1,23 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// Actions returned by the coordinator callback
enum TemplateRoomListCoordinatorAction {
case didSelectRoom(String)
case done
}

View File

@@ -1,25 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
struct TemplateRoomListRoom {
let id: String
let avatar: AvatarInput
let displayName: String?
}
extension TemplateRoomListRoom: Identifiable, Equatable {}

View File

@@ -1,22 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// Actions to be performed on the `ViewModel` State
enum TemplateRoomListStateAction {
case updateRooms([TemplateRoomListRoom])
}

View File

@@ -1,23 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// Actions send from the `View` to the `ViewModel`.
enum TemplateRoomListViewAction {
case done
case didSelectRoom(String)
}

View File

@@ -1,23 +0,0 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
/// Actions sent by the`ViewModel` to the `Coordinator`.
enum TemplateRoomListViewModelAction {
case didSelectRoom(String)
case done
}

View File

@@ -16,7 +16,42 @@
import Foundation
// MARK: - Coordinator
struct TemplateRoomListRoom: Identifiable, Equatable {
let id: String
let avatar: AvatarInput
let displayName: String?
}
/// Actions returned by the coordinator callback
enum TemplateRoomListCoordinatorAction {
case didSelectRoom(String)
case done
}
// MARK: - View model
/// Actions to be performed on the `ViewModel` State
enum TemplateRoomListStateAction {
case updateRooms([TemplateRoomListRoom])
}
/// Actions sent by the`ViewModel` to the `Coordinator`.
enum TemplateRoomListViewModelAction {
case didSelectRoom(String)
case done
}
// MARK: - View
/// State managed by the `ViewModel` delivered to the `View`.
struct TemplateRoomListViewState: BindableState {
var rooms: [TemplateRoomListRoom]
}
/// Actions send from the `View` to the `ViewModel`.
enum TemplateRoomListViewAction {
case done
case didSelectRoom(String)
}

View File

@@ -27,8 +27,5 @@ do
perl -p -i -e "s/TemplateUserProfile/"$SCREEN_NAME"/g" $file
perl -p -i -e "s/templateUserProfile/"$SCREEN_VAR_NAME"/g" $file
echo "// $ createScreen.sh $@" | cat - ${file} > /tmp/$$ && mv /tmp/$$ ${file}
echo '// File created from SimpleUserProfileExample' | cat - ${file} > /tmp/$$ && mv /tmp/$$ ${file}
mv ${file} ${file/TemplateUserProfile/$SCREEN_NAME}
done

View File

@@ -53,9 +53,3 @@ do
mv ${file} ${file/TemplateRoomChat/$DETAIL_SCREEN_NAME}
fi
done
for file in $(find * -type f -print)
do
echo "// $ createSwiftUITwoScreen.sh $@" | cat - ${file} > /tmp/$$ && mv /tmp/$$ ${file}
echo '// File created from TemplateAdvancedRoomsExample' | cat - ${file} > /tmp/$$ && mv /tmp/$$ ${file}
done