Add accessibility identifiers to privacy popups and subviews.

pull/2/head
Matthew Chen 6 years ago
parent f37a3059fa
commit cb5ce42e76

@ -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;
}

@ -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

@ -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;
}

@ -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
}

Loading…
Cancel
Save