diff options
| author | Bug Magnet <marco.nikic@mullvad.net> | 2023-11-09 10:23:20 +0100 |
|---|---|---|
| committer | Bug Magnet <marco.nikic@mullvad.net> | 2023-11-09 10:23:20 +0100 |
| commit | af72aa8df63ce8c0ef1d7dd30b9281e4b967c090 (patch) | |
| tree | bb237f3608de0916575a2b912db4ae681a8124fc | |
| parent | bb568e8ab729ef373fff768eff250a13b0cc8006 (diff) | |
| parent | 015f7bf81f54697e49aad6a8c58bd04ab2375ef8 (diff) | |
| download | mullvadvpn-af72aa8df63ce8c0ef1d7dd30b9281e4b967c090.tar.xz mullvadvpn-af72aa8df63ce8c0ef1d7dd30b9281e4b967c090.zip | |
Merge branch 'expired-account-should-always-show-out-of-time-view-ios-374'
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 |
