diff options
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) { |
