diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2023-05-16 16:32:27 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2023-05-30 11:17:29 +0200 |
| commit | 4454c2ab9b231827c2757671fad39f28d9541940 (patch) | |
| tree | 505a6ce8bdd882a9959c8dfb4499a29479956b0a | |
| parent | 95f798bd2bba1a89722863564c65076417df500f (diff) | |
| download | mullvadvpn-4454c2ab9b231827c2757671fad39f28d9541940.tar.xz mullvadvpn-4454c2ab9b231827c2757671fad39f28d9541940.zip | |
UIMetrics: add severity indicator size
| -rw-r--r-- | ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift | 9 | ||||
| -rw-r--r-- | ios/MullvadVPN/UI appearance/UIMetrics.swift | 17 |
2 files changed, 8 insertions, 18 deletions
diff --git a/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift b/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift index 07d969cd62..cd21881a7c 100644 --- a/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift +++ b/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift @@ -9,9 +9,6 @@ import UIKit final class NotificationBannerView: UIView { - private static let indicatorViewSize = CGSize(width: 12, height: 12) - private static let buttonSize = CGSize(width: 18, height: 18) - private let backgroundView = UIVisualEffectView(effect: UIBlurEffect(style: .dark)) private let titleLabel: UILabel = { @@ -43,7 +40,7 @@ final class NotificationBannerView: UIView { private let indicatorView: UIView = { let view = UIView() view.backgroundColor = .dangerColor - view.layer.cornerRadius = NotificationBannerView.indicatorViewSize.width * 0.5 + view.layer.cornerRadius = UIMetrics.inAppBannerSeverityIndicatorSize.width * 0.5 view.layer.cornerCurve = .circular return view }() @@ -119,8 +116,8 @@ final class NotificationBannerView: UIView { NSLayoutConstraint.activate([ indicatorView.bottomAnchor.constraint(equalTo: titleLabel.firstBaselineAnchor), indicatorView.leadingAnchor.constraint(equalTo: wrapperView.layoutMarginsGuide.leadingAnchor), - indicatorView.widthAnchor.constraint(equalToConstant: Self.indicatorViewSize.width), - indicatorView.heightAnchor.constraint(equalToConstant: Self.indicatorViewSize.height), + indicatorView.widthAnchor.constraint(equalToConstant: UIMetrics.inAppBannerSeverityIndicatorSize.width), + indicatorView.heightAnchor.constraint(equalToConstant: UIMetrics.inAppBannerSeverityIndicatorSize.height), titleLabel.topAnchor.constraint(equalTo: wrapperView.layoutMarginsGuide.topAnchor), titleLabel.leadingAnchor.constraint(equalToSystemSpacingAfter: indicatorView.trailingAnchor, multiplier: 1), diff --git a/ios/MullvadVPN/UI appearance/UIMetrics.swift b/ios/MullvadVPN/UI appearance/UIMetrics.swift index 9f7d91153f..c5d6be6031 100644 --- a/ios/MullvadVPN/UI appearance/UIMetrics.swift +++ b/ios/MullvadVPN/UI appearance/UIMetrics.swift @@ -22,20 +22,10 @@ extension UIMetrics { static let rowViewLayoutMargins = NSDirectionalEdgeInsets(top: 16, leading: 24, bottom: 16, trailing: 24) /// Common layout margins for settings cell presentation - static let settingsCellLayoutMargins = NSDirectionalEdgeInsets( - top: 16, - leading: 24, - bottom: 16, - trailing: 12 - ) + static let settingsCellLayoutMargins = NSDirectionalEdgeInsets(top: 16, leading: 24, bottom: 16, trailing: 12) /// Common layout margins for location cell presentation - static let selectLocationCellLayoutMargins = NSDirectionalEdgeInsets( - top: 16, - leading: 28, - bottom: 16, - trailing: 12 - ) + static let selectLocationCellLayoutMargins = NSDirectionalEdgeInsets(top: 16, leading: 28, bottom: 16, trailing: 12) /// Common cell indentation width static let cellIndentationWidth: CGFloat = 16 @@ -48,6 +38,9 @@ extension UIMetrics { trailing: 24 ) + /// Size of little round indicator presented in in-app notification banner. + static let inAppBannerSeverityIndicatorSize = CGSize(width: 12, height: 12) + /// Spacing used in stack views of buttons static let interButtonSpacing: CGFloat = 16 |
