2
2
mirror of https://github.com/mastodon/mastodon-ios synced 2025-04-11 22:58:02 +02:00

Make taps on the author view either activate the buttons or show the author, never open the post in thread view.

Fixes IOS-143
This commit is contained in:
shannon 2024-12-17 15:10:29 -05:00
parent f28751872d
commit 7961514160

View File

@ -111,6 +111,23 @@ public class StatusAuthorView: UIStackView {
}
}
extension StatusAuthorView {
public override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let superHit = super.hitTest(point, with: event)
if superHit == avatarButton {
return avatarButton
} else {
if menuButton.point(inside: convert(point, to: menuButton), with: event) {
return menuButton
}
if contentSensitiveeToggleButton.point(inside: convert(point, to: contentSensitiveeToggleButton), with: event) {
return contentSensitiveeToggleButton
}
return self
}
}
}
extension StatusAuthorView {
func _init() {
axis = .horizontal
@ -134,7 +151,7 @@ extension StatusAuthorView {
// dateLabel
dateLabel.isUserInteractionEnabled = false
self.addTapGestureToAuthorName()
self.addTapGestureToSelf()
}
}
@ -214,9 +231,9 @@ extension StatusAuthorView {
return (menu, accessibilityActions)
}
private func addTapGestureToAuthorName() {
private func addTapGestureToSelf() {
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(StatusAuthorView.authorNameDidPressed(_:)))
authorNameLabel.addGestureRecognizer(tapGesture)
addGestureRecognizer(tapGesture)
}
}