VoiceOver: Add show profile rotor action to timeline statuses

Closes #285
This commit is contained in:
Shadowfacts 2022-12-04 13:49:45 -05:00
parent df07fa85d5
commit 19bf6cbf18
2 changed files with 16 additions and 4 deletions

View File

@ -429,10 +429,16 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
override var accessibilityCustomActions: [UIAccessibilityCustomAction]? {
get {
guard let text = contentTextView.attributedText else {
guard let text = contentTextView.attributedText,
let status = mastodonController.persistentContainer.status(for: statusID) else {
return nil
}
var actions: [UIAccessibilityCustomAction] = []
var actions = [
UIAccessibilityCustomAction(name: "Show \(status.account.displayNameWithoutCustomEmoji)", actionHandler: { [unowned self] _ in
self.delegate?.selected(account: status.account.id)
return true
})
]
text.enumerateAttribute(.link, in: NSRange(location: 0, length: text.length)) { value, range, stop in
guard let value = value as? URL else {
return

View File

@ -310,10 +310,16 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
override var accessibilityCustomActions: [UIAccessibilityCustomAction]? {
get {
guard let text = contentTextView.attributedText else {
guard let text = contentTextView.attributedText,
let status = mastodonController.persistentContainer.status(for: statusID) else {
return nil
}
var actions: [UIAccessibilityCustomAction] = []
var actions = [
UIAccessibilityCustomAction(name: "Show \(status.account.displayNameWithoutCustomEmoji)", actionHandler: { [unowned self] _ in
self.delegate?.selected(account: status.account.id)
return true
})
]
text.enumerateAttribute(.link, in: NSRange(location: 0, length: text.length)) { value, range, stop in
guard let value = value as? URL else {
return