diff --git a/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m index 659a30514..b327efd96 100644 --- a/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m @@ -46,16 +46,18 @@ NS_ASSUME_NONNULL_BEGIN - (void)updateNavigationItems { - self.navigationItem.leftBarButtonItem = - [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel - target:self - action:@selector(cancelWasPressed:)]; + UIBarButtonItem *cancelItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel + target:self + action:@selector(cancelWasPressed:)]; + cancelItem.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"cancel"); + self.navigationItem.leftBarButtonItem = cancelItem; if (self.isDirty) { - self.navigationItem.rightBarButtonItem = - [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave - target:self - action:@selector(saveWasPressed:)]; + UIBarButtonItem *saveItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave + target:self + action:@selector(saveWasPressed:)]; + saveItem.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"save"); + self.navigationItem.rightBarButtonItem = saveItem; } else { self.navigationItem.rightBarButtonItem = nil; } diff --git a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m index 1f9d32835..d820353df 100644 --- a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m +++ b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m @@ -419,16 +419,22 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s [alertController addAction:[OWSAlerts cancelAction]]; - UIAlertAction *deleteAction = [UIAlertAction - actionWithTitle:NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION_BUTTON", - @"Confirmation text for button which deletes all message, calling, attachments, etc.") - style:UIAlertActionStyleDestructive - handler:^(UIAlertAction *_Nonnull action) { - [self deleteThreadsAndMessages]; - }]; + UIAlertAction *deleteAction = + [UIAlertAction actionWithTitle: + NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION_BUTTON", + @"Confirmation text for button which deletes all message, calling, attachments, etc.") + accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"delete") + style:UIAlertActionStyleDestructive + handler:^(UIAlertAction *_Nonnull action) { + [self deleteThreadsAndMessages]; + }]; [alertController addAction:deleteAction]; - [self presentViewController:alertController animated:true completion:nil]; + [self presentViewController:alertController + animated:true + completion:^{ + [alertController applyAccessibilityIdentifiers]; + }]; } - (void)deleteThreadsAndMessages diff --git a/Signal/src/ViewControllers/OWS2FASettingsViewController.m b/Signal/src/ViewControllers/OWS2FASettingsViewController.m index 5a8dbd6e5..320e638c4 100644 --- a/Signal/src/ViewControllers/OWS2FASettingsViewController.m +++ b/Signal/src/ViewControllers/OWS2FASettingsViewController.m @@ -122,6 +122,7 @@ NS_ASSUME_NONNULL_BEGIN [self.pinTextfield addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _pinTextfield); [self.view addSubview:self.pinTextfield]; } @@ -144,6 +145,7 @@ NS_ASSUME_NONNULL_BEGIN : NSLocalizedString(@"ENABLE_2FA_VIEW_STATUS_DISABLED_INSTRUCTIONS", @"Indicates that user has 'two factor auth pin' disabled.")); UILabel *instructionsLabel = [self createLabelWithText:instructions]; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, instructionsLabel); [self createTableView]; @@ -191,6 +193,7 @@ NS_ASSUME_NONNULL_BEGIN [instructionsLabel autoPinTopToSuperviewMarginWithInset:kVSpacing]; [instructionsLabel autoPinEdgeToSuperviewSafeArea:ALEdgeLeading withInset:self.hMargin]; [instructionsLabel autoPinEdgeToSuperviewSafeArea:ALEdgeTrailing withInset:self.hMargin]; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, instructionsLabel); [self.pinTextfield autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:instructionsLabel withOffset:kVSpacing]; [self.pinTextfield autoPinEdgeToSuperviewSafeArea:ALEdgeLeading withInset:self.hMargin]; @@ -221,6 +224,7 @@ NS_ASSUME_NONNULL_BEGIN addItem:[OWSTableItem disclosureItemWithText: NSLocalizedString(@"ENABLE_2FA_VIEW_DISABLE_2FA", @"Label for the 'enable two-factor auth' item in the settings view") + accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"enable_2fa") actionBlock:^{ [weakSelf tryToDisable2FA]; }]]; @@ -229,6 +233,7 @@ NS_ASSUME_NONNULL_BEGIN addItem:[OWSTableItem disclosureItemWithText: NSLocalizedString(@"ENABLE_2FA_VIEW_ENABLE_2FA", @"Label for the 'enable two-factor auth' item in the settings view") + accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"disable_2fa") actionBlock:^{ [weakSelf showEnable2FAWorkUI]; }]]; @@ -259,19 +264,23 @@ NS_ASSUME_NONNULL_BEGIN // Note: This affects how the "back" button will look if another // view is pushed on top of this one, not how the "back" // button looks when this view is visible. - self.navigationItem.backBarButtonItem = + UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BACK_BUTTON", @"button text for back button") style:UIBarButtonItemStylePlain target:self action:@selector(backButtonWasPressed)]; + backButton.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"back"); + self.navigationItem.backBarButtonItem = backButton; if (self.shouldHaveNextButton) { - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] + UIBarButtonItem *nextButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"ENABLE_2FA_VIEW_NEXT_BUTTON", @"Label for the 'next' button in the 'enable two factor auth' views.") style:UIBarButtonItemStylePlain target:self action:@selector(nextButtonWasPressed)]; + nextButton.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"next"); + self.navigationItem.rightBarButtonItem = nextButton; } else { self.navigationItem.rightBarButtonItem = nil; } diff --git a/SignalMessaging/Views/UIAlertController+OWS.swift b/SignalMessaging/Views/UIAlertController+OWS.swift index 4e25bc350..a8dec91da 100644 --- a/SignalMessaging/Views/UIAlertController+OWS.swift +++ b/SignalMessaging/Views/UIAlertController+OWS.swift @@ -10,7 +10,7 @@ extension UIAlertController { for action in actions { guard let view = action.value(forKey: "__representer") as? UIView else { owsFailDebug("Missing representer.") - return + continue } view.accessibilityIdentifier = action.accessibilityIdentifier }