VoiceOver improvements

This commit is contained in:
Justin Mazzocchi 2021-02-08 21:53:52 -08:00
parent 25bc782707
commit d508df8bb1
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
5 changed files with 77 additions and 10 deletions

View file

@ -18,10 +18,6 @@ extension Attachment.AttachmentType {
}
func accessibilityNames(count: Int) -> String {
if count == 1 {
return accessibilityName
}
let format: String
switch self {

View file

@ -58,13 +58,9 @@
"attachment.sensitive-content" = "Sensitive content";
"attachment.media-hidden" = "Media hidden";
"attachment.type.image" = "Image";
"attachment.type.images-%ld" = "%ld images";
"attachment.type.audio" = "Audio file";
"attachment.type.audios-%ld" = "%ld audio files";
"attachment.type.video" = "Video";
"attachment.type.videos-%ld" = "%ld videos";
"attachment.type.unknown" = "Attachment";
"attachment.type.unknown-%ld" = "%ld attachments";
"attachment.unable-to-export-media" = "Unable to export media";
"bookmarks" = "Bookmarks";
"card.link.accessibility-label" = "Link";

View file

@ -98,5 +98,69 @@
<string>%ld Followers</string>
</dict>
</dict>
<key>attachment.type.images-%ld</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@images@</string>
<key>images</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>one</key>
<string>%ld image</string>
<key>other</key>
<string>%ld images</string>
</dict>
</dict>
<key>attachment.type.audios-%ld</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@audios@</string>
<key>audios</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>one</key>
<string>%ld audio file</string>
<key>other</key>
<string>%ld audio files</string>
</dict>
</dict>
<key>attachment.type.videos-%ld</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@videos@</string>
<key>videos</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>one</key>
<string>%ld video file</string>
<key>other</key>
<string>%ld video files</string>
</dict>
</dict>
<key>attachment.type.unknowns-%ld</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@unknowns@</string>
<key>unknowns</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>ld</string>
<key>one</key>
<string>%ld attachment</string>
<key>other</key>
<string>%ld attachments</string>
</dict>
</dict>
</dict>
</plist>

View file

@ -82,7 +82,18 @@ final class AttachmentsView: UIView {
type = .unknown
}
accessibilityLabel = type.accessibilityNames(count: viewModel.attachmentViewModels.count)
var accessibilityLabel = type.accessibilityNames(count: viewModel.attachmentViewModels.count)
for attachmentViewModel in viewModel.attachmentViewModels {
guard let description = attachmentViewModel.attachment.description,
!description.isEmpty
else { continue }
accessibilityLabel.appendWithSeparator(attachmentViewModel.attachment.type.accessibilityName)
accessibilityLabel.appendWithSeparator(description)
}
self.accessibilityLabel = accessibilityLabel
} else {
accessibilityLabel = curtainButton.title(for: .normal)
}

View file

@ -487,7 +487,7 @@ private extension StatusView {
displayNameLabel.attributedText = mutableDisplayName
accountLabel.text = viewModel.accountName
let nameButtonAccessibilityAttributedLabel = mutableDisplayName
let nameButtonAccessibilityAttributedLabel = NSMutableAttributedString(attributedString: mutableDisplayName)
nameButtonAccessibilityAttributedLabel.appendWithSeparator(viewModel.accountName)
nameButton.accessibilityAttributedLabel = nameButtonAccessibilityAttributedLabel