summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBug Magnet <marco.nikic@mullvad.net>2024-06-10 15:53:34 +0200
committerBug Magnet <marco.nikic@mullvad.net>2024-06-10 15:53:34 +0200
commit512ee0ebbfd520ac85afc7f835d4dd84a435a078 (patch)
tree19601abee78acf0178c4c68e5803d4cf986a7284
parent3bcde84a520e5306f2fe8a07ebf135f960e5100d (diff)
parente815a4848d36e60bc862233af6c7f0a913d6beca (diff)
downloadmullvadvpn-512ee0ebbfd520ac85afc7f835d4dd84a435a078.tar.xz
mullvadvpn-512ee0ebbfd520ac85afc7f835d4dd84a435a078.zip
Merge branch 'fix-many-small-bugs-ios-bugs'
-rw-r--r--ios/MullvadVPN/Coordinators/Settings/IPOverride/IPOverrideStatus.swift12
-rw-r--r--ios/MullvadVPN/Coordinators/Settings/IPOverride/IPOverrideStatusView.swift1
-rw-r--r--ios/MullvadVPN/UI appearance/UIColor+Palette.swift4
-rw-r--r--ios/MullvadVPN/View controllers/Account/AccountViewController.swift1
-rw-r--r--ios/MullvadVPN/View controllers/Alert/AlertViewController.swift9
-rw-r--r--ios/MullvadVPN/View controllers/VPNSettings/CustomDNSDataSource.swift43
-rw-r--r--ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift18
-rw-r--r--ios/MullvadVPN/View controllers/VPNSettings/VPNSettingsViewModel.swift2
8 files changed, 53 insertions, 37 deletions
diff --git a/ios/MullvadVPN/Coordinators/Settings/IPOverride/IPOverrideStatus.swift b/ios/MullvadVPN/Coordinators/Settings/IPOverride/IPOverrideStatus.swift
index 42e03e8c76..928914ae68 100644
--- a/ios/MullvadVPN/Coordinators/Settings/IPOverride/IPOverrideStatus.swift
+++ b/ios/MullvadVPN/Coordinators/Settings/IPOverride/IPOverrideStatus.swift
@@ -73,19 +73,19 @@ enum IPOverrideStatus: Equatable, CustomStringConvertible {
case .active, .noImports:
""
case let .importFailed(context):
- NSLocalizedString(
+ String(format: NSLocalizedString(
"IP_OVERRIDE_STATUS_DESCRIPTION_INACTIVE",
tableName: "IPOverride",
- value: "Import \(context.description) was unsuccessful, please try again.",
+ value: "Import %@ was unsuccessful, please try again.",
comment: ""
- )
+ ), context.description)
case let .importSuccessful(context):
- NSLocalizedString(
+ String(format: NSLocalizedString(
"IP_OVERRIDE_STATUS_DESCRIPTION_INACTIVE",
tableName: "IPOverride",
- value: "Import \(context.description) was successful, overrides are now active.",
+ value: "Import %@ was successful, overrides are now active.",
comment: ""
- )
+ ), context.description)
}
}
}
diff --git a/ios/MullvadVPN/Coordinators/Settings/IPOverride/IPOverrideStatusView.swift b/ios/MullvadVPN/Coordinators/Settings/IPOverride/IPOverrideStatusView.swift
index 9c9838b6ea..b39572c846 100644
--- a/ios/MullvadVPN/Coordinators/Settings/IPOverride/IPOverrideStatusView.swift
+++ b/ios/MullvadVPN/Coordinators/Settings/IPOverride/IPOverrideStatusView.swift
@@ -24,6 +24,7 @@ class IPOverrideStatusView: UIView {
let label = UILabel()
label.font = .systemFont(ofSize: 12, weight: .semibold)
label.textColor = .white.withAlphaComponent(0.6)
+ label.numberOfLines = 0
return label
}()
diff --git a/ios/MullvadVPN/UI appearance/UIColor+Palette.swift b/ios/MullvadVPN/UI appearance/UIColor+Palette.swift
index b702e2303c..1cbd20d21e 100644
--- a/ios/MullvadVPN/UI appearance/UIColor+Palette.swift
+++ b/ios/MullvadVPN/UI appearance/UIColor+Palette.swift
@@ -93,10 +93,10 @@ extension UIColor {
static let indentationLevelThree = UIColor(red: 0.11, green: 0.19, blue: 0.29, alpha: 1.0)
static let normal = indentationLevelZero
- static let disabled = normal.darkened(by: 0.3)!
+ static let disabled = normal.darkened(by: 0.1)!
static let selected = successColor
static let disabledSelected = selected.darkened(by: 0.3)!
- static let selectedAlt = normal.darkened(by: 0.2)!
+ static let selectedAlt = normal.darkened(by: 0.1)!
}
static let titleTextColor = UIColor.white
diff --git a/ios/MullvadVPN/View controllers/Account/AccountViewController.swift b/ios/MullvadVPN/View controllers/Account/AccountViewController.swift
index 30a970280b..888fcd8d05 100644
--- a/ios/MullvadVPN/View controllers/Account/AccountViewController.swift
+++ b/ios/MullvadVPN/View controllers/Account/AccountViewController.swift
@@ -197,6 +197,7 @@ class AccountViewController: UIViewController {
contentView.logoutButton.isEnabled = isInteractionEnabled
contentView.redeemVoucherButton.isEnabled = isInteractionEnabled
contentView.deleteButton.isEnabled = isInteractionEnabled
+ navigationItem.rightBarButtonItem?.isEnabled = isInteractionEnabled
view.isUserInteractionEnabled = isInteractionEnabled
isModalInPresentation = !isInteractionEnabled
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/CustomDNSDataSource.swift b/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSDataSource.swift
index 7757192b64..fc559499a0 100644
--- a/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSDataSource.swift
+++ b/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSDataSource.swift
@@ -357,9 +357,8 @@ final class CustomDNSDataSource: UITableViewDiffableDataSource<
var newSnapshot = NSDiffableDataSourceSnapshot<Section, Item>()
let oldSnapshot = snapshot()
- newSnapshot.appendSections(Section.allCases)
-
// Append sections
+ newSnapshot.appendSections(Section.allCases)
if oldSnapshot.sectionIdentifiers.contains(.contentBlockers) {
newSnapshot.appendItems(
@@ -369,7 +368,6 @@ final class CustomDNSDataSource: UITableViewDiffableDataSource<
}
// Append DNS settings
-
newSnapshot.appendItems([.useCustomDNS], toSection: .customDNS)
let dnsServerItems = viewModel.customDNSDomains.map { entry in
@@ -382,17 +380,9 @@ final class CustomDNSDataSource: UITableViewDiffableDataSource<
}
// Append/update DNS server info.
+ newSnapshot = updateDNSInfoItems(in: newSnapshot)
- if viewModel.customDNSPrecondition == .satisfied {
- newSnapshot.deleteItems([.dnsServerInfo])
- } else {
- if newSnapshot.itemIdentifiers(inSection: .customDNS).contains(.dnsServerInfo) {
- newSnapshot.reloadItems([.dnsServerInfo])
- } else {
- newSnapshot.appendItems([.dnsServerInfo], toSection: .customDNS)
- }
- }
-
+ // Apply snapshot.
applySnapshot(newSnapshot, animated: animated, completion: completion)
}
@@ -562,21 +552,32 @@ final class CustomDNSDataSource: UITableViewDiffableDataSource<
}
private func reloadDnsServerInfo() {
- var snapshot = snapshot()
-
reload(item: .useCustomDNS)
- if viewModel.customDNSPrecondition == .satisfied {
+ let snapshot = updateDNSInfoItems(in: snapshot())
+ apply(snapshot, animatingDifferences: true)
+ }
+
+ private func updateDNSInfoItems(
+ in snapshot: NSDiffableDataSourceSnapshot<Section, Item>
+ ) -> NSDiffableDataSourceSnapshot<Section, Item> {
+ var snapshot = snapshot
+
+ if snapshot.itemIdentifiers(inSection: .contentBlockers).isEmpty {
snapshot.deleteItems([.dnsServerInfo])
} else {
- if snapshot.itemIdentifiers(inSection: .customDNS).contains(.dnsServerInfo) {
- snapshot.reloadItems([.dnsServerInfo])
+ if viewModel.customDNSPrecondition == .satisfied {
+ snapshot.deleteItems([.dnsServerInfo])
} else {
- snapshot.appendItems([.dnsServerInfo], toSection: .customDNS)
+ if snapshot.itemIdentifiers(inSection: .customDNS).contains(.dnsServerInfo) {
+ snapshot.reloadItems([.dnsServerInfo])
+ } else {
+ snapshot.appendItems([.dnsServerInfo], toSection: .customDNS)
+ }
}
}
- apply(snapshot, animatingDifferences: true)
+ return snapshot
}
private func configureContentBlockersHeader(_ header: SettingsHeaderView) {
@@ -602,8 +603,10 @@ final class CustomDNSDataSource: UITableViewDiffableDataSource<
if headerView.isExpanded {
snapshot.deleteItems(Item.contentBlockers)
+ snapshot.deleteItems([.dnsServerInfo])
} else {
snapshot.appendItems(Item.contentBlockers, toSection: .contentBlockers)
+ snapshot.appendItems([.dnsServerInfo])
}
headerView.isExpanded.toggle()
diff --git a/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift b/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift
index e13dffc0b7..df109d3ff3 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")
diff --git a/ios/MullvadVPN/View controllers/VPNSettings/VPNSettingsViewModel.swift b/ios/MullvadVPN/View controllers/VPNSettings/VPNSettingsViewModel.swift
index 36c9e080d3..3dc119362e 100644
--- a/ios/MullvadVPN/View controllers/VPNSettings/VPNSettingsViewModel.swift
+++ b/ios/MullvadVPN/View controllers/VPNSettings/VPNSettingsViewModel.swift
@@ -66,7 +66,7 @@ enum CustomDNSPrecondition {
string: NSLocalizedString(
"CUSTOM_DNS_DISABLE_CONTENT_BLOCKERS_FOOTNOTE",
tableName: "VPNSettings",
- value: "Disable all content blockers (under VPN settings) to activate this setting.",
+ value: "Disable all content blockers to activate this setting.",
comment: """
Foot note displayed when custom DNS cannot be enabled, because content blockers should be \
disabled first.