From eb32396b0adcb0b60c8181c807f2a18ba9de66e4 Mon Sep 17 00:00:00 2001 From: Jon Petersson Date: Mon, 16 Oct 2023 14:46:14 +0200 Subject: [PATCH] Add blocked state due to account expiration --- .../TunnelStatusNotificationProvider.swift | 2 ++ .../PacketTunnelProvider/DeviceCheck+BlockedStateReason.swift | 4 ++++ ios/PacketTunnelCore/Actor/State+Extensions.swift | 4 ++-- ios/PacketTunnelCore/Actor/State.swift | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift b/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift index d36c41303cba..8e4fcf289706 100644 --- a/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift +++ b/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift @@ -231,6 +231,8 @@ 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/PacketTunnel/PacketTunnelProvider/DeviceCheck+BlockedStateReason.swift b/ios/PacketTunnel/PacketTunnelProvider/DeviceCheck+BlockedStateReason.swift index f6c2d28c1d20..8ff50cba8304 100644 --- a/ios/PacketTunnel/PacketTunnelProvider/DeviceCheck+BlockedStateReason.swift +++ b/ios/PacketTunnel/PacketTunnelProvider/DeviceCheck+BlockedStateReason.swift @@ -20,6 +20,10 @@ extension DeviceCheck { return .deviceRevoked } + if case .expired = accountVerdict { + return .accountExpired + } + return nil } } diff --git a/ios/PacketTunnelCore/Actor/State+Extensions.swift b/ios/PacketTunnelCore/Actor/State+Extensions.swift index 66583b13b4bd..402938da8f78 100644 --- a/ios/PacketTunnelCore/Actor/State+Extensions.swift +++ b/ios/PacketTunnelCore/Actor/State+Extensions.swift @@ -105,8 +105,8 @@ extension BlockedStateReason { case .deviceLocked: return true - case .noRelaysSatisfyingConstraints, .readSettings, .invalidAccount, .deviceRevoked, .tunnelAdapter, .unknown, - .deviceLoggedOut, .outdatedSchema, .invalidRelayPublicKey: + case .noRelaysSatisfyingConstraints, .readSettings, .invalidAccount, .accountExpired, .deviceRevoked, + .tunnelAdapter, .unknown, .deviceLoggedOut, .outdatedSchema, .invalidRelayPublicKey: return false } } diff --git a/ios/PacketTunnelCore/Actor/State.swift b/ios/PacketTunnelCore/Actor/State.swift index 943cb0317b12..0ae7b22de1d4 100644 --- a/ios/PacketTunnelCore/Actor/State.swift +++ b/ios/PacketTunnelCore/Actor/State.swift @@ -177,6 +177,9 @@ public enum BlockedStateReason: String, Codable, Equatable { /// Invalid account. case invalidAccount + /// Account is expired. + case accountExpired + /// Device revoked. case deviceRevoked