diff options
| author | Steffen Ernst <steffen.ernst@mullvad.net> | 2025-05-09 15:30:03 +0200 |
|---|---|---|
| committer | Steffen Ernst <steffen.ernst@mullvad.net> | 2025-05-20 15:46:45 +0200 |
| commit | 6ee8ef671a5b0d3ea9d14e75289b333e91fda3f5 (patch) | |
| tree | 566da504f7243c779a991763897454790c320288 | |
| parent | 7d5a8f331556558727ec725bb35ac735a8d5d3f8 (diff) | |
| download | mullvadvpn-6ee8ef671a5b0d3ea9d14e75289b333e91fda3f5.tar.xz mullvadvpn-6ee8ef671a5b0d3ea9d14e75289b333e91fda3f5.zip | |
Add settings button to blocked state banner for invalid port
| -rw-r--r-- | ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift | 6 | ||||
| -rw-r--r-- | ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift | 22 |
2 files changed, 26 insertions, 2 deletions
diff --git a/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift b/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift index b68577ba14..7aa56ed588 100644 --- a/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift +++ b/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift @@ -823,6 +823,12 @@ final class ApplicationCoordinator: Coordinator, Presenting, @preconcurrency Roo updateDeviceInfo(deviceState: tunnelManager.deviceState) case .latestChangesInAppNotificationProvider: router.present(.changelog) + case .tunnelStatusNotificationProvider: + switch response.actionIdentifier { + case TunnelStatusNotificationProvider.ActionIdentifier.showVPNSettings.rawValue: + router.present(.settings(.vpnSettings)) + default: break + } default: return } } diff --git a/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift b/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift index 9325971fef..193bdc95f2 100644 --- a/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift +++ b/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift @@ -8,8 +8,13 @@ import Foundation import PacketTunnelCore +import UIKit final class TunnelStatusNotificationProvider: NotificationProvider, InAppNotificationProvider, @unchecked Sendable { + enum ActionIdentifier: String { + case showVPNSettings + } + private var isWaitingForConnectivity = false private var noNetwork = false private var packetTunnelError: BlockedStateReason? @@ -135,7 +140,19 @@ final class TunnelStatusNotificationProvider: NotificationProvider, InAppNotific } private func notificationDescription(for packetTunnelError: BlockedStateReason) -> InAppNotificationDescriptor { - InAppNotificationDescriptor( + let button: InAppNotificationAction? = switch packetTunnelError { + case .noRelaysSatisfyingPortConstraints: + InAppNotificationAction(image: UIImage.Buttons.settings) { + NotificationManager.shared + .notificationProvider( + self, + didReceiveAction: "\(ActionIdentifier.showVPNSettings)" + ) + } + default: + nil + } + return InAppNotificationDescriptor( identifier: identifier, style: .error, title: NSLocalizedString( @@ -149,7 +166,8 @@ final class TunnelStatusNotificationProvider: NotificationProvider, InAppNotific value: localizedReasonForBlockedStateError(packetTunnelError), comment: "" ) - )) + )), + button: button ) } |
