diff options
| author | Steffen Ernst <steffen.ernst@mullvad.net> | 2025-05-12 10:17:44 +0200 |
|---|---|---|
| committer | Steffen Ernst <steffen.ernst@mullvad.net> | 2025-05-20 15:46:45 +0200 |
| commit | f88e1464d8727b86bf0e36e25c6e1a2ad26e0230 (patch) | |
| tree | 215cdb6ba5f3055bf5c971093e61c77b1aa9addd | |
| parent | 397f55daac1787505958a6aa595639bb5eef9de0 (diff) | |
| download | mullvadvpn-f88e1464d8727b86bf0e36e25c6e1a2ad26e0230.tar.xz mullvadvpn-f88e1464d8727b86bf0e36e25c6e1a2ad26e0230.zip | |
Align invalid port notification with design
| -rw-r--r-- | ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift b/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift index 193bdc95f2..43eba09131 100644 --- a/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift +++ b/ios/MullvadVPN/Notifications/Notification Providers/TunnelStatusNotificationProvider.swift @@ -140,9 +140,9 @@ final class TunnelStatusNotificationProvider: NotificationProvider, InAppNotific } private func notificationDescription(for packetTunnelError: BlockedStateReason) -> InAppNotificationDescriptor { - let button: InAppNotificationAction? = switch packetTunnelError { + let tapAction: InAppNotificationAction? = switch packetTunnelError { case .noRelaysSatisfyingPortConstraints: - InAppNotificationAction(image: UIImage.Buttons.settings) { + InAppNotificationAction { NotificationManager.shared .notificationProvider( self, @@ -160,14 +160,23 @@ final class TunnelStatusNotificationProvider: NotificationProvider, InAppNotific value: "BLOCKING INTERNET", comment: "" ), - body: .init(string: String( - format: NSLocalizedString( - "TUNNEL_BLOCKED_INAPP_NOTIFICATION_BODY", - value: localizedReasonForBlockedStateError(packetTunnelError), - comment: "" - ) - )), - button: button + body: createNotificationBody(localizedReasonForBlockedStateError(packetTunnelError)), + tapAction: tapAction + ) + } + + private func createNotificationBody(_ string: String) -> NSAttributedString { + NSAttributedString( + markdownString: NSLocalizedString( + "LATEST_CHANGES_IN_APP_NOTIFICATION_BODY", + value: string, + comment: "" + ), + options: MarkdownStylingOptions(font: UIFont.preferredFont(forTextStyle: .body)), + applyEffect: { markdownType, _ in + guard case .bold = markdownType else { return [:] } + return [.foregroundColor: UIColor.InAppNotificationBanner.titleColor] + } ) } @@ -267,7 +276,7 @@ final class TunnelStatusNotificationProvider: NotificationProvider, InAppNotific case .noRelaysSatisfyingConstraints: errorString = "No servers match your settings, try changing server or other settings." case .noRelaysSatisfyingPortConstraints: - errorString = "The selected WireGuard port is not supported, please change it under VPN settings." + errorString = "The selected WireGuard port is not supported, please change it under **VPN settings**." case .invalidAccount: errorString = "You are logged in with an invalid account number. Please log out and try another one." case .deviceLoggedOut: |
