parent
2a1deb8d7d
commit
92ff900bc0
|
@ -296,6 +296,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
|||
completion(true)
|
||||
}
|
||||
}
|
||||
dismissAction.accessibilityLabel = "Dismiss Notification"
|
||||
dismissAction.image = UIImage(systemName: "clear.fill")
|
||||
|
||||
let cellConfiguration = (tableView.cellForRow(at: indexPath) as? TableViewSwipeActionProvider)?.trailingSwipeActionsConfiguration()
|
||||
|
|
|
@ -222,6 +222,31 @@ class ActionNotificationGroupTableViewCell: UITableViewCell {
|
|||
updateTimestampWorkItem = nil
|
||||
}
|
||||
|
||||
// MARK: Accessibility
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
get {
|
||||
let first = group.notifications.first!
|
||||
var str = ""
|
||||
switch group.kind {
|
||||
case .favourite:
|
||||
str += "Favorited by "
|
||||
case .reblog:
|
||||
str += "Reblogged by "
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
str += first.account.displayNameWithoutCustomEmoji
|
||||
if group.notifications.count > 1 {
|
||||
str += " and \(group.notifications.count - 1) more"
|
||||
}
|
||||
str += ", \(first.createdAt.formatted(.relative(presentation: .numeric))), "
|
||||
str += statusContentLabel.text ?? ""
|
||||
return str
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension ActionNotificationGroupTableViewCell: SelectableTableViewCell {
|
||||
|
|
|
@ -186,6 +186,22 @@ class FollowNotificationGroupTableViewCell: UITableViewCell {
|
|||
updateTimestampWorkItem = nil
|
||||
}
|
||||
|
||||
// MARK: Accessibility
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
get {
|
||||
let first = group.notifications.first!
|
||||
var str = "Followed by "
|
||||
str += first.account.displayNameWithoutCustomEmoji
|
||||
if group.notifications.count > 1 {
|
||||
str += " and \(group.notifications.count - 1) more"
|
||||
}
|
||||
str += ", \(first.createdAt.formatted(.relative(presentation: .numeric)))"
|
||||
return str
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension FollowNotificationGroupTableViewCell: SelectableTableViewCell {
|
||||
|
|
|
@ -135,6 +135,29 @@ class FollowRequestNotificationTableViewCell: UITableViewCell {
|
|||
self.stackView.addArrangedSubview(label)
|
||||
}
|
||||
|
||||
// MARK: Accessibility
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
get {
|
||||
guard let notification else { return nil }
|
||||
var str = "Follow requested by "
|
||||
str += notification.account.displayNameWithoutCustomEmoji
|
||||
str += ", \(notification.createdAt.formatted(.relative(presentation: .numeric)))"
|
||||
return str
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
override var accessibilityCustomActions: [UIAccessibilityCustomAction]? {
|
||||
get {
|
||||
return [
|
||||
UIAccessibilityCustomAction(name: "Accept Request", target: self, selector: #selector(acceptButtonPressed)),
|
||||
UIAccessibilityCustomAction(name: "Reject Request", target: self, selector: #selector(acceptButtonPressed)),
|
||||
]
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
// MARK: - Interaction
|
||||
|
||||
@IBAction func rejectButtonPressed() {
|
||||
|
|
|
@ -93,6 +93,25 @@ class PollFinishedTableViewCell: UITableViewCell {
|
|||
updateTimestampWorkItem = nil
|
||||
}
|
||||
|
||||
// MARK: Accessibility
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
get {
|
||||
guard let notification else { return nil }
|
||||
var str = "Poll from "
|
||||
str += notification.account.displayNameWithoutCustomEmoji
|
||||
str += " finished "
|
||||
str += notification.createdAt.formatted(.relative(presentation: .numeric))
|
||||
if let poll = notification.status?.poll,
|
||||
poll.options.contains(where: { ($0.votesCount ?? 0) > 0 }) {
|
||||
let winner = poll.options.max(by: { ($0.votesCount ?? 0) < ($1.votesCount ?? 0) })!
|
||||
str += ", winning option: \(winner.title)"
|
||||
}
|
||||
return str
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension PollFinishedTableViewCell: SelectableTableViewCell {
|
||||
|
|
|
@ -85,6 +85,22 @@ class StatusUpdatedNotificationTableViewCell: UITableViewCell {
|
|||
updateTimestampWorkItem = nil
|
||||
}
|
||||
|
||||
// MARK: Accessibility
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
get {
|
||||
guard let notification else { return nil }
|
||||
var str = "Post from "
|
||||
str += notification.account.displayNameWithoutCustomEmoji
|
||||
str += " edited "
|
||||
str += notification.createdAt.formatted(.relative(presentation: .numeric))
|
||||
str += ", "
|
||||
str += contentLabel.text ?? ""
|
||||
return str
|
||||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension StatusUpdatedNotificationTableViewCell: SelectableTableViewCell {
|
||||
|
|
Loading…
Reference in New Issue