Skip to content

Commit

Permalink
Fix dispatch hits to correct views APPS-3600
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-magda committed Feb 22, 2022
1 parent 5bc3c4f commit befb10e
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ final class CourseInfoHeaderView: UIView {
appearance.defaultTitleColor = self.appearance.actionButtonTitleColor
let button = ContinueActionButton(mode: .callToActionGreen, appearance: appearance)
button.addTarget(self, action: #selector(self.actionButtonClicked), for: .touchUpInside)
button.accessibilityIdentifier = "actionButton"
return button
}()

Expand All @@ -69,6 +70,7 @@ final class CourseInfoHeaderView: UIView {

button.addTarget(self, action: #selector(self.actionButtonClicked), for: .touchUpInside)
button.isHidden = true
button.accessibilityIdentifier = "promoPriceButton"

return button
}()
Expand All @@ -77,6 +79,7 @@ final class CourseInfoHeaderView: UIView {
let button = CourseInfoTryForFreeButton()
button.isHidden = true
button.addTarget(self, action: #selector(self.tryForFreeButtonClicked), for: .touchUpInside)
button.accessibilityIdentifier = "tryForFreeButton"
return button
}()

Expand Down Expand Up @@ -166,8 +169,11 @@ final class CourseInfoHeaderView: UIView {
let convertedPoint = self.convert(point, to: self.actionButtonsStackView)

if self.actionButtonsStackView.bounds.contains(convertedPoint) {
if let targetView = self.actionButtonsStackView.hitTest(convertedPoint, with: event) {
return targetView
for subview in self.actionButtonsStackView.arrangedSubviews {
let shouldSubviewInteract = !subview.isHidden && subview.isUserInteractionEnabled
if shouldSubviewInteract && subview.frame.contains(convertedPoint) {
return subview
}
}
}

Expand Down

0 comments on commit befb10e

Please sign in to comment.