diff options
| author | Jon Petersson <jon.petersson@kvadrat.se> | 2024-05-30 13:20:39 +0200 |
|---|---|---|
| committer | Bug Magnet <marco.nikic@mullvad.net> | 2024-06-10 15:53:15 +0200 |
| commit | 07f86398aa977cb1770b0badf1ad609c812c9cfc (patch) | |
| tree | e416a459aedddc42d49ba2af24ec28b290eaa604 | |
| parent | 3bcde84a520e5306f2fe8a07ebf135f960e5100d (diff) | |
| download | mullvadvpn-07f86398aa977cb1770b0badf1ad609c812c9cfc.tar.xz mullvadvpn-07f86398aa977cb1770b0badf1ad609c812c9cfc.zip | |
Change and add text in content blockers information dialog
| -rw-r--r-- | ios/MullvadVPN/View controllers/Alert/AlertViewController.swift | 9 | ||||
| -rw-r--r-- | ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift | 18 |
2 files changed, 19 insertions, 8 deletions
diff --git a/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift b/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift index 64957e7098..c1003313b4 100644 --- a/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift +++ b/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift @@ -245,6 +245,15 @@ class AlertViewController: UIViewController { private func addMessage(_ message: NSAttributedString) { let label = UILabel() + let style = NSMutableParagraphStyle() + style.paragraphSpacing = 16 + style.lineBreakMode = .byWordWrapping + + let message = NSMutableAttributedString(attributedString: message) + let attributeRange = NSRange(location: 0, length: message.length) + message.removeAttribute(.paragraphStyle, range: attributeRange) + message.addAttribute(.paragraphStyle, value: style, range: attributeRange) + label.attributedText = message label.textColor = .white.withAlphaComponent(0.8) label.adjustsFontForContentSizeCategory = true diff --git a/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift b/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift index e13dffc0b7..44e25cb09a 100644 --- a/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift +++ b/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift @@ -74,11 +74,11 @@ class CustomDNSViewController: UITableViewController, VPNSettingsDataSourceDeleg isModalInPresentation = editing } - private func showInfo(with message: String) { + private func showInfo(with message: NSAttributedString) { let presentation = AlertPresentation( id: "vpn-settings-content-blockers-alert", icon: .info, - message: message, + attributedMessage: message, buttons: [ AlertAction( title: NSLocalizedString( @@ -102,23 +102,25 @@ class CustomDNSViewController: UITableViewController, VPNSettingsDataSourceDeleg } func showInfo(for item: VPNSettingsInfoButtonItem) { - var message = "" + var message = NSAttributedString() switch item { case .contentBlockers: - message = NSLocalizedString( + message = NSAttributedString(markdownString: NSLocalizedString( "VPN_SETTINGS_CONTENT_BLOCKERS_GENERAL", tableName: "ContentBlockers", value: """ When this feature is enabled it stops the device from contacting certain \ domains or websites known for distributing ads, malware, trackers and more. \ - This might cause issues on certain websites, services, and programs. + This might cause issues on certain websites, services, and apps. + + Attention: this setting cannot be used in combination with **Use custom DNS**. """, comment: "" - ) + ), options: MarkdownStylingOptions(font: .preferredFont(forTextStyle: .body))) case .blockMalware: - message = NSLocalizedString( + message = NSAttributedString(string: NSLocalizedString( "VPN_SETTINGS_CONTENT_BLOCKERS_MALWARE", tableName: "ContentBlockers", value: """ @@ -126,7 +128,7 @@ class CustomDNSViewController: UITableViewController, VPNSettingsDataSourceDeleg be treated as such, this is just an extra layer of protection. """, comment: "" - ) + )) default: assertionFailure("No matching InfoButtonItem") |
