mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 08:10:59 +00:00
VoiceOver improvements
This commit is contained in:
parent
48c014ba35
commit
9fbfdf0c20
5 changed files with 80 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
"about" = "About";
|
||||
"about.acknowledgments" = "Acknowledgments";
|
||||
"accessibility.activate-link-%@" = "Activate link: %@";
|
||||
"account.%@-followers" = "%@'s Followers";
|
||||
"account.accept-follow-request-button.accessibility-label" = "Accept follow request";
|
||||
"account.avatar.accessibility-label-%@" = "Avatar: %@";
|
||||
|
@ -11,7 +12,6 @@
|
|||
"account.domain-block.confirm-%@" = "Block domain %@?";
|
||||
"account.domain-unblock-%@" = "Unblock domain %@";
|
||||
"account.domain-unblock.confirm-%@" = "Unblock domain %@?";
|
||||
"account.field.activate-link-accessibility-action-%@" = "Activate link: %@";
|
||||
"account.field.verified" = "Verified %@";
|
||||
"account.follow" = "Follow";
|
||||
"account.following" = "Following";
|
||||
|
@ -237,6 +237,7 @@
|
|||
"search.scope.statuses.toot" = "Toots";
|
||||
"search.scope.tags" = "Hashtags";
|
||||
"share-extension-error.no-account-found" = "No account found";
|
||||
"status.accessibility.view-author-profile" = "View author's profile";
|
||||
"status.bookmark" = "Bookmark";
|
||||
"status.content-warning-abbreviation" = "CW";
|
||||
"status.content-warning.accessibility" = "Content warning";
|
||||
|
|
|
@ -66,6 +66,22 @@
|
|||
<string>%ld Favorites</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>status.replies-count</key>
|
||||
<dict>
|
||||
<key>NSStringLocalizedFormatKey</key>
|
||||
<string>%#@replies@</string>
|
||||
<key>replies</key>
|
||||
<dict>
|
||||
<key>NSStringFormatSpecTypeKey</key>
|
||||
<string>NSStringPluralRuleType</string>
|
||||
<key>NSStringFormatValueTypeKey</key>
|
||||
<string>ld</string>
|
||||
<key>one</key>
|
||||
<string>%ld Reply</string>
|
||||
<key>other</key>
|
||||
<string>%ld Replies</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>account.followers-count</key>
|
||||
<dict>
|
||||
<key>NSStringLocalizedFormatKey</key>
|
||||
|
|
|
@ -167,7 +167,7 @@ final class AccountFieldView: UIView {
|
|||
accessibilityCustomActions.append(
|
||||
UIAccessibilityCustomAction(
|
||||
name: String.localizedStringWithFormat(
|
||||
NSLocalizedString("account.field.activate-link-accessibility-action-%@", comment: ""),
|
||||
NSLocalizedString("accessibility.activate-link-%@", comment: ""),
|
||||
mutableValue.attributedSubstring(from: range).string)) { [weak self] _ in
|
||||
guard let valueTextView = self?.valueTextView else { return false }
|
||||
|
||||
|
|
|
@ -510,6 +510,29 @@ private extension StatusView {
|
|||
accessibilityAttributedLabel.appendWithSeparator(accessibilityTime)
|
||||
}
|
||||
|
||||
if viewModel.repliesCount > 0 {
|
||||
accessibilityAttributedLabel.appendWithSeparator(
|
||||
String.localizedStringWithFormat(
|
||||
NSLocalizedString("status.replies-count", comment: ""),
|
||||
viewModel.repliesCount))
|
||||
}
|
||||
|
||||
if viewModel.identityContext.appPreferences.showReblogAndFavoriteCounts {
|
||||
if viewModel.reblogsCount > 0 {
|
||||
accessibilityAttributedLabel.appendWithSeparator(
|
||||
String.localizedStringWithFormat(
|
||||
NSLocalizedString("status.reblogs-count", comment: ""),
|
||||
viewModel.reblogsCount))
|
||||
}
|
||||
|
||||
if viewModel.favoritesCount > 0 {
|
||||
accessibilityAttributedLabel.appendWithSeparator(
|
||||
String.localizedStringWithFormat(
|
||||
NSLocalizedString("status.favorites-count", comment: ""),
|
||||
viewModel.favoritesCount))
|
||||
}
|
||||
}
|
||||
|
||||
self.accessibilityAttributedLabel = accessibilityAttributedLabel
|
||||
|
||||
configureUserInteractionEnabledForAccessibility()
|
||||
|
@ -723,6 +746,17 @@ private extension StatusView {
|
|||
})
|
||||
}
|
||||
|
||||
actions.append(
|
||||
UIAccessibilityCustomAction(
|
||||
name: NSLocalizedString("status.accessibility.view-author-profile",
|
||||
comment: "")) { [weak self] _ in
|
||||
self?.statusConfiguration.viewModel.accountSelected()
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
actions.append(contentsOf: bodyView.accessibilityCustomActions ?? [])
|
||||
|
||||
if menuButton.isEnabled {
|
||||
actions.append(UIAccessibilityCustomAction(
|
||||
name: viewModel.bookmarked
|
||||
|
|
|
@ -91,6 +91,33 @@ final class StatusBodyView: UIView {
|
|||
}
|
||||
|
||||
self.accessibilityAttributedLabel = accessibilityAttributedLabel
|
||||
|
||||
var accessibilityCustomActions = [UIAccessibilityCustomAction]()
|
||||
|
||||
mutableContent.enumerateAttribute(
|
||||
.link,
|
||||
in: NSRange(location: 0, length: mutableContent.length),
|
||||
options: []) { attribute, range, _ in
|
||||
guard let url = attribute as? URL else { return }
|
||||
|
||||
accessibilityCustomActions.append(
|
||||
UIAccessibilityCustomAction(
|
||||
name: String.localizedStringWithFormat(
|
||||
NSLocalizedString("accessibility.activate-link-%@", comment: ""),
|
||||
mutableContent.attributedSubstring(from: range).string)) { [weak self] _ in
|
||||
guard let contentTextView = self?.contentTextView else { return false }
|
||||
|
||||
_ = contentTextView.delegate?.textView?(
|
||||
contentTextView,
|
||||
shouldInteractWith: url,
|
||||
in: range,
|
||||
interaction: .invokeDefaultAction)
|
||||
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
self.accessibilityCustomActions = accessibilityCustomActions
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue