Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

add hit test to capture touch and send to subviews on notification cell #2705

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

albertbass86
Copy link

  • Add a hitTest on notification cell and propagating touches to subviews.

Closes #2657

@BasThomas BasThomas added the 💤 awaiting review Pull Request is awaiting code reviews label Mar 29, 2019
@@ -153,6 +153,17 @@ final class NotificationCell: SelectableCell, CAAnimationDelegate {
override var canBecomeFirstResponder: Bool {
return true
}

override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
for view in subviews {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be more functional?

override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
    let view = subviews.map { view -> UIView? in
        let newPoint = view.convert(point, from: self)
        return view.hitTest(newPoint, with: event)
     }
     .compactMap { $0 }
     .first

   return view ?? super.hitTest(point, with: event)
}

What do you think?

@tabathap
Copy link

Ok

Sent with GitHawk

@ghost
Copy link

ghost commented Apr 24, 2020

#@

Sent with GitHawk

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💤 awaiting review Pull Request is awaiting code reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mute and more buttons don't work when a thread is read
5 participants