Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix expired account UI showing blocked state instead of out of time view #5403

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadVPN/TunnelManager/TunnelState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading