VoiceOver wip
This commit is contained in:
parent
ef80b743da
commit
5bfe75c778
|
@ -134,6 +134,8 @@
|
||||||
"identities.pending" = "Pending";
|
"identities.pending" = "Pending";
|
||||||
"lists.new-list-title" = "New List Title";
|
"lists.new-list-title" = "New List Title";
|
||||||
"load-more" = "Load More";
|
"load-more" = "Load More";
|
||||||
|
"load-more.newer.accessibility-label" = "Load newer items";
|
||||||
|
"load-more.older.accessibility-label" = "Load older items";
|
||||||
"main-navigation.timelines" = "Timelines";
|
"main-navigation.timelines" = "Timelines";
|
||||||
"main-navigation.explore" = "Explore";
|
"main-navigation.explore" = "Explore";
|
||||||
"main-navigation.notifications" = "Notifications";
|
"main-navigation.notifications" = "Notifications";
|
||||||
|
|
|
@ -137,7 +137,11 @@ class TableViewController: UITableViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool {
|
override func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool {
|
||||||
viewModel.canSelect(indexPath: indexPath)
|
if case .loadMore = dataSource.itemIdentifier(for: indexPath), UIAccessibility.isVoiceOverRunning {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return viewModel.canSelect(indexPath: indexPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ public final class LoadMoreViewModel: ObservableObject, CollectionItemViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension LoadMoreViewModel {
|
public extension LoadMoreViewModel {
|
||||||
func loadMore() {
|
func loadMore() {
|
||||||
eventsSubject.send(
|
eventsSubject.send(
|
||||||
loadMoreService.request(direction: direction)
|
loadMoreService.request(direction: direction)
|
||||||
|
|
|
@ -59,6 +59,7 @@ extension ConversationView: UIContentView {
|
||||||
}
|
}
|
||||||
|
|
||||||
private extension ConversationView {
|
private extension ConversationView {
|
||||||
|
// swiftlint:disable:next function_body_length
|
||||||
func initialSetup() {
|
func initialSetup() {
|
||||||
let containerStackView = UIStackView()
|
let containerStackView = UIStackView()
|
||||||
let sideStackView = UIStackView()
|
let sideStackView = UIStackView()
|
||||||
|
@ -111,6 +112,8 @@ private extension ConversationView {
|
||||||
avatarsHeightConstraint,
|
avatarsHeightConstraint,
|
||||||
sideStackView.widthAnchor.constraint(equalToConstant: .avatarDimension)
|
sideStackView.widthAnchor.constraint(equalToConstant: .avatarDimension)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
isAccessibilityElement = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func applyConversationConfiguration() {
|
func applyConversationConfiguration() {
|
||||||
|
@ -125,7 +128,20 @@ private extension ConversationView {
|
||||||
|
|
||||||
displayNamesLabel.attributedText = mutableDisplayNames
|
displayNamesLabel.attributedText = mutableDisplayNames
|
||||||
timeLabel.text = viewModel.statusViewModel?.time
|
timeLabel.text = viewModel.statusViewModel?.time
|
||||||
|
timeLabel.accessibilityLabel = viewModel.statusViewModel?.accessibilityTime
|
||||||
statusBodyView.viewModel = viewModel.statusViewModel
|
statusBodyView.viewModel = viewModel.statusViewModel
|
||||||
avatarsView.viewModel = viewModel
|
avatarsView.viewModel = viewModel
|
||||||
|
|
||||||
|
let accessibilityAttributedLabel = NSMutableAttributedString(attributedString: mutableDisplayNames)
|
||||||
|
|
||||||
|
if let statusBodyAccessibilityAttributedLabel = statusBodyView.accessibilityAttributedLabel {
|
||||||
|
accessibilityAttributedLabel.appendWithSeparator(statusBodyAccessibilityAttributedLabel)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let accessibilityTime = viewModel.statusViewModel?.accessibilityTime {
|
||||||
|
accessibilityAttributedLabel.appendWithSeparator(accessibilityTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
self.accessibilityAttributedLabel = accessibilityAttributedLabel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ private extension LoadMoreView {
|
||||||
static let directionChangeMax = CGFloat.pi
|
static let directionChangeMax = CGFloat.pi
|
||||||
static let directionChangeIncrement = CGFloat.pi / 10
|
static let directionChangeIncrement = CGFloat.pi / 10
|
||||||
|
|
||||||
|
// swiftlint:disable:next function_body_length
|
||||||
func initialSetup() {
|
func initialSetup() {
|
||||||
for arrowImageView in [leadingArrowImageView, trailingArrowImageView] {
|
for arrowImageView in [leadingArrowImageView, trailingArrowImageView] {
|
||||||
addSubview(arrowImageView)
|
addSubview(arrowImageView)
|
||||||
|
@ -106,6 +107,25 @@ private extension LoadMoreView {
|
||||||
activityIndicatorView.centerXAnchor.constraint(equalTo: centerXAnchor),
|
activityIndicatorView.centerXAnchor.constraint(equalTo: centerXAnchor),
|
||||||
activityIndicatorView.centerYAnchor.constraint(equalTo: centerYAnchor)
|
activityIndicatorView.centerYAnchor.constraint(equalTo: centerYAnchor)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
isAccessibilityElement = true
|
||||||
|
accessibilityLabel = NSLocalizedString("load-more", comment: "")
|
||||||
|
accessibilityCustomActions = [
|
||||||
|
UIAccessibilityCustomAction(
|
||||||
|
name: NSLocalizedString("load-more.older.accessibility-label", comment: "")) { [weak self] _ in
|
||||||
|
self?.loadMoreConfiguration.viewModel.direction = .down
|
||||||
|
self?.loadMoreConfiguration.viewModel.loadMore()
|
||||||
|
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
UIAccessibilityCustomAction(
|
||||||
|
name: NSLocalizedString("load-more.newer.accessibility-label", comment: "")) { [weak self] _ in
|
||||||
|
self?.loadMoreConfiguration.viewModel.direction = .up
|
||||||
|
self?.loadMoreConfiguration.viewModel.loadMore()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
func applyLoadMoreConfiguration() {
|
func applyLoadMoreConfiguration() {
|
||||||
|
|
|
@ -10,6 +10,7 @@ final class ConversationTableViewCell: UITableViewCell {
|
||||||
guard let viewModel = viewModel else { return }
|
guard let viewModel = viewModel else { return }
|
||||||
|
|
||||||
contentConfiguration = ConversationContentConfiguration(viewModel: viewModel).updated(for: state)
|
contentConfiguration = ConversationContentConfiguration(viewModel: viewModel).updated(for: state)
|
||||||
|
accessibilityElements = [contentView]
|
||||||
}
|
}
|
||||||
|
|
||||||
override func layoutSubviews() {
|
override func layoutSubviews() {
|
||||||
|
|
|
@ -10,6 +10,7 @@ final class LoadMoreTableViewCell: UITableViewCell {
|
||||||
guard let viewModel = viewModel else { return }
|
guard let viewModel = viewModel else { return }
|
||||||
|
|
||||||
contentConfiguration = LoadMoreContentConfiguration(viewModel: viewModel)
|
contentConfiguration = LoadMoreContentConfiguration(viewModel: viewModel)
|
||||||
|
accessibilityElements = [contentView]
|
||||||
}
|
}
|
||||||
|
|
||||||
override func layoutSubviews() {
|
override func layoutSubviews() {
|
||||||
|
|
Loading…
Reference in New Issue