Adding accessibility ids to attachments button, camera button, gif button and documents button, also adding text input id for captions on images

pull/797/head
Emily 2 years ago
parent ff65c84504
commit 477f0ffa08

@ -157,7 +157,7 @@
</Testables> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "App Store Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableUBSanitizer = "YES" enableUBSanitizer = "YES"

@ -1806,7 +1806,11 @@ extension ConversationVC:
} }
let actionSheet: UIAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) let actionSheet: UIAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
actionSheet.addAction(UIAlertAction(title: "delete_message_for_me".localized(), style: .destructive) { [weak self] _ in actionSheet.addAction(UIAlertAction(
title: "delete_message_for_me".localized(),
accessibilityIdentifier: "Delete for me",
style: .destructive
) { [weak self] _ in
Storage.shared.writeAsync { db in Storage.shared.writeAsync { db in
_ = try Interaction _ = try Interaction
.filter(id: cellViewModel.id) .filter(id: cellViewModel.id)
@ -1829,6 +1833,7 @@ extension ConversationVC:
"delete_message_for_everyone".localized() : "delete_message_for_everyone".localized() :
String(format: "delete_message_for_me_and_recipient".localized(), threadName) String(format: "delete_message_for_me_and_recipient".localized(), threadName)
), ),
accessibilityIdentifier: "Delete for everyone",
style: .destructive style: .destructive
) { [weak self] _ in ) { [weak self] _ in
deleteRemotely( deleteRemotely(

@ -26,28 +26,28 @@ final class ExpandingAttachmentsButton: UIView, InputViewButtonDelegate {
// MARK: UI Components // MARK: UI Components
lazy var gifButton: InputViewButton = { lazy var gifButton: InputViewButton = {
let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_gif_black"), delegate: self, hasOpaqueBackground: true) let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_gif_black"), delegate: self, hasOpaqueBackground: true)
result.accessibilityLabel = "GIF button" result.accessibilityIdentifier = "GIF button"
return result return result
}() }()
lazy var gifButtonContainer = container(for: gifButton) lazy var gifButtonContainer = container(for: gifButton)
lazy var documentButton: InputViewButton = { lazy var documentButton: InputViewButton = {
let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_document_black"), delegate: self, hasOpaqueBackground: true) let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_document_black"), delegate: self, hasOpaqueBackground: true)
result.accessibilityLabel = "Documents folder" result.accessibilityIdentifier = "Documents folder"
return result return result
}() }()
lazy var documentButtonContainer = container(for: documentButton) lazy var documentButtonContainer = container(for: documentButton)
lazy var libraryButton: InputViewButton = { lazy var libraryButton: InputViewButton = {
let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_camera_roll_black"), delegate: self, hasOpaqueBackground: true) let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_camera_roll_black"), delegate: self, hasOpaqueBackground: true)
result.accessibilityLabel = "Images folder" result.accessibilityIdentifier = "Images folder"
return result return result
}() }()
lazy var libraryButtonContainer = container(for: libraryButton) lazy var libraryButtonContainer = container(for: libraryButton)
lazy var cameraButton: InputViewButton = { lazy var cameraButton: InputViewButton = {
let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_camera_black"), delegate: self, hasOpaqueBackground: true) let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_camera_black"), delegate: self, hasOpaqueBackground: true)
result.accessibilityLabel = "Select camera button" result.accessibilityIdentifier = "Select camera button"
return result return result
}() }()

@ -53,6 +53,7 @@ final class InputView: UIView, InputViewButtonDelegate, InputTextViewDelegate, M
private lazy var attachmentsButton: ExpandingAttachmentsButton = { private lazy var attachmentsButton: ExpandingAttachmentsButton = {
let result = ExpandingAttachmentsButton(delegate: delegate) let result = ExpandingAttachmentsButton(delegate: delegate)
result.accessibilityLabel = "Attachments button" result.accessibilityLabel = "Attachments button"
result.accessibilityIdentifier = "Attachments button"
result.isAccessibilityElement = true result.isAccessibilityElement = true
return result return result
@ -61,6 +62,7 @@ final class InputView: UIView, InputViewButtonDelegate, InputTextViewDelegate, M
private lazy var voiceMessageButton: InputViewButton = { private lazy var voiceMessageButton: InputViewButton = {
let result = InputViewButton(icon: #imageLiteral(resourceName: "Microphone"), delegate: self) let result = InputViewButton(icon: #imageLiteral(resourceName: "Microphone"), delegate: self)
result.accessibilityLabel = "New voice message" result.accessibilityLabel = "New voice message"
result.accessibilityIdentifier = "New voice message"
result.isAccessibilityElement = true result.isAccessibilityElement = true
return result return result
@ -69,6 +71,7 @@ final class InputView: UIView, InputViewButtonDelegate, InputTextViewDelegate, M
private lazy var sendButton: InputViewButton = { private lazy var sendButton: InputViewButton = {
let result = InputViewButton(icon: #imageLiteral(resourceName: "ArrowUp"), isSendButton: true, delegate: self) let result = InputViewButton(icon: #imageLiteral(resourceName: "ArrowUp"), isSendButton: true, delegate: self)
result.isHidden = true result.isHidden = true
result.accessibilityIdentifier = "Send message button"
result.accessibilityLabel = "Send message button" result.accessibilityLabel = "Send message button"
result.isAccessibilityElement = true result.isAccessibilityElement = true
@ -86,6 +89,7 @@ final class InputView: UIView, InputViewButtonDelegate, InputTextViewDelegate, M
private lazy var mentionsViewContainer: UIView = { private lazy var mentionsViewContainer: UIView = {
let result: UIView = UIView() let result: UIView = UIView()
result.accessibilityLabel = "Mentions list" result.accessibilityLabel = "Mentions list"
result.accessibilityIdentifier = "Mentions list"
result.isAccessibilityElement = true result.isAccessibilityElement = true
result.alpha = 0 result.alpha = 0
@ -118,6 +122,7 @@ final class InputView: UIView, InputViewButtonDelegate, InputTextViewDelegate, M
let maxWidth = UIScreen.main.bounds.width - 2 * InputViewButton.expandedSize - 2 * Values.smallSpacing - 2 * (Values.mediumSpacing - adjustment) let maxWidth = UIScreen.main.bounds.width - 2 * InputViewButton.expandedSize - 2 * Values.smallSpacing - 2 * (Values.mediumSpacing - adjustment)
let result = InputTextView(delegate: self, maxWidth: maxWidth) let result = InputTextView(delegate: self, maxWidth: maxWidth)
result.accessibilityLabel = "Message input box" result.accessibilityLabel = "Message input box"
result.accessibilityIdentifier = "Message input box"
result.isAccessibilityElement = true result.isAccessibilityElement = true
return result return result

@ -13,7 +13,8 @@ final class DeletedMessageView: UIView {
init(textColor: ThemeValue) { init(textColor: ThemeValue) {
super.init(frame: CGRect.zero) super.init(frame: CGRect.zero)
accessibilityIdentifier = "Deleted message"
isAccessibilityElement = true
setUpViewHierarchy(textColor: textColor) setUpViewHierarchy(textColor: textColor)
} }

@ -12,7 +12,8 @@ final class MediaPlaceholderView: UIView {
init(cellViewModel: MessageViewModel, textColor: ThemeValue) { init(cellViewModel: MessageViewModel, textColor: ThemeValue) {
super.init(frame: CGRect.zero) super.init(frame: CGRect.zero)
self.accessibilityLabel = "Untrusted attachment message" self.accessibilityIdentifier = "Untrusted attachment message"
self.isAccessibilityElement = true
setUpViewHierarchy(cellViewModel: cellViewModel, textColor: textColor) setUpViewHierarchy(cellViewModel: cellViewModel, textColor: textColor)
} }

@ -435,6 +435,7 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate {
subview.removeFromSuperview() subview.removeFromSuperview()
} }
albumView = nil albumView = nil
albumView = nil
bodyTappableLabel = nil bodyTappableLabel = nil
// Handle the deleted state first (it's much simpler than the others) // Handle the deleted state first (it's much simpler than the others)

@ -678,9 +678,9 @@ class ThreadSettingsViewModel: SessionTableViewModel<ThreadSettingsViewModel.Nav
nil nil
), ),
accessibilityLabel: oldBlockedState == false ? "User blocked" : "Confirm unblock", accessibilityLabel: oldBlockedState == false ? "User blocked" : "Confirm unblock",
accessibilityId: "OK", accessibilityId: "Test_name",
cancelTitle: "BUTTON_OK".localized(), cancelTitle: "BUTTON_OK".localized(),
cancelAccessibilityLabel: "OK", cancelAccessibilityLabel: "OK_BUTTON",
cancelStyle: .alert_text cancelStyle: .alert_text
) )
) )

@ -22,7 +22,7 @@ public class ConfirmationModal: Modal {
let explanation: String? let explanation: String?
let attributedExplanation: NSAttributedString? let attributedExplanation: NSAttributedString?
let accessibilityLabel: String? let accessibilityLabel: String?
let accessibilityId: String? let accessibilityIdentifier: String?
public let stateToShow: State public let stateToShow: State
let confirmTitle: String? let confirmTitle: String?
let confirmAccessibilityLabel: String? let confirmAccessibilityLabel: String?
@ -57,7 +57,7 @@ public class ConfirmationModal: Modal {
self.explanation = explanation self.explanation = explanation
self.attributedExplanation = attributedExplanation self.attributedExplanation = attributedExplanation
self.accessibilityLabel = accessibilityLabel self.accessibilityLabel = accessibilityLabel
self.accessibilityId = accessibilityId self.accessibilityIdentifier = accessibilityId
self.stateToShow = stateToShow self.stateToShow = stateToShow
self.confirmTitle = confirmTitle self.confirmTitle = confirmTitle
self.confirmAccessibilityLabel = confirmAccessibilityLabel self.confirmAccessibilityLabel = confirmAccessibilityLabel
@ -241,8 +241,8 @@ public class ConfirmationModal: Modal {
cancelButton.setTitle(info.cancelTitle, for: .normal) cancelButton.setTitle(info.cancelTitle, for: .normal)
cancelButton.setThemeTitleColor(info.cancelStyle, for: .normal) cancelButton.setThemeTitleColor(info.cancelStyle, for: .normal)
self.accessibilityLabel = info.accessibilityLabel self.contentView.accessibilityLabel = info.accessibilityLabel
self.contentView.accessibilityIdentifier = info.accessibilityId self.contentView.accessibilityIdentifier = info.accessibilityIdentifier
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {

@ -58,6 +58,8 @@ class AttachmentTextToolbar: UIView, UITextViewDelegate {
self.themeBackgroundColor = .clear self.themeBackgroundColor = .clear
textView.delegate = self textView.delegate = self
textView.accessibilityIdentifier = "Text input box"
textView.isAccessibilityElement = true
let sendTitle = NSLocalizedString("ATTACHMENT_APPROVAL_SEND_BUTTON", comment: "Label for 'send' button in the 'attachment approval' dialog.") let sendTitle = NSLocalizedString("ATTACHMENT_APPROVAL_SEND_BUTTON", comment: "Label for 'send' button in the 'attachment approval' dialog.")
sendButton.setTitle(sendTitle, for: .normal) sendButton.setTitle(sendTitle, for: .normal)
@ -66,6 +68,8 @@ class AttachmentTextToolbar: UIView, UITextViewDelegate {
sendButton.titleLabel?.font = .boldSystemFont(ofSize: Values.mediumFontSize) sendButton.titleLabel?.font = .boldSystemFont(ofSize: Values.mediumFontSize)
sendButton.titleLabel?.textAlignment = .center sendButton.titleLabel?.textAlignment = .center
sendButton.themeTintColor = .textPrimary sendButton.themeTintColor = .textPrimary
sendButton.accessibilityIdentifier = "Send button"
sendButton.isAccessibilityElement = true
// Increase hit area of send button // Increase hit area of send button
sendButton.contentEdgeInsets = UIEdgeInsets(top: 6, left: 8, bottom: 6, right: 8) sendButton.contentEdgeInsets = UIEdgeInsets(top: 6, left: 8, bottom: 6, right: 8)

@ -40,6 +40,8 @@ public class ModalActivityIndicatorViewController: OWSViewController {
result.set(.width, to: 64) result.set(.width, to: 64)
result.set(.height, to: 64) result.set(.height, to: 64)
result.accessibilityIdentifier = "Loading animation"
ThemeManager.onThemeChange(observer: result) { [weak result] theme, _ in ThemeManager.onThemeChange(observer: result) { [weak result] theme, _ in
guard let textPrimary: UIColor = theme.color(for: .textPrimary) else { return } guard let textPrimary: UIColor = theme.color(for: .textPrimary) else { return }

Loading…
Cancel
Save