diff --git a/Signal/src/ViewControllers/Registration/RegistrationViewController.m b/Signal/src/ViewControllers/Registration/RegistrationViewController.m index 2a2a0d914..374e2c742 100644 --- a/Signal/src/ViewControllers/Registration/RegistrationViewController.m +++ b/Signal/src/ViewControllers/Registration/RegistrationViewController.m @@ -18,6 +18,11 @@ 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 NSString *const kKeychainService_LastRegistered = @"kKeychainService_LastRegistered"; @@ -81,6 +86,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi self.view.userInteractionEnabled = YES; [self.view addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTapped:)]]; + self.view.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"root_view"); UIView *headerWrapper = [UIView containerView]; [self.view addSubview:headerWrapper]; @@ -112,6 +118,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi legalTopMatterLabel.textAlignment = NSTextAlignmentCenter; legalTopMatterLabel.attributedText = attributedLegalTopMatter; legalTopMatterLabel.userInteractionEnabled = YES; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, legalTopMatterLabel); UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapLegalTerms:)]; @@ -157,6 +164,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi [countryRow addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(countryCodeRowWasTapped:)]]; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, countryRow); UILabel *countryNameLabel = [UILabel new]; countryNameLabel.text @@ -216,6 +224,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi [phoneNumberRow addSubview:phoneNumberTextField]; [phoneNumberTextField autoVCenterInSuperview]; [phoneNumberTextField autoPinTrailingToSuperviewMargin]; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, phoneNumberTextField); UILabel *examplePhoneNumberLabel = [UILabel new]; self.examplePhoneNumberLabel = examplePhoneNumberLabel; @@ -253,6 +262,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi [activateButton autoPinLeadingAndTrailingToSuperviewMargin]; [activateButton autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:separatorView2 withOffset:15]; [activateButton autoSetDimension:ALDimensionHeight toSize:kActivateButtonHeight]; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, activateButton); UIActivityIndicatorView *spinnerView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; @@ -282,6 +292,8 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi withOffset:ScaleFromIPhone5To7Plus(8, 12)]; [bottomLegalLinkButton setCompressionResistanceHigh]; [bottomLegalLinkButton setContentHuggingHigh]; + + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, bottomLegalLinkButton); } - (void)viewDidAppear:(BOOL)animated