diff --git a/Localizations/Localizable.strings b/Localizations/Localizable.strings index 15ab08e..aaf1658 100644 --- a/Localizations/Localizable.strings +++ b/Localizations/Localizable.strings @@ -55,16 +55,28 @@ "camera-access.description" = "Open system settings to allow camera access"; "camera-access.open-system-settings" = "Open system settings"; "cancel" = "Cancel"; +"compose.add-button-accessibility-label.post" = "Add another post"; +"compose.add-button-accessibility-label.toot" = "Add another toot"; "compose.attachment.uploading" = "Uploading"; +"compose.attachments-button.accessibility-label" = "Add images, a video or an audio file"; "compose.attachments-will-be-discarded" = "Attachments will be discarded when changing accounts"; "compose.browse" = "Browse"; +"compose.characters-remaining-accessibility-label-%ld" = "%ld characters remaining"; +"compose.content-warning-button.add" = "Add content warning"; +"compose.content-warning-button.remove" = "Remove content warning"; +"compose.emoji-button" = "Emoji picker"; "compose.mark-media-sensitive" = "Mark media as sensitive"; "compose.photo-library" = "Photo Library"; "compose.poll.add-choice" = "Add a choice"; "compose.poll.allow-multiple-choices" = "Allow multiple choices"; "compose.poll.option-%ld" = "Option %ld"; +"compose.poll-button.accessibility-label" = "Add a poll"; "compose.prompt" = "What's on your mind?"; "compose.take-photo-or-video" = "Take Photo or Video"; +"compose.visibility-button.accessibility-label.toot" = "Adjust toot privacy"; +"compose.visibility-button.accessibility-label.post" = "Adjust post privacy"; +"compose-button.accessibility-label.post" = "Compose Post"; +"compose-button.accessibility-label.toot" = "Compose Toot"; "emoji.custom" = "Custom"; "emoji.default-skin-tone" = "Default skin tone"; "emoji.frequently-used" = "Frequently used"; @@ -100,6 +112,7 @@ "secondary-navigation.lists" = "Lists"; "secondary-navigation.my-profile" = "My Profile"; "secondary-navigation.preferences" = "Preferences"; +"secondary-navigation-button.accessibility-title" = "Account Menu"; "identities.accounts" = "Accounts"; "identities.browsing" = "Browsing"; "identities.pending" = "Pending"; diff --git a/View Controllers/MainNavigationViewController.swift b/View Controllers/MainNavigationViewController.swift index c15c90b..239c5d0 100644 --- a/View Controllers/MainNavigationViewController.swift +++ b/View Controllers/MainNavigationViewController.swift @@ -102,7 +102,7 @@ private extension MainNavigationViewController { let newStatusNavigationController = UINavigationController(rootViewController: newStatusViewController) if UIDevice.current.userInterfaceIdiom == .phone { - newStatusNavigationController.modalPresentationStyle = .overFullScreen + newStatusNavigationController.modalPresentationStyle = .fullScreen } else { newStatusNavigationController.isModalInPresentation = true } @@ -113,6 +113,18 @@ private extension MainNavigationViewController { view.addSubview(newStatusButtonView) newStatusButtonView.translatesAutoresizingMaskIntoConstraints = false + viewModel.identityContext.$appPreferences.map(\.statusWord).removeDuplicates().sink { + switch $0 { + case .toot: + newStatusButtonView.button.accessibilityLabel = + NSLocalizedString("compose-button.accessibility-label.toot", comment: "") + case.post: + newStatusButtonView.button.accessibilityLabel = + NSLocalizedString("compose-button.accessibility-label.post", comment: "") + } + } + .store(in: &cancellables) + NSLayoutConstraint.activate([ newStatusButtonView.widthAnchor.constraint(equalToConstant: .newStatusButtonDimension), newStatusButtonView.heightAnchor.constraint(equalToConstant: .newStatusButtonDimension), diff --git a/Views/UIKit/CompositionInputAccessoryView.swift b/Views/UIKit/CompositionInputAccessoryView.swift index 8e176db..3ea6cc9 100644 --- a/Views/UIKit/CompositionInputAccessoryView.swift +++ b/Views/UIKit/CompositionInputAccessoryView.swift @@ -69,15 +69,44 @@ private extension CompositionInputAccessoryView { let attachmentButton = UIBarButtonItem( image: UIImage(systemName: "paperclip"), menu: UIMenu(children: attachmentActions)) + + attachmentButton.accessibilityLabel = + NSLocalizedString("compose.attachments-button.accessibility-label", comment: "") + let pollButton = UIBarButtonItem( image: UIImage(systemName: "chart.bar.xaxis"), primaryAction: UIAction { [weak self] _ in self?.viewModel.displayPoll.toggle() }) + + pollButton.accessibilityLabel = NSLocalizedString("compose.poll-button.accessibility-label", comment: "") + let visibilityButton = UIBarButtonItem( image: UIImage(systemName: parentViewModel.visibility.systemImageName), menu: visibilityMenu(selectedVisibility: parentViewModel.visibility)) + + switch parentViewModel.identityContext.appPreferences.statusWord { + case .toot: + visibilityButton.accessibilityLabel = + NSLocalizedString("compose.visibility-button.accessibility-label.toot", comment: "") + case .post: + visibilityButton.accessibilityLabel = + NSLocalizedString("compose.visibility-button.accessibility-label.post", comment: "") + } + let contentWarningButton = UIBarButtonItem( title: NSLocalizedString("status.content-warning-abbreviation", comment: ""), primaryAction: UIAction { [weak self] _ in self?.viewModel.displayContentWarning.toggle() }) + + viewModel.$displayContentWarning.sink { + if $0 { + contentWarningButton.accessibilityHint = + NSLocalizedString("compose.content-warning-button.remove", comment: "") + } else { + contentWarningButton.accessibilityHint = + NSLocalizedString("compose.content-warning-button.add", comment: "") + } + } + .store(in: &cancellables) + let emojiButton = UIBarButtonItem( image: UIImage(systemName: "face.smiling"), primaryAction: UIAction { [weak self] _ in @@ -85,6 +114,9 @@ private extension CompositionInputAccessoryView { self.parentViewModel.presentEmojiPicker(tag: self.tagForInputView) }) + + emojiButton.accessibilityLabel = NSLocalizedString("compose.emoji-button", comment: "") + let addButton = UIBarButtonItem( image: UIImage(systemName: "plus.circle.fill"), primaryAction: UIAction { [weak self] _ in @@ -93,6 +125,15 @@ private extension CompositionInputAccessoryView { self.parentViewModel.insert(after: self.viewModel) }) + switch parentViewModel.identityContext.appPreferences.statusWord { + case .toot: + addButton.accessibilityLabel = + NSLocalizedString("compose.add-button-accessibility-label.toot", comment: "") + case .post: + addButton.accessibilityLabel = + NSLocalizedString("compose.add-button-accessibility-label.post", comment: "") + } + let charactersLabel = UILabel() charactersLabel.font = .preferredFont(forTextStyle: .callout) @@ -128,6 +169,9 @@ private extension CompositionInputAccessoryView { viewModel.$remainingCharacters.sink { charactersLabel.text = String($0) charactersLabel.textColor = $0 < 0 ? .systemRed : .label + charactersLabel.accessibilityLabel = String.localizedStringWithFormat( + NSLocalizedString("compose.characters-remaining-accessibility-label-%ld", comment: ""), + $0) } .store(in: &cancellables) diff --git a/Views/UIKit/SecondaryNavigationButton.swift b/Views/UIKit/SecondaryNavigationButton.swift index de2690c..5067a32 100644 --- a/Views/UIKit/SecondaryNavigationButton.swift +++ b/Views/UIKit/SecondaryNavigationButton.swift @@ -15,6 +15,7 @@ final class SecondaryNavigationButton: UIBarButtonItem { type: .custom, primaryAction: UIAction { _ in viewModel.presentingSecondaryNavigation = true }) + button.accessibilityLabel = NSLocalizedString("secondary-navigation-button.accessibility-title", comment: "") button.imageView?.contentMode = .scaleAspectFill button.layer.cornerRadius = .barButtonItemDimension / 2 button.clipsToBounds = true