VoiceOver: Fix not being able to select account from conversation main status cell
This commit is contained in:
parent
726be85223
commit
7763d08816
|
@ -26,12 +26,12 @@ class ConversationMainStatusTableViewCell: BaseStatusTableViewCell {
|
||||||
@IBOutlet weak var totalReblogsButton: UIButton!
|
@IBOutlet weak var totalReblogsButton: UIButton!
|
||||||
@IBOutlet weak var timestampAndClientLabel: UILabel!
|
@IBOutlet weak var timestampAndClientLabel: UILabel!
|
||||||
|
|
||||||
var profileAccessibilityElement: UIAccessibilityElement!
|
private var profileAccessibilityElement: ConversationMainStatusProfileAccessibilityElement!
|
||||||
|
|
||||||
override func awakeFromNib() {
|
override func awakeFromNib() {
|
||||||
super.awakeFromNib()
|
super.awakeFromNib()
|
||||||
|
|
||||||
profileAccessibilityElement = UIAccessibilityElement(accessibilityContainer: self)
|
profileAccessibilityElement = ConversationMainStatusProfileAccessibilityElement(accessibilityContainer: self)
|
||||||
profileAccessibilityElement.accessibilityFrameInContainerSpace = profileDetailContainerView.convert(profileDetailContainerView.frame, to: self)
|
profileAccessibilityElement.accessibilityFrameInContainerSpace = profileDetailContainerView.convert(profileDetailContainerView.frame, to: self)
|
||||||
accessibilityElements = [
|
accessibilityElements = [
|
||||||
profileAccessibilityElement!,
|
profileAccessibilityElement!,
|
||||||
|
@ -101,8 +101,8 @@ class ConversationMainStatusTableViewCell: BaseStatusTableViewCell {
|
||||||
|
|
||||||
override func updateUI(account: AccountMO) {
|
override func updateUI(account: AccountMO) {
|
||||||
super.updateUI(account: account)
|
super.updateUI(account: account)
|
||||||
|
profileAccessibilityElement.navigationDelegate = delegate
|
||||||
profileAccessibilityElement.accessibilityLabel = account.displayNameWithoutCustomEmoji
|
profileAccessibilityElement.accountID = account.id
|
||||||
}
|
}
|
||||||
|
|
||||||
override func updateUIForPreferences(account: AccountMO, status: StatusMO) {
|
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 {
|
extension ConversationMainStatusTableViewCell: UIContextMenuInteractionDelegate {
|
||||||
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
|
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
|
||||||
return UIContextMenuConfiguration(identifier: nil) {
|
return UIContextMenuConfiguration(identifier: nil) {
|
||||||
|
|
Loading…
Reference in New Issue