summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2021-07-13 11:54:55 +0200
committerAndrej Mihajlov <and@mullvad.net>2021-07-19 10:49:00 +0200
commit2fa713409a2d240b470bac61689ba171f57a3831 (patch)
treefaa0acb4aca2e1cd46153af9b5f17ac36d99e743
parentfda131d31789bc0a4447ce9c6b99f5868228cf3d (diff)
downloadmullvadvpn-2fa713409a2d240b470bac61689ba171f57a3831.tar.xz
mullvadvpn-2fa713409a2d240b470bac61689ba171f57a3831.zip
UIMetrics: add section spacing metric
-rw-r--r--ios/MullvadVPN/PreferencesViewController.swift2
-rw-r--r--ios/MullvadVPN/SelectLocationHeaderView.swift2
-rw-r--r--ios/MullvadVPN/SettingsViewController.swift2
-rw-r--r--ios/MullvadVPN/UIMetrics.swift3
-rw-r--r--ios/MullvadVPN/WireguardKeysContentView.swift4
5 files changed, 8 insertions, 5 deletions
diff --git a/ios/MullvadVPN/PreferencesViewController.swift b/ios/MullvadVPN/PreferencesViewController.swift
index f895923bb3..756f44f4cc 100644
--- a/ios/MullvadVPN/PreferencesViewController.swift
+++ b/ios/MullvadVPN/PreferencesViewController.swift
@@ -35,7 +35,7 @@ class PreferencesViewController: UITableViewController, TunnelObserver {
tableView.separatorColor = .secondaryColor
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 60
- tableView.sectionHeaderHeight = UIMetrics.contentLayoutMargins.top
+ tableView.sectionHeaderHeight = UIMetrics.sectionSpacing
tableView.sectionFooterHeight = 0
tableView.dataSource = staticDataSource
diff --git a/ios/MullvadVPN/SelectLocationHeaderView.swift b/ios/MullvadVPN/SelectLocationHeaderView.swift
index c0593418d2..60a1cd75cf 100644
--- a/ios/MullvadVPN/SelectLocationHeaderView.swift
+++ b/ios/MullvadVPN/SelectLocationHeaderView.swift
@@ -22,7 +22,7 @@ class SelectLocationHeaderView: UIView {
var topLayoutMarginAdjustmentForNavigationBarTitle: CGFloat = 0 {
didSet {
- let value = UIMetrics.contentLayoutMargins.top - topLayoutMarginAdjustmentForNavigationBarTitle
+ let value = UIMetrics.sectionSpacing - topLayoutMarginAdjustmentForNavigationBarTitle
layoutMargins.top = max(value, 0)
}
}
diff --git a/ios/MullvadVPN/SettingsViewController.swift b/ios/MullvadVPN/SettingsViewController.swift
index 0735c60542..a1a32f842f 100644
--- a/ios/MullvadVPN/SettingsViewController.swift
+++ b/ios/MullvadVPN/SettingsViewController.swift
@@ -46,7 +46,7 @@ class SettingsViewController: UITableViewController, AccountObserver {
tableView.separatorColor = .secondaryColor
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 60
- tableView.sectionHeaderHeight = UIMetrics.contentLayoutMargins.top
+ tableView.sectionHeaderHeight = UIMetrics.sectionSpacing
tableView.sectionFooterHeight = 0
tableView.dataSource = staticDataSource
diff --git a/ios/MullvadVPN/UIMetrics.swift b/ios/MullvadVPN/UIMetrics.swift
index c30b44e291..9f60a35278 100644
--- a/ios/MullvadVPN/UIMetrics.swift
+++ b/ios/MullvadVPN/UIMetrics.swift
@@ -21,6 +21,9 @@ extension UIMetrics {
/// Spacing used in stack views of buttons
static var interButtonSpacing: CGFloat = 16
+ /// Spacing used between distinct sections of views
+ static var sectionSpacing: CGFloat = 24
+
/// Maximum width of the split view content container on iPad
static var maximumSplitViewContentContainerWidth: CGFloat = 810 * 0.7
diff --git a/ios/MullvadVPN/WireguardKeysContentView.swift b/ios/MullvadVPN/WireguardKeysContentView.swift
index 2db0ebf4ca..cefc662cb6 100644
--- a/ios/MullvadVPN/WireguardKeysContentView.swift
+++ b/ios/MullvadVPN/WireguardKeysContentView.swift
@@ -54,7 +54,7 @@ class WireguardKeysContentView: UIView {
let stackView = UIStackView(arrangedSubviews: [publicKeyRowView, creationRowView])
stackView.translatesAutoresizingMaskIntoConstraints = false
stackView.axis = .vertical
- stackView.spacing = UIMetrics.contentLayoutMargins.top
+ stackView.spacing = UIMetrics.sectionSpacing
return stackView
}()
@@ -79,7 +79,7 @@ class WireguardKeysContentView: UIView {
contentStackView.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor),
contentStackView.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor),
- buttonStackView.topAnchor.constraint(greaterThanOrEqualTo: contentStackView.bottomAnchor, constant: UIMetrics.contentLayoutMargins.top),
+ buttonStackView.topAnchor.constraint(greaterThanOrEqualTo: contentStackView.bottomAnchor, constant: UIMetrics.sectionSpacing),
buttonStackView.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor),
buttonStackView.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor),
buttonStackView.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor)