summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@mullvad.net>2026-01-07 15:15:10 +0100
committerJon Petersson <jon.petersson@mullvad.net>2026-01-08 15:51:39 +0100
commit2bea18a097ceca6e3768fd0ba0441b03a1c6239b (patch)
treeade1d51be7ce6241ed74e239fe02222bcda78cdd
parent390dad5aeeb21be8771bf1666a6c65284bb782d6 (diff)
downloadmullvadvpn-2bea18a097ceca6e3768fd0ba0441b03a1c6239b.tar.xz
mullvadvpn-2bea18a097ceca6e3768fd0ba0441b03a1c6239b.zip
Change the edit nav button in DNS settings to be a button
-rw-r--r--ios/MullvadVPN/View controllers/VPNSettings/CustomDNSDataSource.swift6
-rw-r--r--ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift43
2 files changed, 41 insertions, 8 deletions
diff --git a/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSDataSource.swift b/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSDataSource.swift
index 886f6016e5..80a2e3e5bd 100644
--- a/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSDataSource.swift
+++ b/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSDataSource.swift
@@ -301,7 +301,11 @@ final class CustomDNSDataSource: UITableViewDiffableDataSource<
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
- 0
+ if snapshot().itemIdentifiers.contains(.dnsServerInfo) {
+ 0
+ } else {
+ 16
+ }
}
func tableView(
diff --git a/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift b/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift
index e651ee53c5..d9a4893325 100644
--- a/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift
+++ b/ios/MullvadVPN/View controllers/VPNSettings/CustomDNSViewController.swift
@@ -13,6 +13,7 @@ class CustomDNSViewController: UITableViewController {
private let interactor: VPNSettingsInteractor
private var dataSource: CustomDNSDataSource?
private let alertPresenter: AlertPresenter
+ private let editButton = AppButton(style: .default)
override var preferredStatusBarStyle: UIStatusBarStyle {
.lightContent
@@ -39,17 +40,28 @@ class CustomDNSViewController: UITableViewController {
tableView.estimatedRowHeight = 60
tableView.estimatedSectionHeaderHeight = tableView.estimatedRowHeight
+ let footerView = UIView(
+ frame: .init(
+ x: 0,
+ y: 0,
+ width: tableView.frame.width,
+ height: UIMetrics.Button.minimumTappableAreaSize.height
+ ))
+ footerView.addConstrainedSubviews([editButton]) {
+ editButton.pinEdgesToSuperview(
+ .init([
+ .top(0),
+ .leading(UIMetrics.contentInsets.left),
+ .bottom(0),
+ .trailing(UIMetrics.contentInsets.right),
+ ]))
+ }
+ tableView.tableFooterView = footerView
+
dataSource = CustomDNSDataSource(tableView: tableView)
dataSource?.delegate = self
navigationItem.title = NSLocalizedString("DNS settings", comment: "")
- if navigationItem.rightBarButtonItem != nil {
- navigationItem.leftBarButtonItem = editButtonItem
- navigationItem.leftBarButtonItem?.setAccessibilityIdentifier(.dnsSettingsEditButton)
- } else {
- navigationItem.rightBarButtonItem = editButtonItem
- navigationItem.rightBarButtonItem?.setAccessibilityIdentifier(.dnsSettingsEditButton)
- }
interactor.tunnelSettingsDidChange = { [weak self] newSettings in
self?.dataSource?.update(from: newSettings)
@@ -61,6 +73,10 @@ class CustomDNSViewController: UITableViewController {
origin: .zero,
size: CGSize(width: 0, height: UIMetrics.TableView.emptyHeaderHeight)
))
+
+ editButton.setAccessibilityIdentifier(.dnsSettingsEditButton)
+ editButton.addTarget(self, action: #selector(didPressEditButton), for: .touchUpInside)
+ setEditButtonTitle()
}
override func setEditing(_ editing: Bool, animated: Bool) {
@@ -77,6 +93,19 @@ class CustomDNSViewController: UITableViewController {
isModalInPresentation = editing
}
+ @objc private func didPressEditButton() {
+ setEditing(!isEditing, animated: true)
+ setEditButtonTitle()
+ }
+
+ private func setEditButtonTitle() {
+ if isEditing {
+ editButton.setTitle(NSLocalizedString("Done", comment: ""), for: .normal)
+ } else {
+ editButton.setTitle(NSLocalizedString("Edit", comment: ""), for: .normal)
+ }
+ }
+
private func showInfo(with message: NSAttributedString) {
let presentation = AlertPresentation(
id: "vpn-settings-content-blockers-alert",