Add accessibility identifiers in the onboarding views.

pull/2/head
Matthew Chen 6 years ago
parent 050a9676f6
commit 991974ee35

@ -32,8 +32,8 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
comment: "The first explanation in the 'onboarding 2FA' view."))
explanationLabel1.font = UIFont.ows_dynamicTypeCaption1
explanationLabel2.font = UIFont.ows_dynamicTypeCaption1
explanationLabel1.accessibilityLabel = "onboarding.2fa." + "explanationLabel1"
explanationLabel2.accessibilityLabel = "onboarding.2fa." + "explanationLabel2"
explanationLabel1.accessibilityIdentifier = "onboarding.2fa." + "explanationLabel1"
explanationLabel2.accessibilityIdentifier = "onboarding.2fa." + "explanationLabel2"
pinTextField.textAlignment = .center
pinTextField.delegate = self
@ -43,7 +43,7 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
pinTextField.setContentHuggingHorizontalLow()
pinTextField.setCompressionResistanceHorizontalLow()
pinTextField.autoSetDimension(.height, toSize: 40)
pinTextField.accessibilityLabel = "onboarding.2fa." + "pinTextField"
pinTextField.accessibilityIdentifier = "onboarding.2fa." + "pinTextField"
pinStrokeNormal = pinTextField.addBottomStroke()
pinStrokeError = pinTextField.addBottomStroke(color: .ows_destructiveRed, strokeWidth: 2)
@ -53,7 +53,7 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
validationWarningLabel.textColor = .ows_destructiveRed
validationWarningLabel.font = UIFont.ows_dynamicTypeSubheadlineClamped
validationWarningLabel.textAlignment = .center
validationWarningLabel.accessibilityLabel = "onboarding.2fa." + "validationWarningLabel"
validationWarningLabel.accessibilityIdentifier = "onboarding.2fa." + "validationWarningLabel"
let validationWarningRow = UIView()
validationWarningRow.addSubview(validationWarningLabel)
@ -63,12 +63,12 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
let forgotPinLink = self.linkButton(title: NSLocalizedString("ONBOARDING_2FA_FORGOT_PIN_LINK",
comment: "Label for the 'forgot 2FA PIN' link in the 'onboarding 2FA' view."),
selector: #selector(forgotPinLinkTapped))
forgotPinLink.accessibilityLabel = "onboarding.2fa." + "forgotPinLink"
forgotPinLink.accessibilityIdentifier = "onboarding.2fa." + "forgotPinLink"
let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT",
comment: "Label for the 'next' button."),
selector: #selector(nextPressed))
nextButton.accessibilityLabel = "onboarding.2fa." + "nextButton"
nextButton.accessibilityIdentifier = "onboarding.2fa." + "nextButton"
let topSpacer = UIView.vStretchingSpacer()
let bottomSpacer = UIView.vStretchingSpacer()

@ -17,7 +17,7 @@ public class OnboardingCaptchaViewController: OnboardingBaseViewController {
view.layoutMargins = .zero
let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_CAPTCHA_TITLE", comment: "Title of the 'onboarding Captcha' view."))
titleLabel.accessibilityLabel = "onboarding.captcha." + "titleLabel"
titleLabel.accessibilityIdentifier = "onboarding.captcha." + "titleLabel"
let titleRow = UIStackView(arrangedSubviews: [
titleLabel
@ -44,7 +44,7 @@ public class OnboardingCaptchaViewController: OnboardingBaseViewController {
webView.allowsLinkPreview = false
webView.scrollView.contentInset = .zero
webView.layoutMargins = .zero
webView.accessibilityLabel = "onboarding.captcha." + "webView"
webView.accessibilityIdentifier = "onboarding.captcha." + "webView"
let stackView = UIStackView(arrangedSubviews: [
titleRow,

@ -20,21 +20,21 @@ public class OnboardingPermissionsViewController: OnboardingBaseViewController {
action: #selector(skipWasPressed))
let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_PERMISSIONS_TITLE", comment: "Title of the 'onboarding permissions' view."))
titleLabel.accessibilityLabel = "onboarding.permissions." + "titleLabel"
titleLabel.accessibilityIdentifier = "onboarding.permissions." + "titleLabel"
let explanationLabel = self.explanationLabel(explanationText: NSLocalizedString("ONBOARDING_PERMISSIONS_EXPLANATION",
comment: "Explanation in the 'onboarding permissions' view."))
explanationLabel.accessibilityLabel = "onboarding.permissions." + "explanationLabel"
explanationLabel.accessibilityIdentifier = "onboarding.permissions." + "explanationLabel"
let giveAccessButton = self.button(title: NSLocalizedString("ONBOARDING_PERMISSIONS_ENABLE_PERMISSIONS_BUTTON",
comment: "Label for the 'give access' button in the 'onboarding permissions' view."),
selector: #selector(giveAccessPressed))
giveAccessButton.accessibilityLabel = "onboarding.permissions." + "giveAccessButton"
giveAccessButton.accessibilityIdentifier = "onboarding.permissions." + "giveAccessButton"
let notNowButton = self.linkButton(title: NSLocalizedString("ONBOARDING_PERMISSIONS_NOT_NOW_BUTTON",
comment: "Label for the 'not now' button in the 'onboarding permissions' view."),
selector: #selector(notNowPressed))
notNowButton.accessibilityLabel = "onboarding.permissions." + "notNowButton"
notNowButton.accessibilityIdentifier = "onboarding.permissions." + "notNowButton"
let stackView = UIStackView(arrangedSubviews: [
titleLabel,

@ -34,7 +34,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
view.layoutMargins = .zero
let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_PHONE_NUMBER_TITLE", comment: "Title of the 'onboarding phone number' view."))
titleLabel.accessibilityLabel = "onboarding.phoneNumber." + "titleLabel"
titleLabel.accessibilityIdentifier = "onboarding.phoneNumber." + "titleLabel"
// Country
@ -44,7 +44,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
countryNameLabel.font = UIFont.ows_dynamicTypeBodyClamped
countryNameLabel.setContentHuggingHorizontalLow()
countryNameLabel.setCompressionResistanceHorizontalLow()
countryNameLabel.accessibilityLabel = "onboarding.phoneNumber." + "countryNameLabel"
countryNameLabel.accessibilityIdentifier = "onboarding.phoneNumber." + "countryNameLabel"
let countryIcon = UIImage(named: (CurrentAppContext().isRTL
? "small_chevron_left"
@ -53,7 +53,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
countryImageView.tintColor = Theme.placeholderColor
countryImageView.setContentHuggingHigh()
countryImageView.setCompressionResistanceHigh()
countryImageView.accessibilityLabel = "onboarding.phoneNumber." + "countryImageView"
countryImageView.accessibilityIdentifier = "onboarding.phoneNumber." + "countryImageView"
let countryRow = UIStackView(arrangedSubviews: [
countryNameLabel,
@ -66,7 +66,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
countryRow.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(countryRowTapped)))
countryRow.autoSetDimension(.height, toSize: rowHeight)
_ = countryRow.addBottomStroke()
countryRow.accessibilityLabel = "onboarding.phoneNumber." + "countryRow"
countryRow.accessibilityIdentifier = "onboarding.phoneNumber." + "countryRow"
callingCodeLabel.textColor = Theme.primaryColor
callingCodeLabel.font = UIFont.ows_dynamicTypeBodyClamped
@ -76,7 +76,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
callingCodeLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(countryCodeTapped)))
_ = callingCodeLabel.addBottomStroke()
callingCodeLabel.autoSetDimension(.width, toSize: rowHeight, relation: .greaterThanOrEqual)
callingCodeLabel.accessibilityLabel = "onboarding.phoneNumber." + "callingCodeLabel"
callingCodeLabel.accessibilityIdentifier = "onboarding.phoneNumber." + "callingCodeLabel"
phoneNumberTextField.textAlignment = .left
phoneNumberTextField.delegate = self
@ -85,7 +85,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
phoneNumberTextField.font = UIFont.ows_dynamicTypeBodyClamped
phoneNumberTextField.setContentHuggingHorizontalLow()
phoneNumberTextField.setCompressionResistanceHorizontalLow()
phoneNumberTextField.accessibilityLabel = "onboarding.phoneNumber." + "phoneNumberTextField"
phoneNumberTextField.accessibilityIdentifier = "onboarding.phoneNumber." + "phoneNumberTextField"
phoneStrokeNormal = phoneNumberTextField.addBottomStroke()
phoneStrokeError = phoneNumberTextField.addBottomStroke(color: .ows_destructiveRed, strokeWidth: 2)
@ -105,7 +105,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
validationWarningLabel.textColor = .ows_destructiveRed
validationWarningLabel.font = UIFont.ows_dynamicTypeSubheadlineClamped
validationWarningLabel.autoSetDimension(.height, toSize: validationWarningLabel.font.lineHeight)
validationWarningLabel.accessibilityLabel = "onboarding.phoneNumber." + "validationWarningLabel"
validationWarningLabel.accessibilityIdentifier = "onboarding.phoneNumber." + "validationWarningLabel"
let validationWarningRow = UIView()
validationWarningRow.addSubview(validationWarningLabel)
@ -115,7 +115,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT",
comment: "Label for the 'next' button."),
selector: #selector(nextPressed))
nextButton.accessibilityLabel = "onboarding.phoneNumber." + "nextButton"
nextButton.accessibilityIdentifier = "onboarding.phoneNumber." + "nextButton"
self.nextButton = nextButton
let topSpacer = UIView.vStretchingSpacer()
let bottomSpacer = UIView.vStretchingSpacer()

@ -31,16 +31,16 @@ public class OnboardingProfileViewController: OnboardingBaseViewController {
view.layoutMargins = .zero
let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_PROFILE_TITLE", comment: "Title of the 'onboarding profile' view."))
titleLabel.accessibilityLabel = "onboarding.profile." + "titleLabel"
titleLabel.accessibilityIdentifier = "onboarding.profile." + "titleLabel"
let explanationLabel = self.explanationLabel(explanationText: NSLocalizedString("ONBOARDING_PROFILE_EXPLANATION",
comment: "Explanation in the 'onboarding profile' view."))
explanationLabel.accessibilityLabel = "onboarding.profile." + "explanationLabel"
explanationLabel.accessibilityIdentifier = "onboarding.profile." + "explanationLabel"
let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT",
comment: "Label for the 'next' button."),
selector: #selector(nextPressed))
nextButton.accessibilityLabel = "onboarding.profile." + "nextButton"
nextButton.accessibilityIdentifier = "onboarding.profile." + "nextButton"
avatarView.autoSetDimensions(to: CGSize(width: CGFloat(avatarSize), height: CGFloat(avatarSize)))
@ -67,7 +67,7 @@ public class OnboardingProfileViewController: OnboardingBaseViewController {
avatarWrapper.addSubview(cameraCircle)
cameraCircle.autoPinEdge(toSuperviewEdge: .trailing)
cameraCircle.autoPinEdge(toSuperviewEdge: .bottom)
avatarWrapper.accessibilityLabel = "onboarding.profile." + "avatarWrapper"
avatarWrapper.accessibilityIdentifier = "onboarding.profile." + "avatarWrapper"
nameTextfield.textAlignment = .left
nameTextfield.delegate = self
@ -78,7 +78,7 @@ public class OnboardingProfileViewController: OnboardingBaseViewController {
comment: "Placeholder text for the profile name in the 'onboarding profile' view.")
nameTextfield.setContentHuggingHorizontalLow()
nameTextfield.setCompressionResistanceHorizontalLow()
nameTextfield.accessibilityLabel = "onboarding.profile." + "nameTextfield"
nameTextfield.accessibilityIdentifier = "onboarding.profile." + "nameTextfield"
let nameWrapper = UIView.container()
nameWrapper.setCompressionResistanceHorizontalLow()

@ -21,12 +21,12 @@ public class OnboardingSplashViewController: OnboardingBaseViewController {
heroImageView.layer.magnificationFilter = kCAFilterTrilinear
heroImageView.setCompressionResistanceLow()
heroImageView.setContentHuggingVerticalLow()
heroImageView.accessibilityLabel = "onboarding.splash." + "heroImageView"
heroImageView.accessibilityIdentifier = "onboarding.splash." + "heroImageView"
let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_SPLASH_TITLE", comment: "Title of the 'onboarding splash' view."))
view.addSubview(titleLabel)
titleLabel.autoPinEdges(toSuperviewMarginsExcludingEdge: .bottom)
titleLabel.accessibilityLabel = "onboarding.splash." + "titleLabel"
titleLabel.accessibilityIdentifier = "onboarding.splash." + "titleLabel"
let explanationLabel = UILabel()
explanationLabel.text = NSLocalizedString("ONBOARDING_SPLASH_TERM_AND_PRIVACY_POLICY",
@ -38,13 +38,13 @@ public class OnboardingSplashViewController: OnboardingBaseViewController {
explanationLabel.lineBreakMode = .byWordWrapping
explanationLabel.isUserInteractionEnabled = true
explanationLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(explanationLabelTapped)))
explanationLabel.accessibilityLabel = "onboarding.splash." + "explanationLabel"
explanationLabel.accessibilityIdentifier = "onboarding.splash." + "explanationLabel"
let continueButton = self.button(title: NSLocalizedString("BUTTON_CONTINUE",
comment: "Label for 'continue' button."),
selector: #selector(continuePressed))
view.addSubview(continueButton)
continueButton.accessibilityLabel = "onboarding.splash." + "continueButton"
continueButton.accessibilityIdentifier = "onboarding.splash." + "continueButton"
let stackView = UIStackView(arrangedSubviews: [
heroImageView,

@ -277,13 +277,13 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
let titleLabel = self.titleLabel(text: "")
self.titleLabel = titleLabel
titleLabel.accessibilityLabel = "onboarding.verification." + "titleLabel"
titleLabel.accessibilityIdentifier = "onboarding.verification." + "titleLabel"
let backLink = self.linkButton(title: NSLocalizedString("ONBOARDING_VERIFICATION_BACK_LINK",
comment: "Label for the link that lets users change their phone number in the onboarding views."),
selector: #selector(backLinkTapped))
self.backLink = backLink
backLink.accessibilityLabel = "onboarding.verification." + "backLink"
backLink.accessibilityIdentifier = "onboarding.verification." + "backLink"
onboardingCodeView.delegate = self
@ -293,7 +293,7 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
errorLabel.font = UIFont.ows_dynamicTypeBodyClamped.ows_mediumWeight()
errorLabel.textAlignment = .center
errorLabel.autoSetDimension(.height, toSize: errorLabel.font.lineHeight)
errorLabel.accessibilityLabel = "onboarding.verification." + "errorLabel"
errorLabel.accessibilityIdentifier = "onboarding.verification." + "errorLabel"
// Wrap the error label in a row so that we can show/hide it without affecting view layout.
let errorRow = UIView()
@ -304,7 +304,7 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
selector: #selector(resendCodeLinkTapped))
codeStateLink.enableMultilineLabel()
self.codeStateLink = codeStateLink
codeStateLink.accessibilityLabel = "onboarding.verification." + "codeStateLink"
codeStateLink.accessibilityIdentifier = "onboarding.verification." + "codeStateLink"
let topSpacer = UIView.vStretchingSpacer()
let bottomSpacer = UIView.vStretchingSpacer()

Loading…
Cancel
Save