Add accessibilityIdentifiers to 'new group thread' view.

pull/2/head
Matthew Chen 6 years ago
parent 4188993fc5
commit 50888b20d2

@ -106,11 +106,13 @@ NS_ASSUME_NONNULL_BEGIN
self.view.backgroundColor = Theme.backgroundColor; self.view.backgroundColor = Theme.backgroundColor;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] self.navigationItem.rightBarButtonItem =
initWithTitle:NSLocalizedString(@"NEW_GROUP_CREATE_BUTTON", @"The title for the 'create group' button.") [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"NEW_GROUP_CREATE_BUTTON",
style:UIBarButtonItemStylePlain @"The title for the 'create group' button.")
target:self style:UIBarButtonItemStylePlain
action:@selector(createGroup)]; target:self
action:@selector(createGroup)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"create")];
self.navigationItem.rightBarButtonItem.imageInsets = UIEdgeInsetsMake(0, -10, 0, 10); self.navigationItem.rightBarButtonItem.imageInsets = UIEdgeInsetsMake(0, -10, 0, 10);
self.navigationItem.rightBarButtonItem.accessibilityLabel self.navigationItem.rightBarButtonItem.accessibilityLabel
= NSLocalizedString(@"FINISH_GROUP_CREATION_LABEL", @"Accessibility label for finishing new group"); = NSLocalizedString(@"FINISH_GROUP_CREATION_LABEL", @"Accessibility label for finishing new group");
@ -158,6 +160,11 @@ NS_ASSUME_NONNULL_BEGIN
[avatarView autoSetDimension:ALDimensionHeight toSize:kLargeAvatarSize]; [avatarView autoSetDimension:ALDimensionHeight toSize:kLargeAvatarSize];
[self updateAvatarView]; [self updateAvatarView];
[avatarView
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarTouched:)]];
avatarView.userInteractionEnabled = YES;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, avatarView);
UITextField *groupNameTextField = [OWSTextField new]; UITextField *groupNameTextField = [OWSTextField new];
_groupNameTextField = groupNameTextField; _groupNameTextField = groupNameTextField;
groupNameTextField.textColor = Theme.primaryColor; groupNameTextField.textColor = Theme.primaryColor;
@ -176,10 +183,7 @@ NS_ASSUME_NONNULL_BEGIN
[groupNameTextField autoVCenterInSuperview]; [groupNameTextField autoVCenterInSuperview];
[groupNameTextField autoPinTrailingToSuperviewMargin]; [groupNameTextField autoPinTrailingToSuperviewMargin];
[groupNameTextField autoPinLeadingToTrailingEdgeOfView:avatarView offset:16.f]; [groupNameTextField autoPinLeadingToTrailingEdgeOfView:avatarView offset:16.f];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, groupNameTextField);
[avatarView
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarTouched:)]];
avatarView.userInteractionEnabled = YES;
return firstSectionHeader; return firstSectionHeader;
} }
@ -245,6 +249,11 @@ NS_ASSUME_NONNULL_BEGIN
@"CONTACT_CELL_IS_BLOCKED", @"An indicator that a contact has been blocked."); @"CONTACT_CELL_IS_BLOCKED", @"An indicator that a contact has been blocked.");
} }
[cell configureWithRecipientId:recipientId]; [cell configureWithRecipientId:recipientId];
NSString *cellName = [NSString stringWithFormat:@"non_signal_contact.%@", recipientId];
cell.accessibilityIdentifier
= ACCESSIBILITY_IDENTIFIER_WITH_NAME(NewGroupViewController, cellName);
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -333,6 +342,12 @@ NS_ASSUME_NONNULL_BEGIN
} }
[cell configureWithRecipientId:signalAccount.recipientId]; [cell configureWithRecipientId:signalAccount.recipientId];
NSString *cellName =
[NSString stringWithFormat:@"signal_contact.%@", signalAccount.recipientId];
cell.accessibilityIdentifier
= ACCESSIBILITY_IDENTIFIER_WITH_NAME(NewGroupViewController, cellName);
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -392,15 +407,16 @@ NS_ASSUME_NONNULL_BEGIN
{ {
__weak NewGroupViewController *weakSelf = self; __weak NewGroupViewController *weakSelf = self;
return [OWSTableItem return [OWSTableItem
disclosureItemWithText:NSLocalizedString(@"NEW_GROUP_ADD_NON_CONTACT", disclosureItemWithText:NSLocalizedString(@"NEW_GROUP_ADD_NON_CONTACT",
@"A label for the cell that lets you add a new non-contact member to a group.") @"A label for the cell that lets you add a new non-contact member to a group.")
customRowHeight:UITableViewAutomaticDimension accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(NewGroupViewController, @"add_non_contact")
actionBlock:^{ customRowHeight:UITableViewAutomaticDimension
AddToGroupViewController *viewController = [AddToGroupViewController new]; actionBlock:^{
viewController.addToGroupDelegate = weakSelf; AddToGroupViewController *viewController = [AddToGroupViewController new];
viewController.hideContacts = YES; viewController.addToGroupDelegate = weakSelf;
[weakSelf.navigationController pushViewController:viewController animated:YES]; viewController.hideContacts = YES;
}]; [weakSelf.navigationController pushViewController:viewController animated:YES];
}];
} }
- (void)removeRecipientId:(NSString *)recipientId - (void)removeRecipientId:(NSString *)recipientId
@ -570,6 +586,7 @@ NS_ASSUME_NONNULL_BEGIN
[alert [alert
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"ALERT_DISCARD_BUTTON", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"ALERT_DISCARD_BUTTON",
@"The label for the 'discard' button in alerts and action sheets.") @"The label for the 'discard' button in alerts and action sheets.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"discard")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[self.navigationController popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES];

Loading…
Cancel
Save