Add accessibility identifiers to registration view.

pull/2/head
Matthew Chen 7 years ago
parent 0dc0ef6448
commit a02531d224

@ -18,6 +18,11 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
#define SUBVIEW_ACCESSIBILITY_IDENTIFIER(_root_view, _variable_name) \
([NSString stringWithFormat:@"%@.%@", _root_view.class, _variable_name])
#define SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(_root_view, _variable_name) \
_variable_name.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(_root_view, (@ #_variable_name))
#ifdef DEBUG #ifdef DEBUG
NSString *const kKeychainService_LastRegistered = @"kKeychainService_LastRegistered"; NSString *const kKeychainService_LastRegistered = @"kKeychainService_LastRegistered";
@ -81,6 +86,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
self.view.userInteractionEnabled = YES; self.view.userInteractionEnabled = YES;
[self.view [self.view
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTapped:)]]; addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTapped:)]];
self.view.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"root_view");
UIView *headerWrapper = [UIView containerView]; UIView *headerWrapper = [UIView containerView];
[self.view addSubview:headerWrapper]; [self.view addSubview:headerWrapper];
@ -112,6 +118,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
legalTopMatterLabel.textAlignment = NSTextAlignmentCenter; legalTopMatterLabel.textAlignment = NSTextAlignmentCenter;
legalTopMatterLabel.attributedText = attributedLegalTopMatter; legalTopMatterLabel.attributedText = attributedLegalTopMatter;
legalTopMatterLabel.userInteractionEnabled = YES; legalTopMatterLabel.userInteractionEnabled = YES;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, legalTopMatterLabel);
UITapGestureRecognizer *tapGesture = UITapGestureRecognizer *tapGesture =
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapLegalTerms:)]; [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapLegalTerms:)];
@ -157,6 +164,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
[countryRow [countryRow
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(countryCodeRowWasTapped:)]]; action:@selector(countryCodeRowWasTapped:)]];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, countryRow);
UILabel *countryNameLabel = [UILabel new]; UILabel *countryNameLabel = [UILabel new];
countryNameLabel.text countryNameLabel.text
@ -216,6 +224,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
[phoneNumberRow addSubview:phoneNumberTextField]; [phoneNumberRow addSubview:phoneNumberTextField];
[phoneNumberTextField autoVCenterInSuperview]; [phoneNumberTextField autoVCenterInSuperview];
[phoneNumberTextField autoPinTrailingToSuperviewMargin]; [phoneNumberTextField autoPinTrailingToSuperviewMargin];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, phoneNumberTextField);
UILabel *examplePhoneNumberLabel = [UILabel new]; UILabel *examplePhoneNumberLabel = [UILabel new];
self.examplePhoneNumberLabel = examplePhoneNumberLabel; self.examplePhoneNumberLabel = examplePhoneNumberLabel;
@ -253,6 +262,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
[activateButton autoPinLeadingAndTrailingToSuperviewMargin]; [activateButton autoPinLeadingAndTrailingToSuperviewMargin];
[activateButton autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:separatorView2 withOffset:15]; [activateButton autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:separatorView2 withOffset:15];
[activateButton autoSetDimension:ALDimensionHeight toSize:kActivateButtonHeight]; [activateButton autoSetDimension:ALDimensionHeight toSize:kActivateButtonHeight];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, activateButton);
UIActivityIndicatorView *spinnerView = UIActivityIndicatorView *spinnerView =
[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
@ -282,6 +292,8 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
withOffset:ScaleFromIPhone5To7Plus(8, 12)]; withOffset:ScaleFromIPhone5To7Plus(8, 12)];
[bottomLegalLinkButton setCompressionResistanceHigh]; [bottomLegalLinkButton setCompressionResistanceHigh];
[bottomLegalLinkButton setContentHuggingHigh]; [bottomLegalLinkButton setContentHuggingHigh];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, bottomLegalLinkButton);
} }
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated

Loading…
Cancel
Save