Add accessibility identifiers in the onboarding views.

pull/2/head
Matthew Chen 7 years ago
parent 90d304b155
commit d76fac1096

@ -32,6 +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"
pinTextField.textAlignment = .center
pinTextField.delegate = self
@ -41,6 +43,7 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
pinTextField.setContentHuggingHorizontalLow()
pinTextField.setCompressionResistanceHorizontalLow()
pinTextField.autoSetDimension(.height, toSize: 40)
pinTextField.accessibilityLabel = "onboarding.2fa." + "pinTextField"
pinStrokeNormal = pinTextField.addBottomStroke()
pinStrokeError = pinTextField.addBottomStroke(color: .ows_destructiveRed, strokeWidth: 2)
@ -50,6 +53,7 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
validationWarningLabel.textColor = .ows_destructiveRed
validationWarningLabel.font = UIFont.ows_dynamicTypeSubheadlineClamped
validationWarningLabel.textAlignment = .center
validationWarningLabel.accessibilityLabel = "onboarding.2fa." + "validationWarningLabel"
let validationWarningRow = UIView()
validationWarningRow.addSubview(validationWarningLabel)
@ -59,10 +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"
let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT",
comment: "Label for the 'next' button."),
selector: #selector(nextPressed))
nextButton.accessibilityLabel = "onboarding.2fa." + "nextButton"
let topSpacer = UIView.vStretchingSpacer()
let bottomSpacer = UIView.vStretchingSpacer()

@ -17,6 +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"
let titleRow = UIStackView(arrangedSubviews: [
titleLabel
@ -43,6 +44,7 @@ public class OnboardingCaptchaViewController: OnboardingBaseViewController {
webView.allowsLinkPreview = false
webView.scrollView.contentInset = .zero
webView.layoutMargins = .zero
webView.accessibilityLabel = "onboarding.captcha." + "webView"
let stackView = UIStackView(arrangedSubviews: [
titleRow,

@ -20,17 +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"
let explanationLabel = self.explanationLabel(explanationText: NSLocalizedString("ONBOARDING_PERMISSIONS_EXPLANATION",
comment: "Explanation in the 'onboarding permissions' view."))
explanationLabel.accessibilityLabel = "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"
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"
let stackView = UIStackView(arrangedSubviews: [
titleLabel,

@ -34,6 +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"
// Country
@ -43,6 +44,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
countryNameLabel.font = UIFont.ows_dynamicTypeBodyClamped
countryNameLabel.setContentHuggingHorizontalLow()
countryNameLabel.setCompressionResistanceHorizontalLow()
countryNameLabel.accessibilityLabel = "onboarding.phoneNumber." + "countryNameLabel"
let countryIcon = UIImage(named: (CurrentAppContext().isRTL
? "small_chevron_left"
@ -51,6 +53,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
countryImageView.tintColor = Theme.placeholderColor
countryImageView.setContentHuggingHigh()
countryImageView.setCompressionResistanceHigh()
countryImageView.accessibilityLabel = "onboarding.phoneNumber." + "countryImageView"
let countryRow = UIStackView(arrangedSubviews: [
countryNameLabel,
@ -63,6 +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"
callingCodeLabel.textColor = Theme.primaryColor
callingCodeLabel.font = UIFont.ows_dynamicTypeBodyClamped
@ -72,6 +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"
phoneNumberTextField.textAlignment = .left
phoneNumberTextField.delegate = self
@ -80,6 +85,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
phoneNumberTextField.font = UIFont.ows_dynamicTypeBodyClamped
phoneNumberTextField.setContentHuggingHorizontalLow()
phoneNumberTextField.setCompressionResistanceHorizontalLow()
phoneNumberTextField.accessibilityLabel = "onboarding.phoneNumber." + "phoneNumberTextField"
phoneStrokeNormal = phoneNumberTextField.addBottomStroke()
phoneStrokeError = phoneNumberTextField.addBottomStroke(color: .ows_destructiveRed, strokeWidth: 2)
@ -99,6 +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"
let validationWarningRow = UIView()
validationWarningRow.addSubview(validationWarningLabel)
@ -108,6 +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"
self.nextButton = nextButton
let topSpacer = UIView.vStretchingSpacer()
let bottomSpacer = UIView.vStretchingSpacer()

@ -31,13 +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"
let explanationLabel = self.explanationLabel(explanationText: NSLocalizedString("ONBOARDING_PROFILE_EXPLANATION",
comment: "Explanation in the 'onboarding profile' view."))
explanationLabel.accessibilityLabel = "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"
avatarView.autoSetDimensions(to: CGSize(width: CGFloat(avatarSize), height: CGFloat(avatarSize)))
@ -64,6 +67,7 @@ public class OnboardingProfileViewController: OnboardingBaseViewController {
avatarWrapper.addSubview(cameraCircle)
cameraCircle.autoPinEdge(toSuperviewEdge: .trailing)
cameraCircle.autoPinEdge(toSuperviewEdge: .bottom)
avatarWrapper.accessibilityLabel = "onboarding.profile." + "avatarWrapper"
nameTextfield.textAlignment = .left
nameTextfield.delegate = self
@ -74,6 +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"
let nameWrapper = UIView.container()
nameWrapper.setCompressionResistanceHorizontalLow()

@ -21,10 +21,12 @@ public class OnboardingSplashViewController: OnboardingBaseViewController {
heroImageView.layer.magnificationFilter = kCAFilterTrilinear
heroImageView.setCompressionResistanceLow()
heroImageView.setContentHuggingVerticalLow()
heroImageView.accessibilityLabel = "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"
let explanationLabel = UILabel()
explanationLabel.text = NSLocalizedString("ONBOARDING_SPLASH_TERM_AND_PRIVACY_POLICY",
@ -36,11 +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"
let continueButton = self.button(title: NSLocalizedString("BUTTON_CONTINUE",
comment: "Label for 'continue' button."),
selector: #selector(continuePressed))
view.addSubview(continueButton)
continueButton.accessibilityLabel = "onboarding.splash." + "continueButton"
let stackView = UIStackView(arrangedSubviews: [
heroImageView,

@ -277,11 +277,13 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
let titleLabel = self.titleLabel(text: "")
self.titleLabel = titleLabel
titleLabel.accessibilityLabel = "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"
onboardingCodeView.delegate = self
@ -291,6 +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"
// Wrap the error label in a row so that we can show/hide it without affecting view layout.
let errorRow = UIView()
@ -301,6 +304,7 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
selector: #selector(resendCodeLinkTapped))
codeStateLink.enableMultilineLabel()
self.codeStateLink = codeStateLink
codeStateLink.accessibilityLabel = "onboarding.verification." + "codeStateLink"
let topSpacer = UIView.vStretchingSpacer()
let bottomSpacer = UIView.vStretchingSpacer()

Loading…
Cancel
Save