Skip to content

Commit 078e59c

Browse files
authored
Merge pull request #6146 from woocommerce/issue/5899-notice-view-button-tap-area
Maintenance: Enlarge notice view's action button tap area
2 parents ca51b4c + fddf4e4 commit 078e59c

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
8.6
44
-----
5+
- [*] Enlarged the tap area for the action button on the notice view. [https://github.com/woocommerce/woocommerce-ios/pull/6146]
56

67

78
8.5

WooCommerce/Classes/Tools/Notices/NoticeView.swift

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class NoticeView: UIView {
88

99
private let backgroundContainerView = UIView()
1010
private let backgroundView: UIVisualEffectView
11-
private let actionBackgroundView = UIView()
1211
private let shadowLayer = CAShapeLayer()
1312
private let shadowMaskLayer = CAShapeLayer()
1413

@@ -138,26 +137,19 @@ private extension NoticeView {
138137
}
139138

140139
func configureActionButton() {
141-
contentStackView.addArrangedSubview(actionBackgroundView)
142-
actionBackgroundView.translatesAutoresizingMaskIntoConstraints = false
143-
144-
actionBackgroundView.layoutMargins = Metrics.layoutMargins
145-
actionBackgroundView.backgroundColor = Appearance.actionBackgroundColor
146-
147-
actionBackgroundView.addSubview(actionButton)
148-
actionButton.translatesAutoresizingMaskIntoConstraints = false
140+
contentStackView.addArrangedSubview(actionButton)
149141

150142
NSLayoutConstraint.activate([
151-
actionBackgroundView.topAnchor.constraint(equalTo: backgroundView.contentView.topAnchor),
152-
actionBackgroundView.bottomAnchor.constraint(equalTo: backgroundView.contentView.bottomAnchor),
143+
actionButton.topAnchor.constraint(equalTo: backgroundView.contentView.topAnchor),
144+
actionButton.bottomAnchor.constraint(equalTo: backgroundView.contentView.bottomAnchor),
153145
])
154146

155-
actionBackgroundView.pinSubviewToAllEdgeMargins(actionButton)
156-
157147
actionButton.titleLabel?.font = Fonts.actionButtonFont
158148
actionButton.setTitleColor(Appearance.actionColor, for: .normal)
159149
actionButton.addTarget(self, action: #selector(actionButtonTapped), for: .touchUpInside)
160150
actionButton.setContentCompressionResistancePriority(.required, for: .horizontal)
151+
actionButton.contentEdgeInsets = Metrics.actionButtonContentInsets
152+
actionButton.backgroundColor = Appearance.actionBackgroundColor
161153
}
162154

163155
func configureDismissRecognizer() {
@@ -184,8 +176,9 @@ private extension NoticeView {
184176

185177
if let actionTitle = notice.actionTitle {
186178
actionButton.setTitle(actionTitle, for: .normal)
179+
actionButton.isHidden = false
187180
} else {
188-
actionBackgroundView.isHidden = true
181+
actionButton.isHidden = true
189182
}
190183
}
191184
}
@@ -213,6 +206,7 @@ private extension NoticeView {
213206
enum Metrics {
214207
static let cornerRadius: CGFloat = 13.0
215208
static let layoutMargins = UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0)
209+
static let actionButtonContentInsets = UIEdgeInsets(top: 22.0, left: 16.0, bottom: 22.0, right: 16.0)
216210
static let labelLineSpacing: CGFloat = 18.0
217211
}
218212

0 commit comments

Comments
 (0)