summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@mullvad.net>2025-10-16 16:28:19 +0200
committerJon Petersson <jon.petersson@mullvad.net>2025-10-21 11:08:48 +0200
commitd928db0e1f874250331a4d072a18affba5a99b2c (patch)
tree6994e7f69695c3defb775c83a63bc26556a5a4e9
parent073743db9ccd1b28a8ebc71a0541fa63f1f092f2 (diff)
downloadmullvadvpn-d928db0e1f874250331a4d072a18affba5a99b2c.tar.xz
mullvadvpn-d928db0e1f874250331a4d072a18affba5a99b2c.zip
Make settings cell details stack vertically when strings are long
-rw-r--r--ios/MullvadVPN/View controllers/Settings/SettingsCellFactory.swift24
-rw-r--r--ios/MullvadVPN/View controllers/Settings/SettingsInteractor.swift2
-rw-r--r--ios/MullvadVPN/View controllers/Settings/SettingsViewController.swift6
3 files changed, 27 insertions, 5 deletions
diff --git a/ios/MullvadVPN/View controllers/Settings/SettingsCellFactory.swift b/ios/MullvadVPN/View controllers/Settings/SettingsCellFactory.swift
index 1b1929a43d..a1ce1f9daa 100644
--- a/ios/MullvadVPN/View controllers/Settings/SettingsCellFactory.swift
+++ b/ios/MullvadVPN/View controllers/Settings/SettingsCellFactory.swift
@@ -14,12 +14,20 @@ final class SettingsCellFactory: @preconcurrency CellFactoryProtocol {
let tableView: UITableView
var viewModel: SettingsViewModel
private let interactor: SettingsInteractor
+ private var contentSizeCategory = UIApplication.shared.preferredContentSizeCategory
init(tableView: UITableView, interactor: SettingsInteractor) {
self.tableView = tableView
self.interactor = interactor
viewModel = SettingsViewModel(from: interactor.tunnelSettings)
+
+ NotificationCenter.default.addObserver(
+ self,
+ selector: #selector(preferredContentSizeChanged(_:)),
+ name: UIContentSizeCategory.didChangeNotification,
+ object: nil
+ )
}
func makeCell(for item: SettingsDataSource.Item, indexPath: IndexPath) -> UITableViewCell {
@@ -31,7 +39,7 @@ final class SettingsCellFactory: @preconcurrency CellFactoryProtocol {
withIdentifier: item.reuseIdentifier.rawValue
)
?? SettingsCell(
- style: item.reuseIdentifier.cellStyle,
+ style: contentSizeCategory.isLarge ? .subtitle : item.reuseIdentifier.cellStyle,
reuseIdentifier: item.reuseIdentifier.rawValue
)
@@ -117,4 +125,18 @@ final class SettingsCellFactory: @preconcurrency CellFactoryProtocol {
cell.disclosureType = .chevron
}
}
+
+ @objc private func preferredContentSizeChanged(_ notification: Notification) {
+ if let newContentSizeCategory = notification.userInfo?[UIContentSizeCategory.newValueUserInfoKey]
+ as? UIContentSizeCategory
+ {
+ contentSizeCategory = newContentSizeCategory
+ }
+ }
+}
+
+private extension UIContentSizeCategory {
+ var isLarge: Bool {
+ (self > .extraExtraExtraLarge) || (self > .accessibilityLarge)
+ }
}
diff --git a/ios/MullvadVPN/View controllers/Settings/SettingsInteractor.swift b/ios/MullvadVPN/View controllers/Settings/SettingsInteractor.swift
index 7509bf5215..aeb413e4b2 100644
--- a/ios/MullvadVPN/View controllers/Settings/SettingsInteractor.swift
+++ b/ios/MullvadVPN/View controllers/Settings/SettingsInteractor.swift
@@ -6,9 +6,9 @@
// Copyright © 2025 Mullvad VPN AB. All rights reserved.
//
-import Foundation
import MullvadREST
import MullvadSettings
+import UIKit
final class SettingsInteractor {
private let tunnelManager: TunnelManager
diff --git a/ios/MullvadVPN/View controllers/Settings/SettingsViewController.swift b/ios/MullvadVPN/View controllers/Settings/SettingsViewController.swift
index 778c9faf0c..e6d76452c9 100644
--- a/ios/MullvadVPN/View controllers/Settings/SettingsViewController.swift
+++ b/ios/MullvadVPN/View controllers/Settings/SettingsViewController.swift
@@ -60,12 +60,12 @@ class SettingsViewController: UITableViewController {
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 60
- dataSource = SettingsDataSource(tableView: tableView, interactor: interactor)
- dataSource?.delegate = self
-
interactor.didUpdateSettings = { [weak self] in
self?.dataSource?.reload()
}
+
+ dataSource = SettingsDataSource(tableView: tableView, interactor: interactor)
+ dataSource?.delegate = self
}
override func viewWillAppear(_ animated: Bool) {