Add accessibilityIdentifiers to conversation settings view.

pull/2/head
Matthew Chen 5 years ago
parent f073dd9a52
commit 3ce3f9faaa

@ -1,5 +1,5 @@
// //
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2019 Open Whisper Systems. All rights reserved.
// //
#import "FingerprintViewController.h" #import "FingerprintViewController.h"
@ -169,10 +169,13 @@ typedef void (^CustomLayoutBlock)(void);
self.navigationItem.leftBarButtonItem = self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
target:self target:self
action:@selector(closeButton)]; action:@selector(closeButton)
self.shareButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"stop")];
target:self self.shareButton =
action:@selector(didTapShareButton)]; [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
target:self
action:@selector(didTapShareButton)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"share")];
self.navigationItem.rightBarButtonItem = self.shareButton; self.navigationItem.rightBarButtonItem = self.shareButton;
[self createViews]; [self createViews];
@ -190,6 +193,7 @@ typedef void (^CustomLayoutBlock)(void);
[self.view addSubview:verifyUnverifyButton]; [self.view addSubview:verifyUnverifyButton];
[verifyUnverifyButton autoPinWidthToSuperview]; [verifyUnverifyButton autoPinWidthToSuperview];
[verifyUnverifyButton autoPinToBottomLayoutGuideOfViewController:self withInset:0]; [verifyUnverifyButton autoPinToBottomLayoutGuideOfViewController:self withInset:0];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, verifyUnverifyButton);
UIView *verifyUnverifyPillbox = [UIView new]; UIView *verifyUnverifyPillbox = [UIView new];
verifyUnverifyPillbox.backgroundColor = [UIColor ows_materialBlueColor]; verifyUnverifyPillbox.backgroundColor = [UIColor ows_materialBlueColor];
@ -217,6 +221,7 @@ typedef void (^CustomLayoutBlock)(void);
[self.view addSubview:learnMoreButton]; [self.view addSubview:learnMoreButton];
[learnMoreButton autoPinWidthToSuperview]; [learnMoreButton autoPinWidthToSuperview];
[learnMoreButton autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:verifyUnverifyButton withOffset:0]; [learnMoreButton autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:verifyUnverifyButton withOffset:0];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, learnMoreButton);
UILabel *learnMoreLabel = [UILabel new]; UILabel *learnMoreLabel = [UILabel new];
learnMoreLabel.attributedText = [[NSAttributedString alloc] learnMoreLabel.attributedText = [[NSAttributedString alloc]
@ -265,6 +270,7 @@ typedef void (^CustomLayoutBlock)(void);
toEdge:ALEdgeTop toEdge:ALEdgeTop
ofView:instructionsLabel ofView:instructionsLabel
withOffset:-ScaleFromIPhone5To7Plus(8.f, 15.f)]; withOffset:-ScaleFromIPhone5To7Plus(8.f, 15.f)];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, fingerprintLabel);
// Fingerprint Image // Fingerprint Image
CustomLayoutView *fingerprintView = [CustomLayoutView new]; CustomLayoutView *fingerprintView = [CustomLayoutView new];
@ -278,6 +284,7 @@ typedef void (^CustomLayoutBlock)(void);
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(fingerprintViewTapped:)]]; action:@selector(fingerprintViewTapped:)]];
fingerprintView.userInteractionEnabled = YES; fingerprintView.userInteractionEnabled = YES;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, fingerprintView);
OWSBezierPathView *fingerprintCircle = [OWSBezierPathView new]; OWSBezierPathView *fingerprintCircle = [OWSBezierPathView new];
[fingerprintCircle setConfigureShapeLayerBlock:^(CAShapeLayer *layer, CGRect bounds) { [fingerprintCircle setConfigureShapeLayerBlock:^(CAShapeLayer *layer, CGRect bounds) {

@ -1,5 +1,5 @@
// //
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2019 Open Whisper Systems. All rights reserved.
// //
#import "OWSAddToContactViewController.h" #import "OWSAddToContactViewController.h"
@ -166,7 +166,10 @@ NS_ASSUME_NONNULL_BEGIN
continue; continue;
} }
// TODO: Confirm with nancy if this will work.
NSString *cellName = [NSString stringWithFormat:@"contact.%@", NSUUID.UUID.UUIDString];
[section addItem:[OWSTableItem disclosureItemWithText:displayName [section addItem:[OWSTableItem disclosureItemWithText:displayName
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, cellName)
actionBlock:^{ actionBlock:^{
[weakSelf presentContactViewControllerForContact:contact]; [weakSelf presentContactViewControllerForContact:contact];
}]]; }]];

@ -136,6 +136,7 @@ NS_ASSUME_NONNULL_BEGIN
addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"GROUP_MEMBERS_RESET_NO_LONGER_VERIFIED", addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"GROUP_MEMBERS_RESET_NO_LONGER_VERIFIED",
@"Label for the button that clears all verification " @"Label for the button that clears all verification "
@"errors in the 'group members' view.") @"errors in the 'group members' view.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"no_longer_verified")
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
actionBlock:^{ actionBlock:^{
[weakSelf offerResetAllNoLongerVerified]; [weakSelf offerResetAllNoLongerVerified];
@ -196,6 +197,10 @@ NS_ASSUME_NONNULL_BEGIN
[cell setAttributedSubtitle:nil]; [cell setAttributedSubtitle:nil];
} }
NSString *cellName = [NSString stringWithFormat:@"user.%@", recipientId];
cell.accessibilityIdentifier
= ACCESSIBILITY_IDENTIFIER_WITH_NAME(ShowGroupMembersViewController, cellName);
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -221,6 +226,7 @@ NS_ASSUME_NONNULL_BEGIN
__weak ShowGroupMembersViewController *weakSelf = self; __weak ShowGroupMembersViewController *weakSelf = self;
UIAlertAction *verifyAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) UIAlertAction *verifyAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"ok")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[weakSelf resetAllNoLongerVerified]; [weakSelf resetAllNoLongerVerified];
@ -283,11 +289,13 @@ NS_ASSUME_NONNULL_BEGIN
? NSLocalizedString(@"GROUP_MEMBERS_VIEW_CONTACT_INFO", @"Button label for the 'show contact info' button") ? NSLocalizedString(@"GROUP_MEMBERS_VIEW_CONTACT_INFO", @"Button label for the 'show contact info' button")
: NSLocalizedString( : NSLocalizedString(
@"GROUP_MEMBERS_ADD_CONTACT_INFO", @"Button label to add information to an unknown contact"); @"GROUP_MEMBERS_ADD_CONTACT_INFO", @"Button label to add information to an unknown contact");
[actionSheet addAction:[UIAlertAction actionWithTitle:contactInfoTitle [actionSheet
style:UIAlertActionStyleDefault addAction:[UIAlertAction actionWithTitle:contactInfoTitle
handler:^(UIAlertAction *_Nonnull action) { accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"show_contact_info")
[self showContactInfoViewForRecipientId:recipientId]; style:UIAlertActionStyleDefault
}]]; handler:^(UIAlertAction *_Nonnull action) {
[self showContactInfoViewForRecipientId:recipientId];
}]];
} }
BOOL isBlocked; BOOL isBlocked;
@ -297,6 +305,7 @@ NS_ASSUME_NONNULL_BEGIN
[actionSheet [actionSheet
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_UNBLOCK_BUTTON", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_UNBLOCK_BUTTON",
@"Button label for the 'unblock' button") @"Button label for the 'unblock' button")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"unblock")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[BlockListUIUtils [BlockListUIUtils
@ -312,6 +321,7 @@ NS_ASSUME_NONNULL_BEGIN
[actionSheet [actionSheet
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON",
@"Button label for the 'block' button") @"Button label for the 'block' button")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"block")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[BlockListUIUtils [BlockListUIUtils
@ -330,6 +340,7 @@ NS_ASSUME_NONNULL_BEGIN
[actionSheet [actionSheet
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_UNBLOCK_BUTTON", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_UNBLOCK_BUTTON",
@"Button label for the 'unblock' button") @"Button label for the 'unblock' button")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"unblock")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[BlockListUIUtils [BlockListUIUtils
@ -345,6 +356,7 @@ NS_ASSUME_NONNULL_BEGIN
[actionSheet [actionSheet
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON",
@"Button label for the 'block' button") @"Button label for the 'block' button")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"block")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[BlockListUIUtils [BlockListUIUtils
@ -363,12 +375,14 @@ NS_ASSUME_NONNULL_BEGIN
[actionSheet [actionSheet
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"GROUP_MEMBERS_SEND_MESSAGE", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"GROUP_MEMBERS_SEND_MESSAGE",
@"Button label for the 'send message to group member' button") @"Button label for the 'send message to group member' button")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_message")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[self showConversationViewForRecipientId:recipientId]; [self showConversationViewForRecipientId:recipientId];
}]]; }]];
[actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"GROUP_MEMBERS_CALL", [actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"GROUP_MEMBERS_CALL",
@"Button label for the 'call group member' button") @"Button label for the 'call group member' button")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"call")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[self callMember:recipientId]; [self callMember:recipientId];
@ -377,6 +391,7 @@ NS_ASSUME_NONNULL_BEGIN
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"VERIFY_PRIVACY", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"VERIFY_PRIVACY",
@"Label for button or row which allows users to verify the " @"Label for button or row which allows users to verify the "
@"safety number of another user.") @"safety number of another user.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"safety_numbers")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[self showSafetyNumberView:recipientId]; [self showSafetyNumberView:recipientId];

@ -143,7 +143,8 @@ NS_ASSUME_NONNULL_BEGIN
@"The title for the 'update group' button.") @"The title for the 'update group' button.")
style:UIBarButtonItemStylePlain style:UIBarButtonItemStylePlain
target:self target:self
action:@selector(updateGroupPressed)] action:@selector(updateGroupPressed)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"update")]
: nil); : nil);
} }
@ -206,10 +207,12 @@ 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 [avatarView
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarTouched:)]]; addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarTouched:)]];
avatarView.userInteractionEnabled = YES; avatarView.userInteractionEnabled = YES;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, avatarView);
return firstSectionHeader; return firstSectionHeader;
} }
@ -285,6 +288,12 @@ NS_ASSUME_NONNULL_BEGIN
} }
[cell configureWithRecipientId:recipientId]; [cell configureWithRecipientId:recipientId];
// TODO: Confirm with nancy if this will work.
NSString *cellName = [NSString stringWithFormat:@"member.%@", recipientId];
cell.accessibilityIdentifier
= ACCESSIBILITY_IDENTIFIER_WITH_NAME(UpdateGroupViewController, cellName);
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -424,6 +433,7 @@ NS_ASSUME_NONNULL_BEGIN
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"ALERT_SAVE", [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"ALERT_SAVE",
@"The label for the 'save' button in action sheets.") @"The label for the 'save' button in action sheets.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"save")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
OWSAssertDebug(self.conversationSettingsViewDelegate); OWSAssertDebug(self.conversationSettingsViewDelegate);
@ -435,6 +445,7 @@ NS_ASSUME_NONNULL_BEGIN
}]]; }]];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"ALERT_DONT_SAVE", [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"ALERT_DONT_SAVE",
@"The label for the 'don't save' button in action sheets.") @"The label for the 'don't save' button in action sheets.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dont_save")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[self.navigationController popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES];

@ -230,6 +230,7 @@ NSString *const ReportedApplicationStateDidChangeNotification = @"ReportedApplic
- (nullable UIAlertAction *)openSystemSettingsAction - (nullable UIAlertAction *)openSystemSettingsAction
{ {
return [UIAlertAction actionWithTitle:CommonStrings.openSettingsButton return [UIAlertAction actionWithTitle:CommonStrings.openSettingsButton
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"system_settings")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[UIApplication.sharedApplication openSystemSettings]; [UIApplication.sharedApplication openSystemSettings];

@ -334,6 +334,7 @@ NS_ASSUME_NONNULL_BEGIN
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"AB_PERMISSION_MISSING_ACTION_NOT_NOW", [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"AB_PERMISSION_MISSING_ACTION_NOT_NOW",
@"Button text to dismiss missing contacts permission alert") @"Button text to dismiss missing contacts permission alert")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"not_now")
style:UIAlertActionStyleCancel style:UIAlertActionStyleCancel
handler:nil]]; handler:nil]];

@ -1473,6 +1473,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
NSString *shareTitle = NSLocalizedString(@"CONVERSATION_SETTINGS_VIEW_SHARE_PROFILE", NSString *shareTitle = NSLocalizedString(@"CONVERSATION_SETTINGS_VIEW_SHARE_PROFILE",
@"Button to confirm that user wants to share their profile with a user or group."); @"Button to confirm that user wants to share their profile with a user or group.");
[alert addAction:[UIAlertAction actionWithTitle:shareTitle [alert addAction:[UIAlertAction actionWithTitle:shareTitle
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"share_profile")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[self userAddedThreadToProfileWhitelist:thread]; [self userAddedThreadToProfileWhitelist:thread];

Loading…
Cancel
Save