Merge branch 'charlesmchen/accessibilityIds062019'
This commit is contained in:
commit
c28a758263
@ -263,6 +263,8 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
||||
remoteVideoView = RemoteVideoView()
|
||||
remoteVideoView.isUserInteractionEnabled = false
|
||||
localVideoView = RTCCameraPreviewView()
|
||||
remoteVideoView.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "remoteVideoView")
|
||||
localVideoView.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "localVideoView")
|
||||
|
||||
remoteVideoView.isHidden = true
|
||||
localVideoView.isHidden = true
|
||||
@ -315,6 +317,11 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
||||
self.view.addSubview(contactAvatarContainerView)
|
||||
contactAvatarView = AvatarImageView()
|
||||
contactAvatarContainerView.addSubview(contactAvatarView)
|
||||
|
||||
leaveCallViewButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "leaveCallViewButton")
|
||||
contactNameLabel.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "contactNameLabel")
|
||||
callStatusLabel.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "callStatusLabel")
|
||||
contactAvatarView.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "contactAvatarView")
|
||||
}
|
||||
|
||||
func createSettingsNagViews() {
|
||||
@ -365,6 +372,10 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
||||
notNowButton.autoPinWidthToSuperview()
|
||||
notNowButton.autoPinEdge(toSuperviewEdge: .bottom)
|
||||
notNowButton.autoPinEdge(.top, to: .bottom, of: callSettingsButton, withOffset: 12)
|
||||
|
||||
settingsNagDescriptionLabel.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "settingsNagDescriptionLabel")
|
||||
callSettingsButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "callSettingsButton")
|
||||
notNowButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "notNowButton")
|
||||
}
|
||||
|
||||
func buttonSize() -> CGFloat {
|
||||
@ -429,6 +440,14 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
||||
ongoingVideoCallControls = UIStackView(arrangedSubviews: [videoModeMuteButton, videoModeFlipCameraButton, videoModeVideoButton])
|
||||
ongoingAudioCallControls.distribution = .equalSpacing
|
||||
ongoingVideoCallControls.axis = .horizontal
|
||||
|
||||
audioSourceButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "audioSourceButton")
|
||||
hangUpButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "hangUpButton")
|
||||
audioModeMuteButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "audioModeMuteButton")
|
||||
audioModeVideoButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "audioModeVideoButton")
|
||||
videoModeMuteButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "videoModeMuteButton")
|
||||
videoModeFlipCameraButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "videoModeFlipCameraButton")
|
||||
videoModeVideoButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "videoModeVideoButton")
|
||||
}
|
||||
|
||||
func presentAudioSourcePicker() {
|
||||
@ -482,6 +501,9 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
||||
incomingCallControls.distribution = .equalSpacing
|
||||
|
||||
view.addSubview(incomingCallControls)
|
||||
|
||||
acceptIncomingButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "acceptIncomingButton")
|
||||
declineIncomingButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "declineIncomingButton")
|
||||
}
|
||||
|
||||
func createButton(image: UIImage, action: Selector) -> UIButton {
|
||||
|
||||
@ -4596,9 +4596,18 @@ typedef enum : NSUInteger {
|
||||
|
||||
[cell loadForDisplay];
|
||||
|
||||
#ifdef DEBUG
|
||||
// TODO: Confirm with nancy if this will work.
|
||||
NSString *cellName = [NSString stringWithFormat:@"interaction.%@", NSUUID.UUID.UUIDString];
|
||||
if (viewItem.hasBodyText && viewItem.displayableBodyText.displayText.length > 0) {
|
||||
NSString *textForId =
|
||||
[viewItem.displayableBodyText.displayText stringByReplacingOccurrencesOfString:@" " withString:@"_"];
|
||||
cellName = [NSString stringWithFormat:@"message.text.%@", textForId];
|
||||
} else if (viewItem.stickerInfo) {
|
||||
cellName = [NSString stringWithFormat:@"message.sticker.%@", [viewItem.stickerInfo asKey]];
|
||||
}
|
||||
cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, cellName);
|
||||
#endif
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ public protocol StickerHorizontalListViewItem {
|
||||
var view: UIView { get }
|
||||
var didSelectBlock: () -> Void { get }
|
||||
var isSelected: Bool { get }
|
||||
var accessibilityName: String { get }
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
@ -43,6 +44,11 @@ public class StickerHorizontalListViewItemSticker: NSObject, StickerHorizontalLi
|
||||
public var isSelected: Bool {
|
||||
return isSelectedBlock()
|
||||
}
|
||||
|
||||
public var accessibilityName: String {
|
||||
// We just need a stable identifier.
|
||||
return "pack." + stickerInfo.asKey()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
@ -67,6 +73,10 @@ public class StickerHorizontalListViewItemRecents: NSObject, StickerHorizontalLi
|
||||
public var isSelected: Bool {
|
||||
return isSelectedBlock()
|
||||
}
|
||||
|
||||
public var accessibilityName: String {
|
||||
return "recents"
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
@ -198,6 +208,10 @@ extension StickerHorizontalListView: UICollectionViewDataSource {
|
||||
let itemView = item.view
|
||||
cell.contentView.addSubview(itemView)
|
||||
itemView.autoPinEdgesToSuperviewEdges(with: UIEdgeInsets(top: cellInset, leading: cellInset, bottom: cellInset, trailing: cellInset))
|
||||
|
||||
itemView.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: item.accessibilityName + ".item")
|
||||
cell.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: item.accessibilityName + ".cell")
|
||||
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,6 +162,7 @@ public class StickerKeyboard: UIStackView {
|
||||
self?.searchButtonWasTapped()
|
||||
}
|
||||
headerView.addArrangedSubview(searchButton)
|
||||
searchButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "searchButton")
|
||||
}
|
||||
|
||||
packsCollectionView.backgroundColor = keyboardBackgroundColor
|
||||
@ -171,6 +172,7 @@ public class StickerKeyboard: UIStackView {
|
||||
self?.manageButtonWasTapped()
|
||||
}
|
||||
headerView.addArrangedSubview(manageButton)
|
||||
manageButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "manageButton")
|
||||
|
||||
updateHeaderView()
|
||||
}
|
||||
|
||||
@ -287,6 +287,10 @@ extension StickerPackCollectionView: UICollectionViewDataSource {
|
||||
cell.contentView.addSubview(stickerView)
|
||||
stickerView.autoPinEdgesToSuperviewEdges()
|
||||
|
||||
let accessibilityName = "sticker." + stickerInfo.asKey()
|
||||
cell.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: accessibilityName + ".cell")
|
||||
stickerView.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: accessibilityName + ".item")
|
||||
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,6 +78,7 @@ public class StickerPackViewController: OWSViewController {
|
||||
dismissButton.setTemplateImageName("x-24", tintColor: Theme.darkThemePrimaryColor)
|
||||
dismissButton.addTarget(self, action: #selector(dismissButtonPressed(sender:)), for: .touchUpInside)
|
||||
dismissButton.contentEdgeInsets = UIEdgeInsets(top: 20, leading: hMargin, bottom: 20, trailing: hMargin)
|
||||
dismissButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "dismissButton")
|
||||
|
||||
coverView.autoSetDimensions(to: CGSize(width: 48, height: 48))
|
||||
coverView.setCompressionResistanceHigh()
|
||||
@ -95,6 +96,7 @@ public class StickerPackViewController: OWSViewController {
|
||||
if FeatureFlags.stickerSharing {
|
||||
shareButton.setTemplateImageName("forward-outline-24", tintColor: Theme.darkThemePrimaryColor)
|
||||
shareButton.addTarget(self, action: #selector(shareButtonPressed(sender:)), for: .touchUpInside)
|
||||
shareButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "shareButton")
|
||||
}
|
||||
|
||||
view.addSubview(dismissButton)
|
||||
@ -131,23 +133,23 @@ public class StickerPackViewController: OWSViewController {
|
||||
stickerCollectionView.autoPinEdge(.top, to: .bottom, of: headerStack)
|
||||
stickerCollectionView.autoPinEdge(toSuperviewMargin: .bottom)
|
||||
|
||||
installButton = OWSFlatButton.button(title: NSLocalizedString("STICKERS_INSTALL_BUTTON", comment: "Label for the 'install sticker pack' button."),
|
||||
let installButton = OWSFlatButton.button(title: NSLocalizedString("STICKERS_INSTALL_BUTTON", comment: "Label for the 'install sticker pack' button."),
|
||||
font: UIFont.ows_dynamicTypeBody.ows_mediumWeight(),
|
||||
titleColor: UIColor.ows_materialBlue,
|
||||
backgroundColor: UIColor.white,
|
||||
target: self,
|
||||
selector: #selector(didTapInstall))
|
||||
uninstallButton = OWSFlatButton.button(title: NSLocalizedString("STICKERS_UNINSTALL_BUTTON", comment: "Label for the 'uninstall sticker pack' button."),
|
||||
self.installButton = installButton
|
||||
installButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "installButton")
|
||||
let uninstallButton = OWSFlatButton.button(title: NSLocalizedString("STICKERS_UNINSTALL_BUTTON", comment: "Label for the 'uninstall sticker pack' button."),
|
||||
font: UIFont.ows_dynamicTypeBody.ows_mediumWeight(),
|
||||
titleColor: UIColor.ows_materialBlue,
|
||||
backgroundColor: UIColor.white,
|
||||
target: self,
|
||||
selector: #selector(didTapUninstall))
|
||||
self.uninstallButton = uninstallButton
|
||||
uninstallButton.accessibilityIdentifier = UIView.accessibilityIdentifier(in: self, name: "uninstallButton")
|
||||
for button in [installButton, uninstallButton] {
|
||||
guard let button = button else {
|
||||
owsFailDebug("Missing button.")
|
||||
continue
|
||||
}
|
||||
view.addSubview(button)
|
||||
button.autoPin(toBottomLayoutGuideOf: self, withInset: 0)
|
||||
button.autoPinWidthToSuperview(withMargin: hMargin)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user