Code review fixes

This commit is contained in:
Aleksandrs Proskurins
2022-09-22 11:52:42 +03:00
parent 29220f0be8
commit 1d84f992bb
14 changed files with 178 additions and 218 deletions
@@ -21,10 +21,6 @@ struct UserSessionsOverviewCoordinatorParameters {
let session: MXSession
}
protocol UserSessionsOverviewCoordinatorDelegate: AnyObject {
func showUserSessionOverview(session: UserSessionInfo)
}
final class UserSessionsOverviewCoordinator: Coordinator, Presentable {
// MARK: - Properties
@@ -43,10 +39,8 @@ final class UserSessionsOverviewCoordinator: Coordinator, Presentable {
// Must be used only internally
var childCoordinators: [Coordinator] = []
var completion: (() -> Void)?
weak var delegate: UserSessionsOverviewCoordinatorDelegate?
var completion: ((UserSessionsOverviewCoordinatorResult) -> Void)?
// MARK: - Setup
init(parameters: UserSessionsOverviewCoordinatorParameters) {
@@ -72,8 +66,6 @@ final class UserSessionsOverviewCoordinator: Coordinator, Presentable {
guard let self = self else { return }
MXLog.debug("[UserSessionsOverviewCoordinator] UserSessionsOverviewViewModel did complete with result: \(result).")
switch result {
case .cancel:
self.completion?()
case .showAllUnverifiedSessions:
self.showAllUnverifiedSessions()
case .showAllInactiveSessions:
@@ -129,7 +121,7 @@ final class UserSessionsOverviewCoordinator: Coordinator, Presentable {
guard let sessionInfo = service.getOtherSession(sessionId: sessionId) else {
return
}
delegate?.showUserSessionOverview(session: sessionInfo)
completion?(.openSessionDetails(session: sessionInfo))
}
private func showAllOtherSessions() {
@@ -18,10 +18,13 @@ import Foundation
// MARK: - Coordinator
enum UserSessionsOverviewCoordinatorResult {
case openSessionDetails(session: UserSessionInfo)
}
// MARK: View model
enum UserSessionsOverviewViewModelResult {
case cancel
case showAllUnverifiedSessions
case showAllInactiveSessions
case verifyCurrentSession