diff --git a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift index 1216a6f0..6b9a24f0 100644 --- a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift @@ -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 diff --git a/Tusker/Views/Status/TimelineStatusTableViewCell.swift b/Tusker/Views/Status/TimelineStatusTableViewCell.swift index d80a98a3..6af737ad 100644 --- a/Tusker/Views/Status/TimelineStatusTableViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusTableViewCell.swift @@ -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