diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2023-05-23 15:04:42 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2023-05-30 11:17:29 +0200 |
| commit | 8aa97d8f8482d6a69e7d6df9d49baa395f470dc0 (patch) | |
| tree | 23a5ff8f8e555ad4bc9bde4fc7f22d183cc81035 | |
| parent | 4454c2ab9b231827c2757671fad39f28d9541940 (diff) | |
| download | mullvadvpn-8aa97d8f8482d6a69e7d6df9d49baa395f470dc0.tar.xz mullvadvpn-8aa97d8f8482d6a69e7d6df9d49baa395f470dc0.zip | |
Group in-app banner constants into UIMetrics.InAppBannerNotification
| -rw-r--r-- | ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift | 10 | ||||
| -rw-r--r-- | ios/MullvadVPN/UI appearance/UIMetrics.swift | 16 |
2 files changed, 13 insertions, 13 deletions
diff --git a/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift b/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift index cd21881a7c..4f246be9a0 100644 --- a/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift +++ b/ios/MullvadVPN/Notifications/UI/NotificationBannerView.swift @@ -40,14 +40,14 @@ final class NotificationBannerView: UIView { private let indicatorView: UIView = { let view = UIView() view.backgroundColor = .dangerColor - view.layer.cornerRadius = UIMetrics.inAppBannerSeverityIndicatorSize.width * 0.5 + view.layer.cornerRadius = UIMetrics.InAppBannerNotification.indicatorSize.width * 0.5 view.layer.cornerCurve = .circular return view }() private let wrapperView: UIView = { let view = UIView() - view.directionalLayoutMargins = UIMetrics.inAppBannerNotificationLayoutMargins + view.directionalLayoutMargins = UIMetrics.InAppBannerNotification.layoutMargins return view }() @@ -116,8 +116,10 @@ final class NotificationBannerView: UIView { NSLayoutConstraint.activate([ indicatorView.bottomAnchor.constraint(equalTo: titleLabel.firstBaselineAnchor), indicatorView.leadingAnchor.constraint(equalTo: wrapperView.layoutMarginsGuide.leadingAnchor), - indicatorView.widthAnchor.constraint(equalToConstant: UIMetrics.inAppBannerSeverityIndicatorSize.width), - indicatorView.heightAnchor.constraint(equalToConstant: UIMetrics.inAppBannerSeverityIndicatorSize.height), + indicatorView.widthAnchor + .constraint(equalToConstant: UIMetrics.InAppBannerNotification.indicatorSize.width), + indicatorView.heightAnchor + .constraint(equalToConstant: UIMetrics.InAppBannerNotification.indicatorSize.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 c5d6be6031..22359687ce 100644 --- a/ios/MullvadVPN/UI appearance/UIMetrics.swift +++ b/ios/MullvadVPN/UI appearance/UIMetrics.swift @@ -30,16 +30,14 @@ extension UIMetrics { /// Common cell indentation width static let cellIndentationWidth: CGFloat = 16 - /// Layout margins for in-app notification banner presentation - static let inAppBannerNotificationLayoutMargins = NSDirectionalEdgeInsets( - top: 16, - leading: 24, - bottom: 16, - trailing: 24 - ) + /// Group of constants related to in-app notifications banner. + enum InAppBannerNotification { + /// Layout margins for contents presented within the banner. + static let layoutMargins = NSDirectionalEdgeInsets(top: 16, leading: 24, bottom: 16, trailing: 24) - /// Size of little round indicator presented in in-app notification banner. - static let inAppBannerSeverityIndicatorSize = CGSize(width: 12, height: 12) + /// Size of little round severity indicator. + static let indicatorSize = CGSize(width: 12, height: 12) + } /// Spacing used in stack views of buttons static let interButtonSpacing: CGFloat = 16 |
