mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Switch to a custom HomeserverReachability instead of different publishers
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@ import SwiftUI
|
||||
|
||||
struct SecureBackupLogoutConfirmationScreenCoordinatorParameters {
|
||||
let secureBackupController: SecureBackupControllerProtocol
|
||||
let homeserverReachabilityPublisher: CurrentValuePublisher<NetworkMonitorReachability, Never>
|
||||
let homeserverReachabilityPublisher: CurrentValuePublisher<HomeserverReachability, Never>
|
||||
}
|
||||
|
||||
enum SecureBackupLogoutConfirmationScreenCoordinatorAction {
|
||||
|
||||
+4
-4
@@ -13,7 +13,7 @@ typealias SecureBackupLogoutConfirmationScreenViewModelType = StateStoreViewMode
|
||||
|
||||
class SecureBackupLogoutConfirmationScreenViewModel: SecureBackupLogoutConfirmationScreenViewModelType, SecureBackupLogoutConfirmationScreenViewModelProtocol {
|
||||
private let secureBackupController: SecureBackupControllerProtocol
|
||||
private let homeserverReachabilityPublisher: CurrentValuePublisher<NetworkMonitorReachability, Never>
|
||||
private let homeserverReachabilityPublisher: CurrentValuePublisher<HomeserverReachability, Never>
|
||||
|
||||
private let backupUploadStateSubject: CurrentValueSubject<SecureBackupSteadyState, Never> = .init(.waiting)
|
||||
|
||||
@@ -28,7 +28,7 @@ class SecureBackupLogoutConfirmationScreenViewModel: SecureBackupLogoutConfirmat
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(secureBackupController: SecureBackupControllerProtocol, homeserverReachabilityPublisher: CurrentValuePublisher<NetworkMonitorReachability, Never>) {
|
||||
init(secureBackupController: SecureBackupControllerProtocol, homeserverReachabilityPublisher: CurrentValuePublisher<HomeserverReachability, Never>) {
|
||||
self.secureBackupController = secureBackupController
|
||||
self.homeserverReachabilityPublisher = homeserverReachabilityPublisher
|
||||
|
||||
@@ -90,7 +90,7 @@ class SecureBackupLogoutConfirmationScreenViewModel: SecureBackupLogoutConfirmat
|
||||
}
|
||||
}
|
||||
|
||||
private func updateMode(backupState: SecureBackupSteadyState, reachability: NetworkMonitorReachability) {
|
||||
private func updateMode(backupState: SecureBackupSteadyState, reachability: HomeserverReachability) {
|
||||
switch (backupState, reachability) {
|
||||
case (.waiting, .reachable):
|
||||
state.mode = .waitingToStart(hasStalled: false)
|
||||
@@ -101,7 +101,7 @@ class SecureBackupLogoutConfirmationScreenViewModel: SecureBackupLogoutConfirmat
|
||||
break // Nothing to do here, it will be handled with the result.
|
||||
case (.done, .reachable):
|
||||
state.mode = .backupOngoing(progress: 1.0)
|
||||
case (_, .unreachable):
|
||||
case (_, .unreachable), (_, .suspended):
|
||||
state.mode = .offline
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ struct SecureBackupLogoutConfirmationScreen_Previews: PreviewProvider, TestableP
|
||||
return .success(())
|
||||
}
|
||||
|
||||
let reachability: NetworkMonitorReachability = mode == .offline ? .unreachable : .reachable
|
||||
let reachability: HomeserverReachability = mode == .offline ? .unreachable : .reachable
|
||||
|
||||
let viewModel = SecureBackupLogoutConfirmationScreenViewModel(secureBackupController: secureBackupController,
|
||||
homeserverReachabilityPublisher: .init(reachability))
|
||||
|
||||
Reference in New Issue
Block a user