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

MenuController UX #2271

Merged
merged 1 commit into from
Oct 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Classes/Views/MarkdownStyledTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class MarkdownStyledTextView: StyledTextView, StyledTextViewDelegate {
// MARK: StyledTextViewDelegate

func didTap(view: StyledTextView, attributes: [NSAttributedStringKey : Any], point: CGPoint) {
if let details = attributes[MarkdownAttribute.details] as? String {
showDetailsInMenu(details: details, point: point)
}
guard let detected = DetectMarkdownAttribute(attributes: attributes) else { return }
tapDelegate?.didTap(cell: self, attribute: detected)
}

func didLongPress(view: StyledTextView, attributes: [NSAttributedStringKey : Any], point: CGPoint) {
if let details = attributes[MarkdownAttribute.details] as? String {
showDetailsInMenu(details: details, point: point)
}
if let urlString = attributes[MarkdownAttribute.url] as? String, let url = URL(string: urlString) {
show(url: url)
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/Views/ShowMoreDetailsLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ final class ShowMoreDetailsLabel: UILabel {

isUserInteractionEnabled = true

let longPress = UILongPressGestureRecognizer(
let tap = UITapGestureRecognizer(
target: self,
action: #selector(ShowMoreDetailsLabel.showMenu(recognizer:))
)
addGestureRecognizer(longPress)
addGestureRecognizer(tap)
}

required init?(coder aDecoder: NSCoder) {
Expand All @@ -34,8 +34,8 @@ final class ShowMoreDetailsLabel: UILabel {

// MARK: Private API

@objc func showMenu(recognizer: UILongPressGestureRecognizer) {
guard recognizer.state == .began,
@objc func showMenu(recognizer: UITapGestureRecognizer) {
guard recognizer.state == .recognized,
!detailText.isEmpty else { return }

becomeFirstResponder()
Expand Down