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 be1b771463
commit 60635fc364
43 changed files with 244 additions and 692 deletions
@@ -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
@@ -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
}
@@ -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)
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -17,8 +17,6 @@
import SwiftUI
import Combine
@available(iOS 14, *)
typealias TemplateUserProfileViewModelType = StateStoreViewModel<TemplateUserProfileViewState,
TemplateUserProfileStateAction,