Compare commits

...

3 Commits

4 changed files with 42 additions and 8 deletions

View File

@ -150,6 +150,7 @@ class ProfileHeaderView: UIView {
accessibilityElements = [
displayNameLabel!,
usernameLabel!,
relationshipLabel!,
noteTextView!,
fieldsView!,
moreButton!,

View File

@ -26,12 +26,12 @@ class ConversationMainStatusTableViewCell: BaseStatusTableViewCell {
@IBOutlet weak var totalReblogsButton: UIButton!
@IBOutlet weak var timestampAndClientLabel: UILabel!
var profileAccessibilityElement: UIAccessibilityElement!
private var profileAccessibilityElement: ConversationMainStatusProfileAccessibilityElement!
override func awakeFromNib() {
super.awakeFromNib()
profileAccessibilityElement = UIAccessibilityElement(accessibilityContainer: self)
profileAccessibilityElement = ConversationMainStatusProfileAccessibilityElement(accessibilityContainer: self)
profileAccessibilityElement.accessibilityFrameInContainerSpace = profileDetailContainerView.convert(profileDetailContainerView.frame, to: self)
accessibilityElements = [
profileAccessibilityElement!,
@ -101,8 +101,8 @@ class ConversationMainStatusTableViewCell: BaseStatusTableViewCell {
override func updateUI(account: AccountMO) {
super.updateUI(account: account)
profileAccessibilityElement.accessibilityLabel = account.displayNameWithoutCustomEmoji
profileAccessibilityElement.navigationDelegate = delegate
profileAccessibilityElement.accountID = account.id
}
override func updateUIForPreferences(account: AccountMO, status: StatusMO) {
@ -130,6 +130,27 @@ class ConversationMainStatusTableViewCell: BaseStatusTableViewCell {
}
}
private class ConversationMainStatusProfileAccessibilityElement: UIAccessibilityElement {
var navigationDelegate: TuskerNavigationDelegate!
var mastodonController: MastodonController { navigationDelegate.apiController }
var accountID: String!
override var accessibilityLabel: String? {
get { mastodonController.persistentContainer.account(for: accountID)?.displayNameWithoutCustomEmoji }
set {}
}
override var accessibilityHint: String? {
get { "Double tap to show profile." }
set {}
}
override func accessibilityActivate() -> Bool {
navigationDelegate.selected(account: accountID)
return true
}
}
extension ConversationMainStatusTableViewCell: UIContextMenuInteractionDelegate {
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
return UIContextMenuConfiguration(identifier: nil) {

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