parent
c01bc4d840
commit
4f28fec62a
|
@ -395,6 +395,27 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override var accessibilityCustomActions: [UIAccessibilityCustomAction]? {
|
||||||
|
get {
|
||||||
|
guard let text = contentTextView.attributedText else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
var actions: [UIAccessibilityCustomAction] = []
|
||||||
|
text.enumerateAttribute(.link, in: NSRange(location: 0, length: text.length)) { value, range, stop in
|
||||||
|
guard let value = value as? URL else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let text = text.attributedSubstring(from: range).string
|
||||||
|
actions.append(UIAccessibilityCustomAction(name: text) { [unowned self] _ in
|
||||||
|
self.contentTextView.handleLinkTapped(url: value, text: text)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return actions
|
||||||
|
}
|
||||||
|
set {}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: Configure UI
|
// MARK: Configure UI
|
||||||
|
|
||||||
func updateUI(statusID: String, state: StatusState) {
|
func updateUI(statusID: String, state: StatusState) {
|
||||||
|
|
|
@ -308,6 +308,27 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override var accessibilityCustomActions: [UIAccessibilityCustomAction]? {
|
||||||
|
get {
|
||||||
|
guard let text = contentTextView.attributedText else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
var actions: [UIAccessibilityCustomAction] = []
|
||||||
|
text.enumerateAttribute(.link, in: NSRange(location: 0, length: text.length)) { value, range, stop in
|
||||||
|
guard let value = value as? URL else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let text = text.attributedSubstring(from: range).string
|
||||||
|
actions.append(UIAccessibilityCustomAction(name: text) { [unowned self] _ in
|
||||||
|
self.contentTextView.handleLinkTapped(url: value, text: text)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return actions
|
||||||
|
}
|
||||||
|
set {}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TimelineStatusTableViewCell: SelectableTableViewCell {
|
extension TimelineStatusTableViewCell: SelectableTableViewCell {
|
||||||
|
|
Loading…
Reference in New Issue