diff options
3 files changed, 13 insertions, 7 deletions
diff --git a/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift b/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift index f5fce3f250..af0a8f8e47 100644 --- a/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift +++ b/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift @@ -781,9 +781,17 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo private func addTunnelObserver() { let tunnelObserver = - TunnelBlockObserver(didUpdateDeviceState: { [weak self] _, deviceState, previousDeviceState in - self?.deviceStateDidChange(deviceState, previousDeviceState: previousDeviceState) - }) + TunnelBlockObserver( + didUpdateTunnelStatus: { [weak self] _, tunnelStatus in + if case let .error(observedState) = tunnelStatus.observedState, + observedState.reason == .accountExpired { + self?.router.present(.outOfTime) + } + }, + didUpdateDeviceState: { [weak self] _, deviceState, previousDeviceState in + self?.deviceStateDidChange(deviceState, previousDeviceState: previousDeviceState) + } + ) tunnelManager.addObserver(tunnelObserver) diff --git a/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift b/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift index 300de34ad7..f87b35c45b 100644 --- a/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift +++ b/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift @@ -57,7 +57,7 @@ final class TunnelStatusNotificationProvider: NotificationProvider, InAppNotific private func handleTunnelStatus(_ tunnelStatus: TunnelStatus) { let invalidateForTunnelError: Bool - if case let .error(blockStateReason) = tunnelStatus.state { + if case let .error(blockStateReason) = tunnelStatus.state, blockStateReason != .accountExpired { invalidateForTunnelError = updateLastTunnelError(blockStateReason) } else { invalidateForTunnelError = updateLastTunnelError(nil) @@ -231,8 +231,6 @@ final class TunnelStatusNotificationProvider: NotificationProvider, InAppNotific errorString = "No servers match your settings, try changing server or other settings." case .invalidAccount: errorString = "You are logged in with an invalid account number. Please log out and try another one." - case .accountExpired: - errorString = "Account is out of time." case .deviceRevoked, .deviceLoggedOut: errorString = "Unable to authenticate account. Please log out and log back in." default: diff --git a/ios/MullvadVPN/TunnelManager/TunnelState.swift b/ios/MullvadVPN/TunnelManager/TunnelState.swift index 877046cac8..fd013ece4c 100644 --- a/ios/MullvadVPN/TunnelManager/TunnelState.swift +++ b/ios/MullvadVPN/TunnelManager/TunnelState.swift @@ -99,7 +99,7 @@ enum TunnelState: Equatable, CustomStringConvertible { var isSecured: Bool { switch self { - case .reconnecting, .connecting, .connected, .waitingForConnectivity(.noConnection): + case .reconnecting, .connecting, .connected, .waitingForConnectivity(.noConnection), .error(.accountExpired): return true case .pendingReconnect, .disconnecting, .disconnected, .waitingForConnectivity(.noNetwork), .error: return false |
