mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-03 14:46:56 +02:00
Added unit tests
This commit is contained in:
+19
-1
@@ -22,7 +22,8 @@ enum UserSessionDetailsViewModelResult {
|
||||
enum UserSessionDetailsViewAction {
|
||||
}
|
||||
|
||||
struct UserSessionDetailsViewState: BindableState {
|
||||
struct UserSessionDetailsViewState: BindableState, Equatable {
|
||||
|
||||
let sections: [UserSessionDetailsSectionViewData]
|
||||
}
|
||||
|
||||
@@ -38,3 +39,20 @@ struct UserSessionDetailsSectionItemViewData: Identifiable {
|
||||
let title: String
|
||||
let value: String
|
||||
}
|
||||
|
||||
extension UserSessionDetailsSectionViewData: Equatable {
|
||||
|
||||
static func == (lhs: UserSessionDetailsSectionViewData, rhs: UserSessionDetailsSectionViewData) -> Bool {
|
||||
lhs.header == rhs.header &&
|
||||
lhs.footer == rhs.footer &&
|
||||
lhs.items == rhs.items
|
||||
}
|
||||
}
|
||||
|
||||
extension UserSessionDetailsSectionItemViewData: Equatable {
|
||||
|
||||
static func == (lhs: UserSessionDetailsSectionItemViewData, rhs: UserSessionDetailsSectionItemViewData) -> Bool {
|
||||
lhs.title == rhs.title &&
|
||||
lhs.value == rhs.value
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -27,9 +27,7 @@ class UserSessionDetailsViewModel: UserSessionDetailsViewModelType {
|
||||
// MARK: Private
|
||||
|
||||
// MARK: Public
|
||||
|
||||
var completion: ((UserSessionDetailsViewModelResult) -> Void)?
|
||||
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
init(userSessionInfo: UserSessionInfo) {
|
||||
|
||||
@@ -19,13 +19,6 @@
|
||||
import CommonKit
|
||||
import UIKit
|
||||
|
||||
protocol UserSessionFlowCoordinatorDelegate: AnyObject {
|
||||
// func userSessionFlowCoordinatorDidComplete(_ coordinator: UserSessionFlowCoordinatorProtocol)
|
||||
//
|
||||
// /// Called when the view has been dismissed by gesture when presented modally (not in full screen).
|
||||
// func userSessionFlowCoordinatorDidDismissInteractively(_ coordinator: UserSessionFlowCoordinatorProtocol)
|
||||
}
|
||||
|
||||
struct UserSessionFlowCoordinatorParameters {
|
||||
let session: MXSession
|
||||
let navigationRouter: NavigationRouterType
|
||||
@@ -37,40 +30,37 @@ final class UserSessionFlowCoordinator: Coordinator, Presentable {
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
|
||||
private let parameters: UserSessionFlowCoordinatorParameters
|
||||
private let userSessionDetailsViewHostingController: UIViewController
|
||||
private var userSessionDetailsViewModel: UserSessionDetailsViewModel
|
||||
|
||||
|
||||
private var navigationRouter: NavigationRouterType {
|
||||
return self.parameters.navigationRouter
|
||||
}
|
||||
|
||||
// MARK: Public
|
||||
|
||||
|
||||
// Must be used only internally
|
||||
var childCoordinators: [Coordinator] = []
|
||||
|
||||
weak var delegate: UserSessionFlowCoordinatorDelegate?
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
init(parameters: UserSessionFlowCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
// todo: builder
|
||||
let viewModel = UserSessionDetailsViewModel(userSessionInfo: parameters.userSessionInfo)
|
||||
let view = UserSessionDetailsView(viewModel: viewModel.context)
|
||||
userSessionDetailsViewModel = viewModel
|
||||
userSessionDetailsViewHostingController = VectorHostingController(rootView: view)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
func start() {
|
||||
// TODO: change to showUserSessionOverview()
|
||||
showUserSessionDetails()
|
||||
}
|
||||
}
|
||||
|
||||
private func showUserSessionOverview() {
|
||||
// TODO: PSG-690
|
||||
@@ -85,5 +75,4 @@ final class UserSessionFlowCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user