Add accessibility identifiers to app settings view.

pull/2/head
Matthew Chen 6 years ago
parent 931d249677
commit c619f815b5

@ -164,6 +164,8 @@
} }
[accessoryLabel sizeToFit]; [accessoryLabel sizeToFit];
cell.accessoryView = accessoryLabel; cell.accessoryView = accessoryLabel;
cell.accessibilityIdentifier
= SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"network_status");
return cell; return cell;
} }
actionBlock:nil]]; actionBlock:nil]];
@ -171,24 +173,29 @@
[section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_INVITE_TITLE", [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_INVITE_TITLE",
@"Settings table view cell label") @"Settings table view cell label")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"invite")
actionBlock:^{ actionBlock:^{
[weakSelf showInviteFlow]; [weakSelf showInviteFlow];
}]]; }]];
[section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_TITLE", [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_TITLE",
@"Settings table view cell label") @"Settings table view cell label")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"privacy")
actionBlock:^{ actionBlock:^{
[weakSelf showPrivacy]; [weakSelf showPrivacy];
}]]; }]];
[section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_NOTIFICATIONS", nil) [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_NOTIFICATIONS", nil)
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"notifications")
actionBlock:^{ actionBlock:^{
[weakSelf showNotifications]; [weakSelf showNotifications];
}]]; }]];
[section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"LINKED_DEVICES_TITLE", [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"LINKED_DEVICES_TITLE",
@"Menu item and navbar title for the device manager") @"Menu item and navbar title for the device manager")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"linked_devices")
actionBlock:^{ actionBlock:^{
[weakSelf showLinkedDevices]; [weakSelf showLinkedDevices];
}]]; }]];
[section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_TITLE", @"") [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_TITLE", @"")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"advanced")
actionBlock:^{ actionBlock:^{
[weakSelf showAdvanced]; [weakSelf showAdvanced];
}]]; }]];
@ -197,17 +204,20 @@
if (showBackup) { if (showBackup) {
[section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_BACKUP", [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_BACKUP",
@"Label for the backup view in app settings.") @"Label for the backup view in app settings.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"backup")
actionBlock:^{ actionBlock:^{
[weakSelf showBackup]; [weakSelf showBackup];
}]]; }]];
} }
[section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_ABOUT", @"") [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_ABOUT", @"")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"about")
actionBlock:^{ actionBlock:^{
[weakSelf showAbout]; [weakSelf showAbout];
}]]; }]];
#ifdef USE_DEBUG_UI #ifdef USE_DEBUG_UI
[section addItem:[OWSTableItem disclosureItemWithText:@"Debug UI" [section addItem:[OWSTableItem disclosureItemWithText:@"Debug UI"
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"debugui")
actionBlock:^{ actionBlock:^{
[weakSelf showDebugUI]; [weakSelf showDebugUI];
}]]; }]];
@ -216,14 +226,17 @@
if (TSAccountManager.sharedInstance.isDeregistered) { if (TSAccountManager.sharedInstance.isDeregistered) {
[section addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_REREGISTER_BUTTON", [section addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_REREGISTER_BUTTON",
@"Label for re-registration button.") @"Label for re-registration button.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"reregister")
selector:@selector(reregisterUser) selector:@selector(reregisterUser)
color:[UIColor ows_materialBlueColor]]]; color:[UIColor ows_materialBlueColor]]];
[section addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_DELETE_DATA_BUTTON", [section addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_DELETE_DATA_BUTTON",
@"Label for 'delete data' button.") @"Label for 'delete data' button.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"delete_data")
selector:@selector(deleteUnregisterUserData) selector:@selector(deleteUnregisterUserData)
color:[UIColor ows_destructiveRedColor]]]; color:[UIColor ows_destructiveRedColor]]];
} else { } else {
[section addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_DELETE_ACCOUNT_BUTTON", @"") [section addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_DELETE_ACCOUNT_BUTTON", @"")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"delete_account")
selector:@selector(unregisterUser) selector:@selector(unregisterUser)
color:[UIColor ows_destructiveRedColor]]]; color:[UIColor ows_destructiveRedColor]]];
} }
@ -233,7 +246,10 @@
self.contents = contents; self.contents = contents;
} }
- (OWSTableItem *)destructiveButtonItemWithTitle:(NSString *)title selector:(SEL)selector color:(UIColor *)color - (OWSTableItem *)destructiveButtonItemWithTitle:(NSString *)title
accessibilityIdentifier:(NSString *)accessibilityIdentifier
selector:(SEL)selector
color:(UIColor *)color
{ {
__weak AppSettingsViewController *weakSelf = self; __weak AppSettingsViewController *weakSelf = self;
return [OWSTableItem return [OWSTableItem
@ -254,6 +270,7 @@
[button autoSetDimension:ALDimensionHeight toSize:kButtonHeight]; [button autoSetDimension:ALDimensionHeight toSize:kButtonHeight];
[button autoVCenterInSuperview]; [button autoVCenterInSuperview];
[button autoPinLeadingAndTrailingToSuperviewMargin]; [button autoPinLeadingAndTrailingToSuperviewMargin];
button.accessibilityIdentifier = accessibilityIdentifier;
return cell; return cell;
} }
@ -335,6 +352,8 @@
[disclosureButton setContentCompressionResistancePriority:(UILayoutPriorityDefaultHigh + 1) [disclosureButton setContentCompressionResistancePriority:(UILayoutPriorityDefaultHigh + 1)
forAxis:UILayoutConstraintAxisHorizontal]; forAxis:UILayoutConstraintAxisHorizontal];
cell.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"profile");
return cell; return cell;
} }
@ -471,6 +490,7 @@
target:self target:self
action:@selector(didPressEnableDarkTheme:)]; action:@selector(didPressEnableDarkTheme:)];
} }
barButtonItem.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"dark_theme");
return barButtonItem; return barButtonItem;
} }

Loading…
Cancel
Save