Merge branch 'charlesmchen/accessibilityIdentifiers3'

This commit is contained in:
Matthew Chen 2019-03-25 09:33:58 -04:00
commit c3ddb4b912
31 changed files with 625 additions and 333 deletions

View File

@ -58,7 +58,7 @@
[informationSection addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_LEGAL_TERMS_CELL", [informationSection addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_LEGAL_TERMS_CELL",
@"table cell label") @"table cell label")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"terms") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"terms")
actionBlock:^{ actionBlock:^{
[[UIApplication sharedApplication] [[UIApplication sharedApplication]
openURL:[NSURL URLWithString:kLegalTermsUrlString]]; openURL:[NSURL URLWithString:kLegalTermsUrlString]];
@ -69,7 +69,7 @@
OWSTableSection *helpSection = [OWSTableSection new]; OWSTableSection *helpSection = [OWSTableSection new];
helpSection.headerTitle = NSLocalizedString(@"SETTINGS_HELP_HEADER", @""); helpSection.headerTitle = NSLocalizedString(@"SETTINGS_HELP_HEADER", @"");
[helpSection addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_SUPPORT", @"") [helpSection addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_SUPPORT", @"")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"support") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"support")
actionBlock:^{ actionBlock:^{
[[UIApplication sharedApplication] [[UIApplication sharedApplication]
openURL:[NSURL URLWithString:@"https://support.signal.org"]]; openURL:[NSURL URLWithString:@"https://support.signal.org"]];

View File

@ -89,7 +89,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSTableSection *loggingSection = [OWSTableSection new]; OWSTableSection *loggingSection = [OWSTableSection new];
loggingSection.headerTitle = NSLocalizedString(@"LOGGING_SECTION", nil); loggingSection.headerTitle = NSLocalizedString(@"LOGGING_SECTION", nil);
[loggingSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_DEBUGLOG", @"") [loggingSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_DEBUGLOG", @"")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"enable_debug_log") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"enable_debug_log")
isOnBlock:^{ isOnBlock:^{
return [OWSPreferences isLoggingEnabled]; return [OWSPreferences isLoggingEnabled];
} }
@ -103,7 +103,7 @@ NS_ASSUME_NONNULL_BEGIN
if ([OWSPreferences isLoggingEnabled]) { if ([OWSPreferences isLoggingEnabled]) {
[loggingSection [loggingSection
addItem:[OWSTableItem actionItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_SUBMIT_DEBUGLOG", @"") addItem:[OWSTableItem actionItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_SUBMIT_DEBUGLOG", @"")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"submit_debug_log") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"submit_debug_log")
actionBlock:^{ actionBlock:^{
OWSLogInfo(@"Submitting debug logs"); OWSLogInfo(@"Submitting debug logs");
[DDLog flushLog]; [DDLog flushLog];
@ -117,7 +117,7 @@ NS_ASSUME_NONNULL_BEGIN
pushNotificationsSection.headerTitle pushNotificationsSection.headerTitle
= NSLocalizedString(@"PUSH_REGISTER_TITLE", @"Used in table section header and alert view title contexts"); = NSLocalizedString(@"PUSH_REGISTER_TITLE", @"Used in table section header and alert view title contexts");
[pushNotificationsSection addItem:[OWSTableItem actionItemWithText:NSLocalizedString(@"REREGISTER_FOR_PUSH", nil) [pushNotificationsSection addItem:[OWSTableItem actionItemWithText:NSLocalizedString(@"REREGISTER_FOR_PUSH", nil)
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER( accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
self, @"reregister_push_notifications") self, @"reregister_push_notifications")
actionBlock:^{ actionBlock:^{
[weakSelf syncPushTokens]; [weakSelf syncPushTokens];
@ -187,7 +187,7 @@ NS_ASSUME_NONNULL_BEGIN
[censorshipSection [censorshipSection
addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_CENSORSHIP_CIRCUMVENTION", addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_CENSORSHIP_CIRCUMVENTION",
@"Label for the 'manual censorship circumvention' switch.") @"Label for the 'manual censorship circumvention' switch.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"censorship_circumvention") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"censorship_circumvention")
isOnBlock:isCensorshipCircumventionOnBlock isOnBlock:isCensorshipCircumventionOnBlock
isEnabledBlock:isManualCensorshipCircumventionOnEnabledBlock isEnabledBlock:isManualCensorshipCircumventionOnEnabledBlock
target:weakSelf target:weakSelf

View File

@ -165,7 +165,7 @@
[accessoryLabel sizeToFit]; [accessoryLabel sizeToFit];
cell.accessoryView = accessoryLabel; cell.accessoryView = accessoryLabel;
cell.accessibilityIdentifier cell.accessibilityIdentifier
= SUBVIEW_ACCESSIBILITY_IDENTIFIER(AppSettingsViewController, @"network_status"); = ACCESSIBILITY_IDENTIFIER_WITH_NAME(AppSettingsViewController, @"network_status");
return cell; return cell;
} }
actionBlock:nil]]; actionBlock:nil]];
@ -173,29 +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") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(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") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(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") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(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") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(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") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"advanced")
actionBlock:^{ actionBlock:^{
[weakSelf showAdvanced]; [weakSelf showAdvanced];
}]]; }]];
@ -204,20 +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") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(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") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(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") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"debugui")
actionBlock:^{ actionBlock:^{
[weakSelf showDebugUI]; [weakSelf showDebugUI];
}]]; }]];
@ -226,19 +226,20 @@
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") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(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") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(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
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"delete_account") addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_DELETE_ACCOUNT_BUTTON", @"")
selector:@selector(unregisterUser) accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"delete_account")
color:[UIColor ows_destructiveRedColor]]]; selector:@selector(unregisterUser)
color:[UIColor ows_destructiveRedColor]]];
} }
[contents addSection:section]; [contents addSection:section];
@ -352,7 +353,7 @@
[disclosureButton setContentCompressionResistancePriority:(UILayoutPriorityDefaultHigh + 1) [disclosureButton setContentCompressionResistancePriority:(UILayoutPriorityDefaultHigh + 1)
forAxis:UILayoutConstraintAxisHorizontal]; forAxis:UILayoutConstraintAxisHorizontal];
cell.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"profile"); cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"profile");
return cell; return cell;
} }
@ -490,7 +491,7 @@
target:self target:self
action:@selector(didPressEnableDarkTheme:)]; action:@selector(didPressEnableDarkTheme:)];
} }
barButtonItem.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"dark_theme"); barButtonItem.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dark_theme");
return barButtonItem; return barButtonItem;
} }

View File

@ -74,7 +74,7 @@ NS_ASSUME_NONNULL_BEGIN
addItem:[OWSTableItem addItem:[OWSTableItem
disclosureItemWithText:NSLocalizedString(@"SETTINGS_BLOCK_LIST_ADD_BUTTON", disclosureItemWithText:NSLocalizedString(@"SETTINGS_BLOCK_LIST_ADD_BUTTON",
@"A label for the 'add phone number' button in the block list table.") @"A label for the 'add phone number' button in the block list table.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"add") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"add")
actionBlock:^{ actionBlock:^{
AddToBlockListViewController *vc = [[AddToBlockListViewController alloc] init]; AddToBlockListViewController *vc = [[AddToBlockListViewController alloc] init];
[weakSelf.navigationController pushViewController:vc animated:YES]; [weakSelf.navigationController pushViewController:vc animated:YES];
@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN
itemWithCustomCellBlock:^{ itemWithCustomCellBlock:^{
ContactTableViewCell *cell = [ContactTableViewCell new]; ContactTableViewCell *cell = [ContactTableViewCell new];
[cell configureWithRecipientId:phoneNumber]; [cell configureWithRecipientId:phoneNumber];
cell.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER( cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(
BlockListViewController, @"user"); BlockListViewController, @"user");
return cell; return cell;
} }

View File

@ -41,7 +41,7 @@
cell.accessoryType = UITableViewCellAccessoryCheckmark; cell.accessoryType = UITableViewCellAccessoryCheckmark;
} }
cell.accessibilityIdentifier cell.accessibilityIdentifier
= SUBVIEW_ACCESSIBILITY_IDENTIFIER(NotificationSettingsOptionsViewController, = ACCESSIBILITY_IDENTIFIER_WITH_NAME(NotificationSettingsOptionsViewController,
NSStringForNotificationType(notificationType)); NSStringForNotificationType(notificationType));
return cell; return cell;
} }

View File

@ -48,7 +48,7 @@
NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND", NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND",
@"Label for settings view that allows user to change the notification sound.") @"Label for settings view that allows user to change the notification sound.")
detailText:[OWSSounds displayNameForSound:[OWSSounds globalNotificationSound]] detailText:[OWSSounds displayNameForSound:[OWSSounds globalNotificationSound]]
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"message_sound") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"message_sound")
actionBlock:^{ actionBlock:^{
OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new]; OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new];
[weakSelf.navigationController pushViewController:vc animated:YES]; [weakSelf.navigationController pushViewController:vc animated:YES];
@ -58,7 +58,7 @@
@"Table cell switch label. When disabled, Signal will not play notification sounds while the app is in the " @"Table cell switch label. When disabled, Signal will not play notification sounds while the app is in the "
@"foreground."); @"foreground.");
[soundsSection addItem:[OWSTableItem switchItemWithText:inAppSoundsLabelText [soundsSection addItem:[OWSTableItem switchItemWithText:inAppSoundsLabelText
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"in_app_sounds") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"in_app_sounds")
isOnBlock:^{ isOnBlock:^{
return [prefs soundInForeground]; return [prefs soundInForeground];
} }
@ -75,7 +75,7 @@
addItem:[OWSTableItem addItem:[OWSTableItem
disclosureItemWithText:NSLocalizedString(@"NOTIFICATIONS_SHOW", nil) disclosureItemWithText:NSLocalizedString(@"NOTIFICATIONS_SHOW", nil)
detailText:[prefs nameForNotificationPreviewType:[prefs notificationPreviewType]] detailText:[prefs nameForNotificationPreviewType:[prefs notificationPreviewType]]
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"options") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"options")
actionBlock:^{ actionBlock:^{
NotificationSettingsOptionsViewController *vc = NotificationSettingsOptionsViewController *vc =
[NotificationSettingsOptionsViewController new]; [NotificationSettingsOptionsViewController new];

View File

@ -329,7 +329,7 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1;
cell.detailTextLabel.text cell.detailTextLabel.text
= NSLocalizedString(@"LINK_NEW_DEVICE_SUBTITLE", @"Subheading for 'Link New Device' navigation"); = NSLocalizedString(@"LINK_NEW_DEVICE_SUBTITLE", @"Subheading for 'Link New Device' navigation");
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(OWSLinkedDevicesTableViewController, @"add"); cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(OWSLinkedDevicesTableViewController, @"add");
return cell; return cell;
} else if (indexPath.section == OWSLinkedDevicesTableViewControllerSectionExistingDevices) { } else if (indexPath.section == OWSLinkedDevicesTableViewControllerSectionExistingDevices) {
OWSDeviceTableViewCell *cell = OWSDeviceTableViewCell *cell =

View File

@ -6,6 +6,7 @@
#import <AVFoundation/AVFoundation.h> #import <AVFoundation/AVFoundation.h>
#import <SignalMessaging/OWSAudioPlayer.h> #import <SignalMessaging/OWSAudioPlayer.h>
#import <SignalMessaging/OWSSounds.h> #import <SignalMessaging/OWSSounds.h>
#import <SignalMessaging/SignalMessaging-Swift.h>
#import <SignalMessaging/UIUtil.h> #import <SignalMessaging/UIUtil.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@ -46,17 +47,19 @@ NS_ASSUME_NONNULL_BEGIN
- (void)updateNavigationItems - (void)updateNavigationItems
{ {
UIBarButtonItem *cancelItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel UIBarButtonItem *cancelItem =
target:self [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
action:@selector(cancelWasPressed:)]; target:self
cancelItem.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"cancel"); action:@selector(cancelWasPressed:)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"cancel")];
self.navigationItem.leftBarButtonItem = cancelItem; self.navigationItem.leftBarButtonItem = cancelItem;
if (self.isDirty) { if (self.isDirty) {
UIBarButtonItem *saveItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave UIBarButtonItem *saveItem =
target:self [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave
action:@selector(saveWasPressed:)]; target:self
saveItem.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"save"); action:@selector(saveWasPressed:)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"save")];
self.navigationItem.rightBarButtonItem = saveItem; self.navigationItem.rightBarButtonItem = saveItem;
} else { } else {
self.navigationItem.rightBarButtonItem = nil; self.navigationItem.rightBarButtonItem = nil;
@ -94,14 +97,14 @@ NS_ASSUME_NONNULL_BEGIN
if (sound == self.currentSound) { if (sound == self.currentSound) {
item = [OWSTableItem item = [OWSTableItem
checkmarkItemWithText:soundLabelText checkmarkItemWithText:soundLabelText
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, [OWSSounds displayNameForSound:sound]) accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, [OWSSounds displayNameForSound:sound])
actionBlock:^{ actionBlock:^{
[weakSelf soundWasSelected:sound]; [weakSelf soundWasSelected:sound];
}]; }];
} else { } else {
item = [OWSTableItem item = [OWSTableItem
actionItemWithText:soundLabelText actionItemWithText:soundLabelText
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, [OWSSounds displayNameForSound:sound]) accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, [OWSSounds displayNameForSound:sound])
actionBlock:^{ actionBlock:^{
[weakSelf soundWasSelected:sound]; [weakSelf soundWasSelected:sound];
}]; }];

View File

@ -425,7 +425,7 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
[UIAlertAction actionWithTitle: [UIAlertAction actionWithTitle:
NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION_BUTTON", NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION_BUTTON",
@"Confirmation text for button which deletes all message, calling, attachments, etc.") @"Confirmation text for button which deletes all message, calling, attachments, etc.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"delete") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"delete")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[self deleteThreadsAndMessages]; [self deleteThreadsAndMessages];
@ -561,11 +561,11 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
UIAlertAction *action = UIAlertAction *action =
[UIAlertAction actionWithTitle:screenLockTimeoutString [UIAlertAction actionWithTitle:screenLockTimeoutString
accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.timeout.%@", timeoutValue]
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *ignore) { handler:^(UIAlertAction *ignore) {
[OWSScreenLock.sharedManager setScreenLockTimeout:screenLockTimeout]; [OWSScreenLock.sharedManager setScreenLockTimeout:screenLockTimeout];
}]; }];
action.accessibilityIdentifier = [NSString stringWithFormat:@"settings.privacy.timeout.%@", timeoutValue];
[alert addAction:action]; [alert addAction:action];
} }
[alert addAction:[OWSAlerts cancelAction]]; [alert addAction:[OWSAlerts cancelAction]];

View File

@ -136,6 +136,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.inputTextView.backgroundColor = Theme.toolbarBackgroundColor; self.inputTextView.backgroundColor = Theme.toolbarBackgroundColor;
[self.inputTextView setContentHuggingLow]; [self.inputTextView setContentHuggingLow];
[self.inputTextView setCompressionResistanceLow]; [self.inputTextView setCompressionResistanceLow];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _inputTextView);
_textViewHeightConstraint = [self.inputTextView autoSetDimension:ALDimensionHeight toSize:kMinTextViewHeight]; _textViewHeightConstraint = [self.inputTextView autoSetDimension:ALDimensionHeight toSize:kMinTextViewHeight];
@ -152,6 +153,7 @@ const CGFloat kMaxTextViewHeight = 98;
forState:UIControlStateNormal]; forState:UIControlStateNormal];
self.attachmentButton.tintColor = Theme.navbarIconColor; self.attachmentButton.tintColor = Theme.navbarIconColor;
[self.attachmentButton autoSetDimensionsToSize:CGSizeMake(40, kMinTextViewHeight)]; [self.attachmentButton autoSetDimensionsToSize:CGSizeMake(40, kMinTextViewHeight)];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _attachmentButton);
_sendButton = [UIButton buttonWithType:UIButtonTypeCustom]; _sendButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.sendButton setTitle:MessageStrings.sendButton forState:UIControlStateNormal]; [self.sendButton setTitle:MessageStrings.sendButton forState:UIControlStateNormal];
@ -161,6 +163,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.sendButton.contentEdgeInsets = UIEdgeInsetsMake(0, 4, 0, 4); self.sendButton.contentEdgeInsets = UIEdgeInsetsMake(0, 4, 0, 4);
[self.sendButton autoSetDimension:ALDimensionHeight toSize:kMinTextViewHeight]; [self.sendButton autoSetDimension:ALDimensionHeight toSize:kMinTextViewHeight];
[self.sendButton addTarget:self action:@selector(sendButtonPressed) forControlEvents:UIControlEventTouchUpInside]; [self.sendButton addTarget:self action:@selector(sendButtonPressed) forControlEvents:UIControlEventTouchUpInside];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _sendButton);
UIImage *voiceMemoIcon = [UIImage imageNamed:@"voice-memo-button"]; UIImage *voiceMemoIcon = [UIImage imageNamed:@"voice-memo-button"];
OWSAssertDebug(voiceMemoIcon); OWSAssertDebug(voiceMemoIcon);
@ -169,6 +172,7 @@ const CGFloat kMaxTextViewHeight = 98;
forState:UIControlStateNormal]; forState:UIControlStateNormal];
self.voiceMemoButton.imageView.tintColor = Theme.navbarIconColor; self.voiceMemoButton.imageView.tintColor = Theme.navbarIconColor;
[self.voiceMemoButton autoSetDimensionsToSize:CGSizeMake(40, kMinTextViewHeight)]; [self.voiceMemoButton autoSetDimensionsToSize:CGSizeMake(40, kMinTextViewHeight)];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _voiceMemoButton);
// We want to be permissive about the voice message gesture, so we hang // We want to be permissive about the voice message gesture, so we hang
// the long press GR on the button's wrapper, not the button itself. // the long press GR on the button's wrapper, not the button itself.
@ -184,11 +188,13 @@ const CGFloat kMaxTextViewHeight = 98;
self.quotedReplyWrapper.hidden = YES; self.quotedReplyWrapper.hidden = YES;
[self.quotedReplyWrapper setContentHuggingHorizontalLow]; [self.quotedReplyWrapper setContentHuggingHorizontalLow];
[self.quotedReplyWrapper setCompressionResistanceHorizontalLow]; [self.quotedReplyWrapper setCompressionResistanceHorizontalLow];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _quotedReplyWrapper);
_linkPreviewWrapper = [UIView containerView]; _linkPreviewWrapper = [UIView containerView];
self.linkPreviewWrapper.hidden = YES; self.linkPreviewWrapper.hidden = YES;
[self.linkPreviewWrapper setContentHuggingHorizontalLow]; [self.linkPreviewWrapper setContentHuggingHorizontalLow];
[self.linkPreviewWrapper setCompressionResistanceHorizontalLow]; [self.linkPreviewWrapper setCompressionResistanceHorizontalLow];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _linkPreviewWrapper);
// V Stack // V Stack
UIStackView *vStack = [[UIStackView alloc] UIStackView *vStack = [[UIStackView alloc]
@ -346,6 +352,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.quotedReplyWrapper.layoutMargins = UIEdgeInsetsZero; self.quotedReplyWrapper.layoutMargins = UIEdgeInsetsZero;
[self.quotedReplyWrapper addSubview:quotedMessagePreview]; [self.quotedReplyWrapper addSubview:quotedMessagePreview];
[quotedMessagePreview ows_autoPinToSuperviewMargins]; [quotedMessagePreview ows_autoPinToSuperviewMargins];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, quotedMessagePreview);
self.linkPreviewView.hasAsymmetricalRounding = !self.quotedReply; self.linkPreviewView.hasAsymmetricalRounding = !self.quotedReply;
} }
@ -563,6 +570,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.voiceMemoUI.backgroundColor = Theme.toolbarBackgroundColor; self.voiceMemoUI.backgroundColor = Theme.toolbarBackgroundColor;
[self addSubview:self.voiceMemoUI]; [self addSubview:self.voiceMemoUI];
self.voiceMemoUI.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height); self.voiceMemoUI.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _voiceMemoUI);
self.voiceMemoContentView = [UIView new]; self.voiceMemoContentView = [UIView new];
[self.voiceMemoUI addSubview:self.voiceMemoContentView]; [self.voiceMemoUI addSubview:self.voiceMemoContentView];
@ -572,6 +580,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.recordingLabel.textColor = [UIColor ows_destructiveRedColor]; self.recordingLabel.textColor = [UIColor ows_destructiveRedColor];
self.recordingLabel.font = [UIFont ows_mediumFontWithSize:14.f]; self.recordingLabel.font = [UIFont ows_mediumFontWithSize:14.f];
[self.voiceMemoContentView addSubview:self.recordingLabel]; [self.voiceMemoContentView addSubview:self.recordingLabel];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _recordingLabel);
VoiceMemoLockView *voiceMemoLockView = [VoiceMemoLockView new]; VoiceMemoLockView *voiceMemoLockView = [VoiceMemoLockView new];
self.voiceMemoLockView = voiceMemoLockView; self.voiceMemoLockView = voiceMemoLockView;
@ -773,6 +782,7 @@ const CGFloat kMaxTextViewHeight = 98;
[sendVoiceMemoButton autoVCenterInSuperview]; [sendVoiceMemoButton autoVCenterInSuperview];
[sendVoiceMemoButton setCompressionResistanceHigh]; [sendVoiceMemoButton setCompressionResistanceHigh];
[sendVoiceMemoButton setContentHuggingHigh]; [sendVoiceMemoButton setContentHuggingHigh];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, sendVoiceMemoButton);
UIButton *cancelButton = [[OWSButton alloc] initWithBlock:^{ UIButton *cancelButton = [[OWSButton alloc] initWithBlock:^{
[weakSelf.inputToolbarDelegate voiceMemoGestureDidCancel]; [weakSelf.inputToolbarDelegate voiceMemoGestureDidCancel];
@ -781,6 +791,7 @@ const CGFloat kMaxTextViewHeight = 98;
[cancelButton setTitleColor:UIColor.ows_destructiveRedColor forState:UIControlStateNormal]; [cancelButton setTitleColor:UIColor.ows_destructiveRedColor forState:UIControlStateNormal];
cancelButton.alpha = 0; cancelButton.alpha = 0;
cancelButton.titleLabel.textAlignment = NSTextAlignmentCenter; cancelButton.titleLabel.textAlignment = NSTextAlignmentCenter;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, cancelButton);
[self.voiceMemoContentView addSubview:cancelButton]; [self.voiceMemoContentView addSubview:cancelButton];
OWSAssert(self.recordingLabel != nil); OWSAssert(self.recordingLabel != nil);

View File

@ -619,10 +619,12 @@ typedef enum : NSUInteger {
[self.collectionView autoPinEdgeToSuperviewSafeArea:ALEdgeTrailing]; [self.collectionView autoPinEdgeToSuperviewSafeArea:ALEdgeTrailing];
[self.collectionView applyScrollViewInsetsFix]; [self.collectionView applyScrollViewInsetsFix];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _collectionView);
_inputToolbar = [[ConversationInputToolbar alloc] initWithConversationStyle:self.conversationStyle]; _inputToolbar = [[ConversationInputToolbar alloc] initWithConversationStyle:self.conversationStyle];
self.inputToolbar.inputToolbarDelegate = self; self.inputToolbar.inputToolbarDelegate = self;
self.inputToolbar.inputTextViewDelegate = self; self.inputToolbar.inputTextViewDelegate = self;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _inputToolbar);
self.loadMoreHeader = [UILabel new]; self.loadMoreHeader = [UILabel new];
self.loadMoreHeader.text = NSLocalizedString(@"CONVERSATION_VIEW_LOADING_MORE_MESSAGES", self.loadMoreHeader.text = NSLocalizedString(@"CONVERSATION_VIEW_LOADING_MORE_MESSAGES",
@ -634,6 +636,7 @@ typedef enum : NSUInteger {
[self.loadMoreHeader autoPinWidthToWidthOfView:self.view]; [self.loadMoreHeader autoPinWidthToWidthOfView:self.view];
[self.loadMoreHeader autoPinEdgeToSuperviewEdge:ALEdgeTop]; [self.loadMoreHeader autoPinEdgeToSuperviewEdge:ALEdgeTop];
[self.loadMoreHeader autoSetDimension:ALDimensionHeight toSize:kLoadMoreHeaderHeight]; [self.loadMoreHeader autoSetDimension:ALDimensionHeight toSize:kLoadMoreHeaderHeight];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _loadMoreHeader);
[self updateShowLoadMoreHeader]; [self updateShowLoadMoreHeader];
} }
@ -1006,6 +1009,7 @@ typedef enum : NSUInteger {
[closeButton autoPinLeadingToTrailingEdgeOfView:label offset:kBannerHSpacing]; [closeButton autoPinLeadingToTrailingEdgeOfView:label offset:kBannerHSpacing];
[bannerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:tapSelector]]; [bannerView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:tapSelector]];
bannerView.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"banner_close");
[self.view addSubview:bannerView]; [self.view addSubview:bannerView];
[bannerView autoPinToTopLayoutGuideOfViewController:self withInset:10]; [bannerView autoPinToTopLayoutGuideOfViewController:self withInset:10];
@ -1083,11 +1087,13 @@ typedef enum : NSUInteger {
}]; }];
[actionSheet addAction:verifyAction]; [actionSheet addAction:verifyAction];
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.dismissButton UIAlertAction *dismissAction =
style:UIAlertActionStyleCancel [UIAlertAction actionWithTitle:CommonStrings.dismissButton
handler:^(UIAlertAction *action) { accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dismiss")
[weakSelf resetVerificationStateToDefault]; style:UIAlertActionStyleCancel
}]; handler:^(UIAlertAction *action) {
[weakSelf resetVerificationStateToDefault];
}];
[actionSheet addAction:dismissAction]; [actionSheet addAction:dismissAction];
[self dismissKeyBoard]; [self dismissKeyBoard];
@ -1358,6 +1364,7 @@ typedef enum : NSUInteger {
ConversationHeaderView *headerView = ConversationHeaderView *headerView =
[[ConversationHeaderView alloc] initWithThread:self.thread contactsManager:self.contactsManager]; [[ConversationHeaderView alloc] initWithThread:self.thread contactsManager:self.contactsManager];
self.headerView = headerView; self.headerView = headerView;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, headerView);
headerView.delegate = self; headerView.delegate = self;
self.navigationItem.titleView = headerView; self.navigationItem.titleView = headerView;
@ -1483,7 +1490,9 @@ typedef enum : NSUInteger {
0, 0,
round(image.size.width + imageEdgeInsets.left + imageEdgeInsets.right), round(image.size.width + imageEdgeInsets.left + imageEdgeInsets.right),
round(image.size.height + imageEdgeInsets.top + imageEdgeInsets.bottom)); round(image.size.height + imageEdgeInsets.top + imageEdgeInsets.bottom));
[barButtons addObject:[[UIBarButtonItem alloc] initWithCustomView:callButton]]; [barButtons
addObject:[[UIBarButtonItem alloc] initWithCustomView:callButton
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"call")]];
} }
if (self.disappearingMessagesConfiguration.isEnabled) { if (self.disappearingMessagesConfiguration.isEnabled) {
@ -1502,7 +1511,9 @@ typedef enum : NSUInteger {
timerView.frame = CGRectMake(0, 0, 36, 44); timerView.frame = CGRectMake(0, 0, 36, 44);
} }
[barButtons addObject:[[UIBarButtonItem alloc] initWithCustomView:timerView]]; [barButtons
addObject:[[UIBarButtonItem alloc] initWithCustomView:timerView
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"timer")]];
} }
self.navigationItem.rightBarButtonItems = [barButtons copy]; self.navigationItem.rightBarButtonItems = [barButtons copy];
@ -1804,14 +1815,15 @@ typedef enum : NSUInteger {
[actionSheet addAction:deleteMessageAction]; [actionSheet addAction:deleteMessageAction];
UIAlertAction *resendMessageAction = [UIAlertAction UIAlertAction *resendMessageAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"SEND_AGAIN_BUTTON", @"") actionWithTitle:NSLocalizedString(@"SEND_AGAIN_BUTTON", @"")
style:UIAlertActionStyleDefault accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_again")
handler:^(UIAlertAction *action) { style:UIAlertActionStyleDefault
[self.editingDatabaseConnection handler:^(UIAlertAction *action) {
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) { [self.editingDatabaseConnection
[self.messageSenderJobQueue addMessage:message transaction:transaction]; asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[self.messageSenderJobQueue addMessage:message transaction:transaction];
}];
}]; }];
}];
[actionSheet addAction:resendMessageAction]; [actionSheet addAction:resendMessageAction];
@ -1851,20 +1863,21 @@ typedef enum : NSUInteger {
[alert addAction:[OWSAlerts cancelAction]]; [alert addAction:[OWSAlerts cancelAction]];
UIAlertAction *resetSessionAction = [UIAlertAction UIAlertAction *resetSessionAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"FINGERPRINT_SHRED_KEYMATERIAL_BUTTON", @"") actionWithTitle:NSLocalizedString(@"FINGERPRINT_SHRED_KEYMATERIAL_BUTTON", @"")
style:UIAlertActionStyleDefault accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"reset_session")
handler:^(UIAlertAction *action) { style:UIAlertActionStyleDefault
if (![self.thread isKindOfClass:[TSContactThread class]]) { handler:^(UIAlertAction *action) {
// Corrupt Message errors only appear in contact threads. if (![self.thread isKindOfClass:[TSContactThread class]]) {
OWSLogError(@"Unexpected request to reset session in group thread. Refusing"); // Corrupt Message errors only appear in contact threads.
return; OWSLogError(@"Unexpected request to reset session in group thread. Refusing");
} return;
TSContactThread *contactThread = (TSContactThread *)self.thread; }
[self.editingDatabaseConnection TSContactThread *contactThread = (TSContactThread *)self.thread;
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) { [self.editingDatabaseConnection
[self.sessionResetJobQueue addContactThread:contactThread transaction:transaction]; asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[self.sessionResetJobQueue addContactThread:contactThread transaction:transaction];
}];
}]; }];
}];
[alert addAction:resetSessionAction]; [alert addAction:resetSessionAction];
[self dismissKeyBoard]; [self dismissKeyBoard];
@ -1885,6 +1898,7 @@ typedef enum : NSUInteger {
UIAlertAction *showSafteyNumberAction = UIAlertAction *showSafteyNumberAction =
[UIAlertAction actionWithTitle:NSLocalizedString(@"SHOW_SAFETY_NUMBER_ACTION", @"Action sheet item") [UIAlertAction actionWithTitle:NSLocalizedString(@"SHOW_SAFETY_NUMBER_ACTION", @"Action sheet item")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"show_safety_number")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
OWSLogInfo(@"Remote Key Changed actions: Show fingerprint display"); OWSLogInfo(@"Remote Key Changed actions: Show fingerprint display");
@ -1894,13 +1908,14 @@ typedef enum : NSUInteger {
UIAlertAction *acceptSafetyNumberAction = UIAlertAction *acceptSafetyNumberAction =
[UIAlertAction actionWithTitle:NSLocalizedString(@"ACCEPT_NEW_IDENTITY_ACTION", @"Action sheet item") [UIAlertAction actionWithTitle:NSLocalizedString(@"ACCEPT_NEW_IDENTITY_ACTION", @"Action sheet item")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"accept_safety_number")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
OWSLogInfo(@"Remote Key Changed actions: Accepted new identity key"); OWSLogInfo(@"Remote Key Changed actions: Accepted new identity key");
// DEPRECATED: we're no longer creating these incoming SN error's per message, // DEPRECATED: we're no longer creating these incoming SN error's per message,
// but there will be some legacy ones in the wild, behind which await // but there will be some legacy ones in the wild, behind which await
// as-of-yet-undecrypted messages // as-of-yet-undecrypted messages
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
if ([errorMessage isKindOfClass:[TSInvalidIdentityKeyReceivingErrorMessage class]]) { if ([errorMessage isKindOfClass:[TSInvalidIdentityKeyReceivingErrorMessage class]]) {
@ -1936,6 +1951,7 @@ typedef enum : NSUInteger {
__weak ConversationViewController *weakSelf = self; __weak ConversationViewController *weakSelf = self;
UIAlertAction *callAction = [UIAlertAction actionWithTitle:[CallStrings callBackAlertCallButton] UIAlertAction *callAction = [UIAlertAction actionWithTitle:[CallStrings callBackAlertCallButton]
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"call_back")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[weakSelf startAudioCall]; [weakSelf startAudioCall];
@ -2207,20 +2223,22 @@ typedef enum : NSUInteger {
[actionSheet addAction:[OWSAlerts cancelAction]]; [actionSheet addAction:[OWSAlerts cancelAction]];
UIAlertAction *blockAction = [UIAlertAction UIAlertAction *blockAction =
actionWithTitle:NSLocalizedString( [UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_OFFER_ACTIONSHEET_BLOCK_ACTION",
@"BLOCK_OFFER_ACTIONSHEET_BLOCK_ACTION", @"Action sheet that will block an unknown user.") @"Action sheet that will block an unknown user.")
style:UIAlertActionStyleDestructive accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"block_user")
handler:^(UIAlertAction *action) { style:UIAlertActionStyleDestructive
OWSLogInfo(@"Blocking an unknown user."); handler:^(UIAlertAction *action) {
[self.blockingManager addBlockedPhoneNumber:interaction.recipientId]; OWSLogInfo(@"Blocking an unknown user.");
// Delete the offers. [self.blockingManager addBlockedPhoneNumber:interaction.recipientId];
[self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { // Delete the offers.
contactThread.hasDismissedOffers = YES; [self.editingDatabaseConnection
[contactThread saveWithTransaction:transaction]; readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[interaction removeWithTransaction:transaction]; contactThread.hasDismissedOffers = YES;
}]; [contactThread saveWithTransaction:transaction];
}]; [interaction removeWithTransaction:transaction];
}];
}];
[actionSheet addAction:blockAction]; [actionSheet addAction:blockAction];
[self dismissKeyBoard]; [self dismissKeyBoard];
@ -2566,6 +2584,7 @@ typedef enum : NSUInteger {
[self.view addSubview:self.scrollDownButton]; [self.view addSubview:self.scrollDownButton];
[self.scrollDownButton autoSetDimension:ALDimensionWidth toSize:ConversationScrollButton.buttonSize]; [self.scrollDownButton autoSetDimension:ALDimensionWidth toSize:ConversationScrollButton.buttonSize];
[self.scrollDownButton autoSetDimension:ALDimensionHeight toSize:ConversationScrollButton.buttonSize]; [self.scrollDownButton autoSetDimension:ALDimensionHeight toSize:ConversationScrollButton.buttonSize];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _scrollDownButton);
// The "scroll down" button layout tracks the content inset of the collection view, // The "scroll down" button layout tracks the content inset of the collection view,
// so pin to the edge of the collection view. // so pin to the edge of the collection view.
@ -2584,6 +2603,7 @@ typedef enum : NSUInteger {
[self.scrollUpButton autoPinToTopLayoutGuideOfViewController:self withInset:0]; [self.scrollUpButton autoPinToTopLayoutGuideOfViewController:self withInset:0];
[self.scrollUpButton autoPinEdgeToSuperviewSafeArea:ALEdgeTrailing]; [self.scrollUpButton autoPinEdgeToSuperviewSafeArea:ALEdgeTrailing];
#endif #endif
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _scrollUpButton);
[self updateScrollDownButtonLayout]; [self updateScrollDownButtonLayout];
} }
@ -3409,34 +3429,40 @@ typedef enum : NSUInteger {
[actionSheet addAction:[OWSAlerts cancelAction]]; [actionSheet addAction:[OWSAlerts cancelAction]];
UIAlertAction *takeMediaAction = [UIAlertAction UIAlertAction *takeMediaAction =
actionWithTitle:NSLocalizedString(@"MEDIA_FROM_CAMERA_BUTTON", @"media picker option to take photo or video") [UIAlertAction actionWithTitle:NSLocalizedString(
style:UIAlertActionStyleDefault @"MEDIA_FROM_CAMERA_BUTTON", @"media picker option to take photo or video")
handler:^(UIAlertAction *action) { accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_camera")
[self takePictureOrVideo]; style:UIAlertActionStyleDefault
}]; handler:^(UIAlertAction *action) {
[self takePictureOrVideo];
}];
UIImage *takeMediaImage = [UIImage imageNamed:@"actionsheet_camera_black"]; UIImage *takeMediaImage = [UIImage imageNamed:@"actionsheet_camera_black"];
OWSAssertDebug(takeMediaImage); OWSAssertDebug(takeMediaImage);
[takeMediaAction setValue:takeMediaImage forKey:@"image"]; [takeMediaAction setValue:takeMediaImage forKey:@"image"];
[actionSheet addAction:takeMediaAction]; [actionSheet addAction:takeMediaAction];
UIAlertAction *chooseMediaAction = [UIAlertAction UIAlertAction *chooseMediaAction =
actionWithTitle:NSLocalizedString(@"MEDIA_FROM_LIBRARY_BUTTON", @"media picker option to choose from library") [UIAlertAction actionWithTitle:NSLocalizedString(
style:UIAlertActionStyleDefault @"MEDIA_FROM_LIBRARY_BUTTON", @"media picker option to choose from library")
handler:^(UIAlertAction *action) { accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_choose_media")
[self chooseFromLibraryAsMedia]; style:UIAlertActionStyleDefault
}]; handler:^(UIAlertAction *action) {
[self chooseFromLibraryAsMedia];
}];
UIImage *chooseMediaImage = [UIImage imageNamed:@"actionsheet_camera_roll_black"]; UIImage *chooseMediaImage = [UIImage imageNamed:@"actionsheet_camera_roll_black"];
OWSAssertDebug(chooseMediaImage); OWSAssertDebug(chooseMediaImage);
[chooseMediaAction setValue:chooseMediaImage forKey:@"image"]; [chooseMediaAction setValue:chooseMediaImage forKey:@"image"];
[actionSheet addAction:chooseMediaAction]; [actionSheet addAction:chooseMediaAction];
UIAlertAction *gifAction = [UIAlertAction UIAlertAction *gifAction =
actionWithTitle:NSLocalizedString(@"SELECT_GIF_BUTTON", @"Label for 'select GIF to attach' action sheet button") [UIAlertAction actionWithTitle:NSLocalizedString(@"SELECT_GIF_BUTTON",
style:UIAlertActionStyleDefault @"Label for 'select GIF to attach' action sheet button")
handler:^(UIAlertAction *action) { accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_gif")
[self showGifPicker]; style:UIAlertActionStyleDefault
}]; handler:^(UIAlertAction *action) {
[self showGifPicker];
}];
UIImage *gifImage = [UIImage imageNamed:@"actionsheet_gif_black"]; UIImage *gifImage = [UIImage imageNamed:@"actionsheet_gif_black"];
OWSAssertDebug(gifImage); OWSAssertDebug(gifImage);
[gifAction setValue:gifImage forKey:@"image"]; [gifAction setValue:gifImage forKey:@"image"];
@ -3445,6 +3471,7 @@ typedef enum : NSUInteger {
UIAlertAction *chooseDocumentAction = UIAlertAction *chooseDocumentAction =
[UIAlertAction actionWithTitle:NSLocalizedString(@"MEDIA_FROM_DOCUMENT_PICKER_BUTTON", [UIAlertAction actionWithTitle:NSLocalizedString(@"MEDIA_FROM_DOCUMENT_PICKER_BUTTON",
@"action sheet button title when choosing attachment type") @"action sheet button title when choosing attachment type")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_document")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[self showAttachmentDocumentPickerMenu]; [self showAttachmentDocumentPickerMenu];
@ -3458,6 +3485,7 @@ typedef enum : NSUInteger {
UIAlertAction *chooseContactAction = UIAlertAction *chooseContactAction =
[UIAlertAction actionWithTitle:NSLocalizedString(@"ATTACHMENT_MENU_CONTACT_BUTTON", [UIAlertAction actionWithTitle:NSLocalizedString(@"ATTACHMENT_MENU_CONTACT_BUTTON",
@"attachment menu option to send contact") @"attachment menu option to send contact")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_contact")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[self chooseContactForSending]; [self chooseContactForSending];
@ -4543,6 +4571,10 @@ typedef enum : NSUInteger {
[cell loadForDisplay]; [cell loadForDisplay];
// TODO: Confirm with nancy if this will work.
NSString *cellName = [NSString stringWithFormat:@"interaction.%@", NSUUID.UUID.UUIDString];
cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, cellName);
return cell; return cell;
} }

View File

@ -287,6 +287,8 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
self.reminderViewCell.selectionStyle = UITableViewCellSelectionStyleNone; self.reminderViewCell.selectionStyle = UITableViewCellSelectionStyleNone;
[self.reminderViewCell.contentView addSubview:reminderStackView]; [self.reminderViewCell.contentView addSubview:reminderStackView];
[reminderStackView autoPinEdgesToSuperviewEdges]; [reminderStackView autoPinEdgesToSuperviewEdges];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _reminderViewCell);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, reminderStackView);
__weak HomeViewController *weakSelf = self; __weak HomeViewController *weakSelf = self;
ReminderView *deregisteredView = ReminderView *deregisteredView =
@ -301,18 +303,21 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
}]; }];
_deregisteredView = deregisteredView; _deregisteredView = deregisteredView;
[reminderStackView addArrangedSubview:deregisteredView]; [reminderStackView addArrangedSubview:deregisteredView];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, deregisteredView);
ReminderView *outageView = [ReminderView ReminderView *outageView = [ReminderView
nagWithText:NSLocalizedString(@"OUTAGE_WARNING", @"Label warning the user that the Signal service may be down.") nagWithText:NSLocalizedString(@"OUTAGE_WARNING", @"Label warning the user that the Signal service may be down.")
tapAction:nil]; tapAction:nil];
_outageView = outageView; _outageView = outageView;
[reminderStackView addArrangedSubview:outageView]; [reminderStackView addArrangedSubview:outageView];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, outageView);
ReminderView *archiveReminderView = ReminderView *archiveReminderView =
[ReminderView explanationWithText:NSLocalizedString(@"INBOX_VIEW_ARCHIVE_MODE_REMINDER", [ReminderView explanationWithText:NSLocalizedString(@"INBOX_VIEW_ARCHIVE_MODE_REMINDER",
@"Label reminding the user that they are in archive mode.")]; @"Label reminding the user that they are in archive mode.")];
_archiveReminderView = archiveReminderView; _archiveReminderView = archiveReminderView;
[reminderStackView addArrangedSubview:archiveReminderView]; [reminderStackView addArrangedSubview:archiveReminderView];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, archiveReminderView);
ReminderView *missingContactsPermissionView = [ReminderView ReminderView *missingContactsPermissionView = [ReminderView
nagWithText:NSLocalizedString(@"INBOX_VIEW_MISSING_CONTACTS_PERMISSION", nagWithText:NSLocalizedString(@"INBOX_VIEW_MISSING_CONTACTS_PERMISSION",
@ -322,6 +327,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
}]; }];
_missingContactsPermissionView = missingContactsPermissionView; _missingContactsPermissionView = missingContactsPermissionView;
[reminderStackView addArrangedSubview:missingContactsPermissionView]; [reminderStackView addArrangedSubview:missingContactsPermissionView];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, missingContactsPermissionView);
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
self.tableView.delegate = self; self.tableView.delegate = self;
@ -332,6 +338,8 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kArchivedConversationsReuseIdentifier]; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kArchivedConversationsReuseIdentifier];
[self.view addSubview:self.tableView]; [self.view addSubview:self.tableView];
[self.tableView autoPinEdgesToSuperviewEdges]; [self.tableView autoPinEdgesToSuperviewEdges];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _tableView);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _searchBar);
self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 60; self.tableView.estimatedRowHeight = 60;
@ -340,6 +348,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
[self.view addSubview:self.emptyInboxView]; [self.view addSubview:self.emptyInboxView];
[self.emptyInboxView autoPinWidthToSuperviewMargins]; [self.emptyInboxView autoPinWidthToSuperviewMargins];
[self.emptyInboxView autoVCenterInSuperview]; [self.emptyInboxView autoVCenterInSuperview];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _emptyInboxView);
[self createFirstConversationCueView]; [self createFirstConversationCueView];
[self.view addSubview:self.firstConversationCueView]; [self.view addSubview:self.firstConversationCueView];
@ -353,6 +362,8 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
relation:NSLayoutRelationGreaterThanOrEqual]; relation:NSLayoutRelationGreaterThanOrEqual];
[self.firstConversationCueView autoPinEdgeToSuperviewMargin:ALEdgeBottom [self.firstConversationCueView autoPinEdgeToSuperviewMargin:ALEdgeBottom
relation:NSLayoutRelationGreaterThanOrEqual]; relation:NSLayoutRelationGreaterThanOrEqual];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _firstConversationCueView);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _firstConversationLabel);
UIRefreshControl *pullToRefreshView = [UIRefreshControl new]; UIRefreshControl *pullToRefreshView = [UIRefreshControl new];
pullToRefreshView.tintColor = [UIColor grayColor]; pullToRefreshView.tintColor = [UIColor grayColor];
@ -360,13 +371,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
action:@selector(pullToRefreshPerformed:) action:@selector(pullToRefreshPerformed:)
forControlEvents:UIControlEventValueChanged]; forControlEvents:UIControlEventValueChanged];
[self.tableView insertSubview:pullToRefreshView atIndex:0]; [self.tableView insertSubview:pullToRefreshView atIndex:0];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, pullToRefreshView);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _tableView);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _emptyInboxView);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _firstConversationCueView);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _firstConversationLabel);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _searchBar);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _reminderStackView);
} }
- (UIView *)createEmptyInboxView - (UIView *)createEmptyInboxView
@ -744,15 +749,18 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
settingsButton = [[UIBarButtonItem alloc] initWithImage:image settingsButton = [[UIBarButtonItem alloc] initWithImage:image
style:UIBarButtonItemStylePlain style:UIBarButtonItemStylePlain
target:self target:self
action:@selector(settingsButtonPressed:)]; action:@selector(settingsButtonPressed:)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"settings")];
} }
settingsButton.accessibilityLabel = CommonStrings.openSettingsButton; settingsButton.accessibilityLabel = CommonStrings.openSettingsButton;
self.navigationItem.leftBarButtonItem = settingsButton; self.navigationItem.leftBarButtonItem = settingsButton;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, settingsButton);
self.navigationItem.rightBarButtonItem = self.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose
target:self target:self
action:@selector(showNewConversationView)]; action:@selector(showNewConversationView)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"compose")];
} }
- (void)settingsButtonPressed:(id)sender - (void)settingsButtonPressed:(id)sender
@ -1098,6 +1106,10 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
BOOL isBlocked = [self.blocklistCache isThreadBlocked:thread.threadRecord]; BOOL isBlocked = [self.blocklistCache isThreadBlocked:thread.threadRecord];
[cell configureWithThread:thread isBlocked:isBlocked]; [cell configureWithThread:thread isBlocked:isBlocked];
// TODO: Work with Nancy to confirm that this is accessible via Appium.
NSString *cellName = [NSString stringWithFormat:@"conversation-%@", NSUUID.UUID.UUIDString];
cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, cellName);
return cell; return cell;
} }
@ -1141,6 +1153,8 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
[stackView autoPinEdgeToSuperviewMargin:ALEdgeTop]; [stackView autoPinEdgeToSuperviewMargin:ALEdgeTop];
[stackView autoPinEdgeToSuperviewMargin:ALEdgeBottom]; [stackView autoPinEdgeToSuperviewMargin:ALEdgeBottom];
cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"archived_conversations");
return cell; return cell;
} }

View File

@ -104,14 +104,17 @@ NS_ASSUME_NONNULL_BEGIN
self.navigationItem.leftBarButtonItem = self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
target:self target:self
action:@selector(dismissPressed)]; action:@selector(dismissPressed)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"stop")];
// TODO: We should use separate RTL and LTR flavors of this asset. // TODO: We should use separate RTL and LTR flavors of this asset.
UIImage *newGroupImage = [UIImage imageNamed:@"btnGroup--white"]; UIImage *newGroupImage = [UIImage imageNamed:@"btnGroup--white"];
OWSAssertDebug(newGroupImage); OWSAssertDebug(newGroupImage);
UIBarButtonItem *newGroupButton = [[UIBarButtonItem alloc] initWithImage:newGroupImage UIBarButtonItem *newGroupButton =
style:UIBarButtonItemStylePlain [[UIBarButtonItem alloc] initWithImage:newGroupImage
target:self style:UIBarButtonItemStylePlain
action:@selector(showNewGroupView:)]; target:self
action:@selector(showNewGroupView:)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"new_group")];
newGroupButton.accessibilityLabel newGroupButton.accessibilityLabel
= NSLocalizedString(@"CREATE_NEW_GROUP", @"Accessibility label for the create group new group button"); = NSLocalizedString(@"CREATE_NEW_GROUP", @"Accessibility label for the create group new group button");
self.navigationItem.rightBarButtonItem = newGroupButton; self.navigationItem.rightBarButtonItem = newGroupButton;
@ -122,6 +125,7 @@ NS_ASSUME_NONNULL_BEGIN
searchBar.delegate = self; searchBar.delegate = self;
searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @""); searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @"");
[searchBar sizeToFit]; [searchBar sizeToFit];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, searchBar);
_tableViewController = [OWSTableViewController new]; _tableViewController = [OWSTableViewController new];
_tableViewController.delegate = self; _tableViewController.delegate = self;
@ -149,6 +153,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.noSignalContactsView autoPinWidthToSuperview]; [self.noSignalContactsView autoPinWidthToSuperview];
[self.noSignalContactsView autoPinEdgeToSuperviewEdge:ALEdgeTop]; [self.noSignalContactsView autoPinEdgeToSuperviewEdge:ALEdgeTop];
[self.noSignalContactsView autoPinToBottomLayoutGuideOfViewController:self withInset:0]; [self.noSignalContactsView autoPinToBottomLayoutGuideOfViewController:self withInset:0];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _noSignalContactsView);
UIRefreshControl *pullToRefreshView = [UIRefreshControl new]; UIRefreshControl *pullToRefreshView = [UIRefreshControl new];
pullToRefreshView.tintColor = [UIColor grayColor]; pullToRefreshView.tintColor = [UIColor grayColor];
@ -156,6 +161,7 @@ NS_ASSUME_NONNULL_BEGIN
action:@selector(pullToRefreshPerformed:) action:@selector(pullToRefreshPerformed:)
forControlEvents:UIControlEventValueChanged]; forControlEvents:UIControlEventValueChanged];
[self.tableViewController.tableView insertSubview:pullToRefreshView atIndex:0]; [self.tableViewController.tableView insertSubview:pullToRefreshView atIndex:0];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, pullToRefreshView);
[self updateTableContents]; [self updateTableContents];
@ -254,6 +260,7 @@ NS_ASSUME_NONNULL_BEGIN
action:@selector(presentInviteFlow) action:@selector(presentInviteFlow)
forControlEvents:UIControlEventTouchUpInside]; forControlEvents:UIControlEventTouchUpInside];
lastSubview = inviteContactsButton; lastSubview = inviteContactsButton;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, inviteContactsButton);
UIButton *searchByPhoneNumberButton = [UIButton buttonWithType:UIButtonTypeCustom]; UIButton *searchByPhoneNumberButton = [UIButton buttonWithType:UIButtonTypeCustom];
[searchByPhoneNumberButton setTitle:NSLocalizedString(@"NO_CONTACTS_SEARCH_BY_PHONE_NUMBER", [searchByPhoneNumberButton setTitle:NSLocalizedString(@"NO_CONTACTS_SEARCH_BY_PHONE_NUMBER",
@ -268,6 +275,7 @@ NS_ASSUME_NONNULL_BEGIN
action:@selector(hideBackgroundView) action:@selector(hideBackgroundView)
forControlEvents:UIControlEventTouchUpInside]; forControlEvents:UIControlEventTouchUpInside];
lastSubview = searchByPhoneNumberButton; lastSubview = searchByPhoneNumberButton;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, searchByPhoneNumberButton);
[lastSubview autoPinEdgeToSuperviewMargin:ALEdgeBottom]; [lastSubview autoPinEdgeToSuperviewMargin:ALEdgeBottom];
@ -320,7 +328,7 @@ NS_ASSUME_NONNULL_BEGIN
if (self.contactsManager.isSystemContactsDenied) { if (self.contactsManager.isSystemContactsDenied) {
OWSTableItem *contactReminderItem = [OWSTableItem OWSTableItem *contactReminderItem = [OWSTableItem
itemWithCustomCellBlock:^{ itemWithCustomCellBlock:^{
UITableViewCell *newCell = [OWSTableItem newCell]; UITableViewCell *cell = [OWSTableItem newCell];
ReminderView *reminderView = [ReminderView ReminderView *reminderView = [ReminderView
nagWithText:NSLocalizedString(@"COMPOSE_SCREEN_MISSING_CONTACTS_PERMISSION", nagWithText:NSLocalizedString(@"COMPOSE_SCREEN_MISSING_CONTACTS_PERMISSION",
@ -328,10 +336,13 @@ NS_ASSUME_NONNULL_BEGIN
tapAction:^{ tapAction:^{
[[UIApplication sharedApplication] openSystemSettings]; [[UIApplication sharedApplication] openSystemSettings];
}]; }];
[newCell.contentView addSubview:reminderView]; [cell.contentView addSubview:reminderView];
[reminderView autoPinEdgesToSuperviewEdges]; [reminderView autoPinEdgesToSuperviewEdges];
return newCell; cell.accessibilityIdentifier
= ACCESSIBILITY_IDENTIFIER_WITH_NAME(NewContactThreadViewController, @"missing_contacts");
return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
actionBlock:nil]; actionBlock:nil];
@ -347,6 +358,8 @@ NS_ASSUME_NONNULL_BEGIN
[staticSection [staticSection
addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"NEW_CONVERSATION_FIND_BY_PHONE_NUMBER", addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"NEW_CONVERSATION_FIND_BY_PHONE_NUMBER",
@"A label the cell that lets you add a new member to a group.") @"A label the cell that lets you add a new member to a group.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
NewContactThreadViewController, @"find_by_phone")
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
actionBlock:^{ actionBlock:^{
NewNonContactConversationViewController *viewController = NewNonContactConversationViewController *viewController =
@ -360,12 +373,14 @@ NS_ASSUME_NONNULL_BEGIN
// Invite Contacts // Invite Contacts
[staticSection [staticSection
addItem:[OWSTableItem addItem:[OWSTableItem
disclosureItemWithText:NSLocalizedString(@"INVITE_FRIENDS_CONTACT_TABLE_BUTTON", disclosureItemWithText:NSLocalizedString(@"INVITE_FRIENDS_CONTACT_TABLE_BUTTON",
@"Label for the cell that presents the 'invite contacts' workflow.") @"Label for the cell that presents the 'invite contacts' workflow.")
customRowHeight:UITableViewAutomaticDimension accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
actionBlock:^{ NewContactThreadViewController, @"invite_contacts")
[weakSelf presentInviteFlow]; customRowHeight:UITableViewAutomaticDimension
}]]; actionBlock:^{
[weakSelf presentInviteFlow];
}]];
} }
[contents addSection:staticSection]; [contents addSection:staticSection];
@ -450,6 +465,9 @@ NS_ASSUME_NONNULL_BEGIN
// hide separator for loading cell. The loading cell doesn't really feel like a cell // hide separator for loading cell. The loading cell doesn't really feel like a cell
loadingCell.backgroundView = [UIView new]; loadingCell.backgroundView = [UIView new];
loadingCell.accessibilityIdentifier
= ACCESSIBILITY_IDENTIFIER_WITH_NAME(NewContactThreadViewController, @"loading");
OWSTableItem *loadingItem = OWSTableItem *loadingItem =
[OWSTableItem itemWithCustomCell:loadingCell customRowHeight:40 actionBlock:nil]; [OWSTableItem itemWithCustomCell:loadingCell customRowHeight:40 actionBlock:nil];
[contactsSection addItem:loadingItem]; [contactsSection addItem:loadingItem];
@ -495,6 +513,11 @@ 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(
NewContactThreadViewController, cellName);
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -541,6 +564,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:phoneNumber]; [cell configureWithRecipientId:phoneNumber];
NSString *cellName = [NSString stringWithFormat:@"non_signal_contact.%@", phoneNumber];
cell.accessibilityIdentifier
= ACCESSIBILITY_IDENTIFIER_WITH_NAME(NewContactThreadViewController, cellName);
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -552,11 +580,13 @@ NS_ASSUME_NONNULL_BEGIN
@"Text for button to send a Signal invite via SMS. %@ is " @"Text for button to send a Signal invite via SMS. %@ is "
@"placeholder for the recipient's phone number."), @"placeholder for the recipient's phone number."),
phoneNumber]; phoneNumber];
[phoneNumbersSection addItem:[OWSTableItem disclosureItemWithText:text [phoneNumbersSection
customRowHeight:UITableViewAutomaticDimension addItem:[OWSTableItem disclosureItemWithText:text
actionBlock:^{ accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"invite_via_sms")
[weakSelf sendTextToPhoneNumber:phoneNumber]; customRowHeight:UITableViewAutomaticDimension
}]]; actionBlock:^{
[weakSelf sendTextToPhoneNumber:phoneNumber];
}]];
} }
} }
if (searchPhoneNumbers.count > 0) { if (searchPhoneNumbers.count > 0) {
@ -590,6 +620,11 @@ 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(NewContactThreadViewController, cellName);
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -613,6 +648,13 @@ NS_ASSUME_NONNULL_BEGIN
itemWithCustomCellBlock:^{ itemWithCustomCellBlock:^{
GroupTableViewCell *cell = [GroupTableViewCell new]; GroupTableViewCell *cell = [GroupTableViewCell new];
[cell configureWithThread:thread]; [cell configureWithThread:thread];
// TODO: We need to verify that UUIDs will work for Nancy.
NSString *cellName =
[NSString stringWithFormat:@"group.%@", NSUUID.UUID.UUIDString];
cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(
NewContactThreadViewController, cellName);
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -644,7 +686,9 @@ NS_ASSUME_NONNULL_BEGIN
@"Text for button to send a Signal invite via SMS. %@ is " @"Text for button to send a Signal invite via SMS. %@ is "
@"placeholder for the recipient's phone number."), @"placeholder for the recipient's phone number."),
displayName]; displayName];
NSString *accessibilityIdentifier = [NSString stringWithFormat:@"invite_via_sms.%@", phoneNumber.toE164];
[inviteeSection addItem:[OWSTableItem disclosureItemWithText:text [inviteeSection addItem:[OWSTableItem disclosureItemWithText:text
accessibilityIdentifier:accessibilityIdentifier
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
actionBlock:^{ actionBlock:^{
[weakSelf sendTextToPhoneNumber:phoneNumber.toE164]; [weakSelf sendTextToPhoneNumber:phoneNumber.toE164];
@ -738,7 +782,6 @@ NS_ASSUME_NONNULL_BEGIN
- (void)sendTextToPhoneNumber:(NSString *)phoneNumber - (void)sendTextToPhoneNumber:(NSString *)phoneNumber
{ {
OWSInviteFlow *inviteFlow = [[OWSInviteFlow alloc] initWithPresentingViewController:self]; OWSInviteFlow *inviteFlow = [[OWSInviteFlow alloc] initWithPresentingViewController:self];
OWSAssertDebug([phoneNumber length] > 0); OWSAssertDebug([phoneNumber length] > 0);
@ -753,16 +796,18 @@ NS_ASSUME_NONNULL_BEGIN
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction UIAlertAction *okAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"OK", @"") actionWithTitle:NSLocalizedString(@"OK", @"")
style:UIAlertActionStyleDefault accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"ok")
handler:^(UIAlertAction *action) { style:UIAlertActionStyleDefault
[self.searchBar resignFirstResponder]; handler:^(UIAlertAction *action) {
if ([MFMessageComposeViewController canSendText]) { [self.searchBar resignFirstResponder];
[inviteFlow sendSMSToPhoneNumbers:@[ phoneNumber ]]; if ([MFMessageComposeViewController canSendText]) {
} else { [inviteFlow sendSMSToPhoneNumbers:@[ phoneNumber ]];
[OWSAlerts showErrorAlertWithMessage:NSLocalizedString(@"UNSUPPORTED_FEATURE_ERROR", @"")]; } else {
} [OWSAlerts
}]; showErrorAlertWithMessage:NSLocalizedString(@"UNSUPPORTED_FEATURE_ERROR", @"")];
}
}];
[alert addAction:[OWSAlerts cancelAction]]; [alert addAction:[OWSAlerts cancelAction]];
[alert addAction:okAction]; [alert addAction:okAction];

View File

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

View File

@ -224,19 +224,19 @@ NS_ASSUME_NONNULL_BEGIN
addItem:[OWSTableItem disclosureItemWithText: addItem:[OWSTableItem disclosureItemWithText:
NSLocalizedString(@"ENABLE_2FA_VIEW_DISABLE_2FA", NSLocalizedString(@"ENABLE_2FA_VIEW_DISABLE_2FA",
@"Label for the 'enable two-factor auth' item in the settings view") @"Label for the 'enable two-factor auth' item in the settings view")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"enable_2fa") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"enable_2fa")
actionBlock:^{ actionBlock:^{
[weakSelf tryToDisable2FA]; [weakSelf tryToDisable2FA];
}]]; }]];
} else { } else {
[section [section addItem:[OWSTableItem
addItem:[OWSTableItem disclosureItemWithText: disclosureItemWithText:
NSLocalizedString(@"ENABLE_2FA_VIEW_ENABLE_2FA", NSLocalizedString(@"ENABLE_2FA_VIEW_ENABLE_2FA",
@"Label for the 'enable two-factor auth' item in the settings view") @"Label for the 'enable two-factor auth' item in the settings view")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"disable_2fa") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"disable_2fa")
actionBlock:^{ actionBlock:^{
[weakSelf showEnable2FAWorkUI]; [weakSelf showEnable2FAWorkUI];
}]]; }]];
} }
[contents addSection:section]; [contents addSection:section];
self.tableViewController.contents = contents; self.tableViewController.contents = contents;
@ -268,18 +268,18 @@ NS_ASSUME_NONNULL_BEGIN
[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BACK_BUTTON", @"button text for back button") [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BACK_BUTTON", @"button text for back button")
style:UIBarButtonItemStylePlain style:UIBarButtonItemStylePlain
target:self target:self
action:@selector(backButtonWasPressed)]; action:@selector(backButtonWasPressed)
backButton.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"back"); accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"back")];
self.navigationItem.backBarButtonItem = backButton; self.navigationItem.backBarButtonItem = backButton;
if (self.shouldHaveNextButton) { if (self.shouldHaveNextButton) {
UIBarButtonItem *nextButton = [[UIBarButtonItem alloc] UIBarButtonItem *nextButton = [[UIBarButtonItem alloc]
initWithTitle:NSLocalizedString(@"ENABLE_2FA_VIEW_NEXT_BUTTON", initWithTitle:NSLocalizedString(@"ENABLE_2FA_VIEW_NEXT_BUTTON",
@"Label for the 'next' button in the 'enable two factor auth' views.") @"Label for the 'next' button in the 'enable two factor auth' views.")
style:UIBarButtonItemStylePlain style:UIBarButtonItemStylePlain
target:self target:self
action:@selector(nextButtonWasPressed)]; action:@selector(nextButtonWasPressed)
nextButton.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"next"); accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"next")];
self.navigationItem.rightBarButtonItem = nextButton; self.navigationItem.rightBarButtonItem = nextButton;
} else { } else {
self.navigationItem.rightBarButtonItem = nil; self.navigationItem.rightBarButtonItem = nil;

View File

@ -112,7 +112,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
nameRow.userInteractionEnabled = YES; nameRow.userInteractionEnabled = YES;
[nameRow [nameRow
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(nameRowTapped:)]]; addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(nameRowTapped:)]];
nameRow.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"nameRow"); nameRow.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"nameRow");
[rows addObject:nameRow]; [rows addObject:nameRow];
UILabel *nameLabel = [UILabel new]; UILabel *nameLabel = [UILabel new];
@ -152,7 +152,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
avatarRow.userInteractionEnabled = YES; avatarRow.userInteractionEnabled = YES;
[avatarRow [avatarRow
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarRowTapped:)]]; addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarRowTapped:)]];
avatarRow.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"avatarRow"); avatarRow.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"avatarRow");
[rows addObject:avatarRow]; [rows addObject:avatarRow];
UILabel *avatarLabel = [UILabel new]; UILabel *avatarLabel = [UILabel new];
@ -165,7 +165,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
[avatarLabel autoVCenterInSuperview]; [avatarLabel autoVCenterInSuperview];
self.avatarView = [AvatarImageView new]; self.avatarView = [AvatarImageView new];
self.avatarView.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"avatarView"); self.avatarView.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"avatarView");
UIImage *cameraImage = [UIImage imageNamed:@"settings-avatar-camera"]; UIImage *cameraImage = [UIImage imageNamed:@"settings-avatar-camera"];
self.cameraImageView = [[UIImageView alloc] initWithImage:cameraImage]; self.cameraImageView = [[UIImageView alloc] initWithImage:cameraImage];
@ -189,7 +189,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
infoRow.userInteractionEnabled = YES; infoRow.userInteractionEnabled = YES;
[infoRow [infoRow
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(infoRowTapped:)]]; addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(infoRowTapped:)]];
infoRow.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"infoRow"); infoRow.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"infoRow");
[rows addObject:infoRow]; [rows addObject:infoRow];
UILabel *infoLabel = [UILabel new]; UILabel *infoLabel = [UILabel new];
@ -308,11 +308,11 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
UIAlertAction *discardAction = UIAlertAction *discardAction =
[UIAlertAction actionWithTitle:NSLocalizedString(@"ALERT_DISCARD_BUTTON", [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) {
[weakSelf profileCompletedOrSkipped]; [weakSelf profileCompletedOrSkipped];
}]; }];
discardAction.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"discard");
[alert addAction:discardAction]; [alert addAction:discardAction];
[alert addAction:[OWSAlerts cancelAction]]; [alert addAction:[OWSAlerts cancelAction]];

View File

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

View File

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

View File

@ -214,7 +214,8 @@ const CGFloat kIconViewLength = 24;
[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"EDIT_TXT", nil) [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"EDIT_TXT", nil)
style:UIBarButtonItemStylePlain style:UIBarButtonItemStylePlain
target:self target:self
action:@selector(didTapEditButton)]; action:@selector(didTapEditButton)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"edit")];
} }
} }
@ -272,6 +273,7 @@ const CGFloat kIconViewLength = 24;
self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.rowHeight = UITableViewAutomaticDimension;
_disappearingMessagesDurationLabel = [UILabel new]; _disappearingMessagesDurationLabel = [UILabel new];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _disappearingMessagesDurationLabel);
self.disappearingMessagesDurations = [OWSDisappearingMessagesConfiguration validDurationsSeconds]; self.disappearingMessagesDurations = [OWSDisappearingMessagesConfiguration validDurationsSeconds];
@ -323,21 +325,31 @@ const CGFloat kIconViewLength = 24;
if ([self.thread isKindOfClass:[TSContactThread class]] && self.contactsManager.supportsContactEditing if ([self.thread isKindOfClass:[TSContactThread class]] && self.contactsManager.supportsContactEditing
&& !self.hasExistingContact) { && !self.hasExistingContact) {
[mainSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ [mainSection
return addItem:[OWSTableItem
[weakSelf disclosureCellWithName:NSLocalizedString(@"CONVERSATION_SETTINGS_NEW_CONTACT", itemWithCustomCellBlock:^{
@"Label for 'new contact' button in conversation settings view.") return [weakSelf
iconName:@"table_ic_new_contact"]; disclosureCellWithName:
} NSLocalizedString(@"CONVERSATION_SETTINGS_NEW_CONTACT",
actionBlock:^{ @"Label for 'new contact' button in conversation settings view.")
[weakSelf presentContactViewController]; iconName:@"table_ic_new_contact"
}]]; accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
[mainSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ OWSConversationSettingsViewController, @"new_contact")];
return }
[weakSelf disclosureCellWithName:NSLocalizedString(@"CONVERSATION_SETTINGS_ADD_TO_EXISTING_CONTACT", actionBlock:^{
@"Label for 'new contact' button in conversation settings view.") [weakSelf presentContactViewController];
iconName:@"table_ic_add_to_existing_contact"]; }]];
} [mainSection addItem:[OWSTableItem
itemWithCustomCellBlock:^{
return [weakSelf
disclosureCellWithName:
NSLocalizedString(@"CONVERSATION_SETTINGS_ADD_TO_EXISTING_CONTACT",
@"Label for 'new contact' button in conversation settings view.")
iconName:@"table_ic_add_to_existing_contact"
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController,
@"add_to_existing_contact")];
}
actionBlock:^{ actionBlock:^{
OWSConversationSettingsViewController *strongSelf = weakSelf; OWSConversationSettingsViewController *strongSelf = weakSelf;
OWSCAssertDebug(strongSelf); OWSCAssertDebug(strongSelf);
@ -349,8 +361,11 @@ const CGFloat kIconViewLength = 24;
[mainSection addItem:[OWSTableItem [mainSection addItem:[OWSTableItem
itemWithCustomCellBlock:^{ itemWithCustomCellBlock:^{
return [weakSelf disclosureCellWithName:MediaStrings.allMedia return [weakSelf
iconName:@"actionsheet_camera_roll_black"]; disclosureCellWithName:MediaStrings.allMedia
iconName:@"actionsheet_camera_roll_black"
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController, @"all_media")];
} }
actionBlock:^{ actionBlock:^{
[weakSelf showMediaGallery]; [weakSelf showMediaGallery];
@ -362,24 +377,31 @@ const CGFloat kIconViewLength = 24;
NSString *title = NSLocalizedString(@"CONVERSATION_SETTINGS_SEARCH", NSString *title = NSLocalizedString(@"CONVERSATION_SETTINGS_SEARCH",
@"Table cell label in conversation settings which returns the user to the " @"Table cell label in conversation settings which returns the user to the "
@"conversation with 'search mode' activated"); @"conversation with 'search mode' activated");
return return [weakSelf
[weakSelf disclosureCellWithName:title iconName:@"conversation_settings_search"]; disclosureCellWithName:title
iconName:@"conversation_settings_search"
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController, @"search")];
} }
actionBlock:^{ actionBlock:^{
[weakSelf tappedConversationSearch]; [weakSelf tappedConversationSearch];
}]]; }]];
if (!isNoteToSelf && !self.isGroupThread && self.thread.hasSafetyNumbers) { if (!isNoteToSelf && !self.isGroupThread && self.thread.hasSafetyNumbers) {
[mainSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ [mainSection
return [weakSelf addItem:[OWSTableItem
disclosureCellWithName: itemWithCustomCellBlock:^{
NSLocalizedString(@"VERIFY_PRIVACY", return [weakSelf
@"Label for button or row which allows users to verify the safety number of another user.") disclosureCellWithName:NSLocalizedString(@"VERIFY_PRIVACY",
iconName:@"table_ic_not_verified"]; @"Label for button or row which allows users to verify the "
} @"safety number of another user.")
actionBlock:^{ iconName:@"table_ic_not_verified"
[weakSelf showVerificationView]; accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
}]]; OWSConversationSettingsViewController, @"safety_numbers")];
}
actionBlock:^{
[weakSelf showVerificationView];
}]];
} }
if (isNoteToSelf) { if (isNoteToSelf) {
@ -392,15 +414,18 @@ const CGFloat kIconViewLength = 24;
OWSCAssertDebug(strongSelf); OWSCAssertDebug(strongSelf);
return [strongSelf return [strongSelf
labelCellWithName: labelCellWithName:
(strongSelf.isGroupThread (strongSelf.isGroupThread
? NSLocalizedString( ? NSLocalizedString(
@"CONVERSATION_SETTINGS_VIEW_PROFILE_IS_SHARED_WITH_GROUP", @"CONVERSATION_SETTINGS_VIEW_PROFILE_IS_SHARED_WITH_GROUP",
@"Indicates that user's profile has been shared with a group.") @"Indicates that user's profile has been shared with a group.")
: NSLocalizedString( : NSLocalizedString(
@"CONVERSATION_SETTINGS_VIEW_PROFILE_IS_SHARED_WITH_USER", @"CONVERSATION_SETTINGS_VIEW_PROFILE_IS_SHARED_WITH_USER",
@"Indicates that user's profile has been shared with a user.")) @"Indicates that user's profile has been shared with a user."))
iconName:@"table_ic_share_profile"]; iconName:@"table_ic_share_profile"
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController,
@"profile_is_shared")];
} }
actionBlock:nil]]; actionBlock:nil]];
} else { } else {
@ -411,13 +436,15 @@ const CGFloat kIconViewLength = 24;
OWSCAssertDebug(strongSelf); OWSCAssertDebug(strongSelf);
UITableViewCell *cell = [strongSelf UITableViewCell *cell = [strongSelf
disclosureCellWithName: disclosureCellWithName:
(strongSelf.isGroupThread (strongSelf.isGroupThread
? NSLocalizedString(@"CONVERSATION_SETTINGS_VIEW_SHARE_PROFILE_WITH_GROUP", ? NSLocalizedString(@"CONVERSATION_SETTINGS_VIEW_SHARE_PROFILE_WITH_GROUP",
@"Action that shares user profile with a group.") @"Action that shares user profile with a group.")
: NSLocalizedString(@"CONVERSATION_SETTINGS_VIEW_SHARE_PROFILE_WITH_USER", : NSLocalizedString(@"CONVERSATION_SETTINGS_VIEW_SHARE_PROFILE_WITH_USER",
@"Action that shares user profile with a user.")) @"Action that shares user profile with a user."))
iconName:@"table_ic_share_profile"]; iconName:@"table_ic_share_profile"
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController, @"share_profile")];
cell.userInteractionEnabled = !strongSelf.hasLeftGroup; cell.userInteractionEnabled = !strongSelf.hasLeftGroup;
return cell; return cell;
@ -476,6 +503,9 @@ const CGFloat kIconViewLength = 24;
cell.userInteractionEnabled = !strongSelf.hasLeftGroup; cell.userInteractionEnabled = !strongSelf.hasLeftGroup;
cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController, @"disappearing_messages");
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -524,6 +554,9 @@ const CGFloat kIconViewLength = 24;
cell.userInteractionEnabled = !strongSelf.hasLeftGroup; cell.userInteractionEnabled = !strongSelf.hasLeftGroup;
cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController, @"disappearing_messages_duration");
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -541,9 +574,12 @@ const CGFloat kIconViewLength = 24;
[OWSConversationColor conversationColorOrDefaultForColorName:colorName].themeColor; [OWSConversationColor conversationColorOrDefaultForColorName:colorName].themeColor;
NSString *title = NSLocalizedString(@"CONVERSATION_SETTINGS_CONVERSATION_COLOR", NSString *title = NSLocalizedString(@"CONVERSATION_SETTINGS_CONVERSATION_COLOR",
@"Label for table cell which leads to picking a new conversation color"); @"Label for table cell which leads to picking a new conversation color");
return [strongSelf cellWithName:title return [strongSelf
iconName:@"ic_color_palette" cellWithName:title
disclosureIconColor:currentColor]; iconName:@"ic_color_palette"
disclosureIconColor:currentColor
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController, @"conversation_color")];
} }
actionBlock:^{ actionBlock:^{
[weakSelf showColorPicker]; [weakSelf showColorPicker];
@ -561,7 +597,9 @@ const CGFloat kIconViewLength = 24;
UITableViewCell *cell = UITableViewCell *cell =
[weakSelf disclosureCellWithName:NSLocalizedString(@"EDIT_GROUP_ACTION", [weakSelf disclosureCellWithName:NSLocalizedString(@"EDIT_GROUP_ACTION",
@"table cell label in conversation settings") @"table cell label in conversation settings")
iconName:@"table_ic_group_edit"]; iconName:@"table_ic_group_edit"
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController, @"edit_group")];
cell.userInteractionEnabled = !weakSelf.hasLeftGroup; cell.userInteractionEnabled = !weakSelf.hasLeftGroup;
return cell; return cell;
} }
@ -573,7 +611,9 @@ const CGFloat kIconViewLength = 24;
UITableViewCell *cell = UITableViewCell *cell =
[weakSelf disclosureCellWithName:NSLocalizedString(@"LIST_GROUP_MEMBERS_ACTION", [weakSelf disclosureCellWithName:NSLocalizedString(@"LIST_GROUP_MEMBERS_ACTION",
@"table cell label in conversation settings") @"table cell label in conversation settings")
iconName:@"table_ic_group_members"]; iconName:@"table_ic_group_members"
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController, @"group_members")];
cell.userInteractionEnabled = !weakSelf.hasLeftGroup; cell.userInteractionEnabled = !weakSelf.hasLeftGroup;
return cell; return cell;
} }
@ -585,7 +625,9 @@ const CGFloat kIconViewLength = 24;
UITableViewCell *cell = UITableViewCell *cell =
[weakSelf disclosureCellWithName:NSLocalizedString(@"LEAVE_GROUP_ACTION", [weakSelf disclosureCellWithName:NSLocalizedString(@"LEAVE_GROUP_ACTION",
@"table cell label in conversation settings") @"table cell label in conversation settings")
iconName:@"table_ic_group_leave"]; iconName:@"table_ic_group_leave"
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController, @"leave_group")];
cell.userInteractionEnabled = !weakSelf.hasLeftGroup; cell.userInteractionEnabled = !weakSelf.hasLeftGroup;
return cell; return cell;
@ -638,6 +680,10 @@ const CGFloat kIconViewLength = 24;
OWSSound sound = [OWSSounds notificationSoundForThread:strongSelf.thread]; OWSSound sound = [OWSSounds notificationSoundForThread:strongSelf.thread];
cell.detailTextLabel.text = [OWSSounds displayNameForSound:sound]; cell.detailTextLabel.text = [OWSSounds displayNameForSound:sound];
cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController, @"notifications");
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -706,6 +752,10 @@ const CGFloat kIconViewLength = 24;
[contentRow autoPinEdgesToSuperviewMargins]; [contentRow autoPinEdgesToSuperviewMargins];
cell.detailTextLabel.text = muteStatus; cell.detailTextLabel.text = muteStatus;
cell.accessibilityIdentifier
= ACCESSIBILITY_IDENTIFIER_WITH_NAME(OWSConversationSettingsViewController, @"mute");
return cell; return cell;
} }
customRowHeight:UITableViewAutomaticDimension customRowHeight:UITableViewAutomaticDimension
@ -743,8 +793,11 @@ const CGFloat kIconViewLength = 24;
cellTitle = NSLocalizedString(@"CONVERSATION_SETTINGS_BLOCK_THIS_USER", cellTitle = NSLocalizedString(@"CONVERSATION_SETTINGS_BLOCK_THIS_USER",
@"table cell label in conversation settings"); @"table cell label in conversation settings");
} }
UITableViewCell *cell = UITableViewCell *cell = [strongSelf
[strongSelf disclosureCellWithName:cellTitle iconName:@"table_ic_block"]; disclosureCellWithName:cellTitle
iconName:@"table_ic_block"
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(
OWSConversationSettingsViewController, @"block")];
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
@ -755,6 +808,7 @@ const CGFloat kIconViewLength = 24;
action:@selector(blockConversationSwitchDidChange:) action:@selector(blockConversationSwitchDidChange:)
forControlEvents:UIControlEventValueChanged]; forControlEvents:UIControlEventValueChanged];
cell.accessoryView = blockConversationSwitch; cell.accessoryView = blockConversationSwitch;
return cell; return cell;
} }
actionBlock:nil]]; actionBlock:nil]];
@ -812,17 +866,23 @@ const CGFloat kIconViewLength = 24;
return cell; return cell;
} }
- (UITableViewCell *)disclosureCellWithName:(NSString *)name iconName:(NSString *)iconName - (UITableViewCell *)disclosureCellWithName:(NSString *)name
iconName:(NSString *)iconName
accessibilityIdentifier:(NSString *)accessibilityIdentifier
{ {
UITableViewCell *cell = [self cellWithName:name iconName:iconName]; UITableViewCell *cell = [self cellWithName:name iconName:iconName];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.accessibilityIdentifier = accessibilityIdentifier;
return cell; return cell;
} }
- (UITableViewCell *)labelCellWithName:(NSString *)name iconName:(NSString *)iconName - (UITableViewCell *)labelCellWithName:(NSString *)name
iconName:(NSString *)iconName
accessibilityIdentifier:(NSString *)accessibilityIdentifier
{ {
UITableViewCell *cell = [self cellWithName:name iconName:iconName]; UITableViewCell *cell = [self cellWithName:name iconName:iconName];
cell.accessoryType = UITableViewCellAccessoryNone; cell.accessoryType = UITableViewCellAccessoryNone;
cell.accessibilityIdentifier = accessibilityIdentifier;
return cell; return cell;
} }
@ -916,6 +976,8 @@ const CGFloat kIconViewLength = 24;
action:@selector(conversationNameTouched:)]]; action:@selector(conversationNameTouched:)]];
mainSectionHeader.userInteractionEnabled = YES; mainSectionHeader.userInteractionEnabled = YES;
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, mainSectionHeader);
return mainSectionHeader; return mainSectionHeader;
} }
@ -1084,11 +1146,12 @@ const CGFloat kIconViewLength = 24;
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *leaveAction = [UIAlertAction UIAlertAction *leaveAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"LEAVE_BUTTON_TITLE", @"Confirmation button within contextual alert") actionWithTitle:NSLocalizedString(@"LEAVE_BUTTON_TITLE", @"Confirmation button within contextual alert")
style:UIAlertActionStyleDestructive accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"leave_group_confirm")
handler:^(UIAlertAction *_Nonnull action) { style:UIAlertActionStyleDestructive
[self leaveGroup]; handler:^(UIAlertAction *_Nonnull action) {
}]; [self leaveGroup];
}];
[alert addAction:leaveAction]; [alert addAction:leaveAction];
[alert addAction:[OWSAlerts cancelAction]]; [alert addAction:[OWSAlerts cancelAction]];
@ -1228,6 +1291,7 @@ const CGFloat kIconViewLength = 24;
if (self.thread.isMuted) { if (self.thread.isMuted) {
UIAlertAction *action = [UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_UNMUTE_ACTION", UIAlertAction *action = [UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_UNMUTE_ACTION",
@"Label for button to unmute a thread.") @"Label for button to unmute a thread.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"unmute")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *_Nonnull ignore) { handler:^(UIAlertAction *_Nonnull ignore) {
[weakSelf setThreadMutedUntilDate:nil]; [weakSelf setThreadMutedUntilDate:nil];
@ -1238,6 +1302,7 @@ const CGFloat kIconViewLength = 24;
[actionSheet [actionSheet
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_ONE_MINUTE_ACTION", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_ONE_MINUTE_ACTION",
@"Label for button to mute a thread for a minute.") @"Label for button to mute a thread for a minute.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"mute_1_minute")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *_Nonnull ignore) { handler:^(UIAlertAction *_Nonnull ignore) {
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"]; NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
@ -1255,6 +1320,7 @@ const CGFloat kIconViewLength = 24;
[actionSheet [actionSheet
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_ONE_HOUR_ACTION", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_ONE_HOUR_ACTION",
@"Label for button to mute a thread for a hour.") @"Label for button to mute a thread for a hour.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"mute_1_hour")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *_Nonnull ignore) { handler:^(UIAlertAction *_Nonnull ignore) {
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"]; NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
@ -1271,6 +1337,7 @@ const CGFloat kIconViewLength = 24;
[actionSheet [actionSheet
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_ONE_DAY_ACTION", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_ONE_DAY_ACTION",
@"Label for button to mute a thread for a day.") @"Label for button to mute a thread for a day.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"mute_1_day")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *_Nonnull ignore) { handler:^(UIAlertAction *_Nonnull ignore) {
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"]; NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
@ -1287,6 +1354,7 @@ const CGFloat kIconViewLength = 24;
[actionSheet [actionSheet
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_ONE_WEEK_ACTION", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_ONE_WEEK_ACTION",
@"Label for button to mute a thread for a week.") @"Label for button to mute a thread for a week.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"mute_1_week")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *_Nonnull ignore) { handler:^(UIAlertAction *_Nonnull ignore) {
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"]; NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
@ -1303,6 +1371,7 @@ const CGFloat kIconViewLength = 24;
[actionSheet [actionSheet
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_ONE_YEAR_ACTION", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_ONE_YEAR_ACTION",
@"Label for button to mute a thread for a year.") @"Label for button to mute a thread for a year.")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"mute_1_year")
style:UIAlertActionStyleDestructive style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *_Nonnull ignore) { handler:^(UIAlertAction *_Nonnull ignore) {
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"]; NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];

View File

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

View File

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

View File

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

View File

@ -323,7 +323,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
addAction:[UIAlertAction addAction:[UIAlertAction
actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_EMAIL", actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_EMAIL",
@"Label for the 'email debug log' option of the debug log alert.") @"Label for the 'email debug log' option of the debug log alert.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"send_email") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_email")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[Pastelog.sharedManager submitEmail:url]; [Pastelog.sharedManager submitEmail:url];
@ -332,7 +332,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
}]]; }]];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_COPY_LINK", [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_COPY_LINK",
@"Label for the 'copy link' option of the debug log alert.") @"Label for the 'copy link' option of the debug log alert.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"copy_link") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"copy_link")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
UIPasteboard *pb = [UIPasteboard generalPasteboard]; UIPasteboard *pb = [UIPasteboard generalPasteboard];
@ -344,7 +344,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
[alert [alert
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_SEND_TO_SELF", addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_SEND_TO_SELF",
@"Label for the 'send to self' option of the debug log alert.") @"Label for the 'send to self' option of the debug log alert.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"send_to_self") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_to_self")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[Pastelog.sharedManager sendToSelf:url]; [Pastelog.sharedManager sendToSelf:url];
@ -352,7 +352,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
[alert addAction:[UIAlertAction actionWithTitle: [alert addAction:[UIAlertAction actionWithTitle:
NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_SEND_TO_LAST_THREAD", NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_SEND_TO_LAST_THREAD",
@"Label for the 'send to last thread' option of the debug log alert.") @"Label for the 'send to last thread' option of the debug log alert.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"send_to_last_thread") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_to_last_thread")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[Pastelog.sharedManager sendToMostRecentThread:url]; [Pastelog.sharedManager sendToMostRecentThread:url];
@ -362,14 +362,14 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
addAction: addAction:
[UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_BUG_REPORT", [UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_BUG_REPORT",
@"Label for the 'Open a Bug Report' option of the debug log alert.") @"Label for the 'Open a Bug Report' option of the debug log alert.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"submit_bug_report") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"submit_bug_report")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[Pastelog.sharedManager prepareRedirection:url completion:completion]; [Pastelog.sharedManager prepareRedirection:url completion:completion];
}]]; }]];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_SHARE", [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_SHARE",
@"Label for the 'Share' option of the debug log alert.") @"Label for the 'Share' option of the debug log alert.")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"share") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"share")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[AttachmentSharing showShareUIForText:url.absoluteString [AttachmentSharing showShareUIForText:url.absoluteString
@ -515,7 +515,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
message:message message:message
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"") [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"ok") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"ok")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:nil]]; handler:nil]];
UIViewController *presentingViewController = UIApplication.sharedApplication.frontmostViewControllerIgnoringAlerts; UIViewController *presentingViewController = UIApplication.sharedApplication.frontmostViewControllerIgnoringAlerts;
@ -573,7 +573,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
[alert [alert
addAction:[UIAlertAction addAction:[UIAlertAction
actionWithTitle:NSLocalizedString(@"OK", @"") actionWithTitle:NSLocalizedString(@"OK", @"")
accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"ok") accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"ok")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[UIApplication.sharedApplication [UIApplication.sharedApplication

View File

@ -89,6 +89,11 @@ typedef BOOL (^OWSTableSwitchBlock)(void);
customRowHeight:(CGFloat)customRowHeight customRowHeight:(CGFloat)customRowHeight
actionBlock:(nullable OWSTableActionBlock)actionBlock; actionBlock:(nullable OWSTableActionBlock)actionBlock;
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text
accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier
customRowHeight:(CGFloat)customRowHeight
actionBlock:(nullable OWSTableActionBlock)actionBlock;
+ (OWSTableItem *)checkmarkItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock; + (OWSTableItem *)checkmarkItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock;
+ (OWSTableItem *)checkmarkItemWithText:(NSString *)text + (OWSTableItem *)checkmarkItemWithText:(NSString *)text

View File

@ -225,10 +225,22 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text + (OWSTableItem *)disclosureItemWithText:(NSString *)text
customRowHeight:(CGFloat)customRowHeight customRowHeight:(CGFloat)customRowHeight
actionBlock:(nullable OWSTableActionBlock)actionBlock actionBlock:(nullable OWSTableActionBlock)actionBlock
{
return [self disclosureItemWithText:text
accessibilityIdentifier:nil
customRowHeight:customRowHeight
actionBlock:actionBlock];
}
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text
accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier
customRowHeight:(CGFloat)customRowHeight
actionBlock:(nullable OWSTableActionBlock)actionBlock
{ {
OWSAssertDebug(customRowHeight > 0 || customRowHeight == UITableViewAutomaticDimension); OWSAssertDebug(customRowHeight > 0 || customRowHeight == UITableViewAutomaticDimension);
OWSTableItem *item = [self disclosureItemWithText:text actionBlock:actionBlock]; OWSTableItem *item =
[self disclosureItemWithText:text accessibilityIdentifier:accessibilityIdentifier actionBlock:actionBlock];
item.customRowHeight = @(customRowHeight); item.customRowHeight = @(customRowHeight);
return item; return item;
} }

View File

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

View File

@ -355,3 +355,42 @@ public extension UIBezierPath {
addLine(to: first) addLine(to: first)
} }
} }
// MARK: -
public extension UIBarButtonItem {
@objc
public convenience init(image: UIImage?, style: UIBarButtonItem.Style, target: Any?, action: Selector?, accessibilityIdentifier: String) {
self.init(image: image, style: style, target: target, action: action)
self.accessibilityIdentifier = accessibilityIdentifier
}
@objc
public convenience init(image: UIImage?, landscapeImagePhone: UIImage?, style: UIBarButtonItem.Style, target: Any?, action: Selector?, accessibilityIdentifier: String) {
self.init(image: image, landscapeImagePhone: landscapeImagePhone, style: style, target: target, action: action)
self.accessibilityIdentifier = accessibilityIdentifier
}
@objc
public convenience init(title: String?, style: UIBarButtonItem.Style, target: Any?, action: Selector?, accessibilityIdentifier: String) {
self.init(title: title, style: style, target: target, action: action)
self.accessibilityIdentifier = accessibilityIdentifier
}
@objc
public convenience init(barButtonSystemItem systemItem: UIBarButtonItem.SystemItem, target: Any?, action: Selector?, accessibilityIdentifier: String) {
self.init(barButtonSystemItem: systemItem, target: target, action: action)
self.accessibilityIdentifier = accessibilityIdentifier
}
@objc
public convenience init(customView: UIView, accessibilityIdentifier: String) {
self.init(customView: customView)
self.accessibilityIdentifier = accessibilityIdentifier
}
}

View File

@ -4,9 +4,11 @@
#import "Theme.h" #import "Theme.h"
#import "UIColor+OWS.h" #import "UIColor+OWS.h"
#import "UIUtil.h"
#import "UIView+OWS.h" #import "UIView+OWS.h"
#import "UIViewController+OWS.h" #import "UIViewController+OWS.h"
#import <SignalCoreKit/iOSVersions.h> #import <SignalCoreKit/iOSVersions.h>
#import <SignalMessaging/SignalMessaging-Swift.h>
#import <SignalServiceKit/AppContext.h> #import <SignalServiceKit/AppContext.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@ -120,7 +122,9 @@ NS_ASSUME_NONNULL_BEGIN
action:selector]; action:selector];
} }
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backButton]; UIBarButtonItem *backItem =
[[UIBarButtonItem alloc] initWithCustomView:backButton
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"back")];
backItem.width = buttonFrame.size.width; backItem.width = buttonFrame.size.width;
return backItem; return backItem;

View File

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

View File

@ -117,30 +117,30 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
preferredStyle:UIAlertControllerStyleActionSheet]; preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *blockAction = [UIAlertAction UIAlertAction *blockAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", @"Button label for the 'block' button") actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", @"Button label for the 'block' button")
style:UIAlertActionStyleDestructive accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"block")
handler:^(UIAlertAction *_Nonnull action) { style:UIAlertActionStyleDestructive
[self blockPhoneNumbers:phoneNumbers handler:^(UIAlertAction *_Nonnull action) {
displayName:displayName [self blockPhoneNumbers:phoneNumbers
fromViewController:fromViewController displayName:displayName
blockingManager:blockingManager fromViewController:fromViewController
completionBlock:^(UIAlertAction *ignore) { blockingManager:blockingManager
if (completionBlock) { completionBlock:^(UIAlertAction *ignore) {
completionBlock(YES); if (completionBlock) {
} completionBlock(YES);
}]; }
}]; }];
blockAction.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"block"); }];
[actionSheet addAction:blockAction]; [actionSheet addAction:blockAction];
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dismiss")
style:UIAlertActionStyleCancel style:UIAlertActionStyleCancel
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
if (completionBlock) { if (completionBlock) {
completionBlock(NO); completionBlock(NO);
} }
}]; }];
dismissAction.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"dismiss");
[actionSheet addAction:dismissAction]; [actionSheet addAction:dismissAction];
[fromViewController presentAlert:actionSheet]; [fromViewController presentAlert:actionSheet];
} }
@ -168,30 +168,30 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
preferredStyle:UIAlertControllerStyleActionSheet]; preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *blockAction = [UIAlertAction UIAlertAction *blockAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", @"Button label for the 'block' button") actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", @"Button label for the 'block' button")
style:UIAlertActionStyleDestructive accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"block")
handler:^(UIAlertAction *_Nonnull action) { style:UIAlertActionStyleDestructive
[self blockGroup:groupThread handler:^(UIAlertAction *_Nonnull action) {
fromViewController:fromViewController [self blockGroup:groupThread
blockingManager:blockingManager fromViewController:fromViewController
messageSender:messageSender blockingManager:blockingManager
completionBlock:^(UIAlertAction *ignore) { messageSender:messageSender
if (completionBlock) { completionBlock:^(UIAlertAction *ignore) {
completionBlock(YES); if (completionBlock) {
} completionBlock(YES);
}]; }
}]; }];
blockAction.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"block"); }];
[actionSheet addAction:blockAction]; [actionSheet addAction:blockAction];
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dismiss")
style:UIAlertActionStyleCancel style:UIAlertActionStyleCancel
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
if (completionBlock) { if (completionBlock) {
completionBlock(NO); completionBlock(NO);
} }
}]; }];
dismissAction.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"dismiss");
[actionSheet addAction:dismissAction]; [actionSheet addAction:dismissAction];
[fromViewController presentAlert:actionSheet]; [fromViewController presentAlert:actionSheet];
} }
@ -333,31 +333,32 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
UIAlertController *actionSheet = UIAlertController *actionSheet =
[UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet]; [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *unblockAction = [UIAlertAction UIAlertAction *unblockAction =
actionWithTitle:NSLocalizedString(@"BLOCK_LIST_UNBLOCK_BUTTON", @"Button label for the 'unblock' button") [UIAlertAction actionWithTitle:NSLocalizedString(
style:UIAlertActionStyleDestructive @"BLOCK_LIST_UNBLOCK_BUTTON", @"Button label for the 'unblock' button")
handler:^(UIAlertAction *_Nonnull action) { accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"unblock")
[BlockListUIUtils unblockPhoneNumbers:phoneNumbers style:UIAlertActionStyleDestructive
displayName:displayName handler:^(UIAlertAction *_Nonnull action) {
fromViewController:fromViewController [BlockListUIUtils unblockPhoneNumbers:phoneNumbers
blockingManager:blockingManager displayName:displayName
completionBlock:^(UIAlertAction *ignore) { fromViewController:fromViewController
if (completionBlock) { blockingManager:blockingManager
completionBlock(NO); completionBlock:^(UIAlertAction *ignore) {
} if (completionBlock) {
}]; completionBlock(NO);
}]; }
unblockAction.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"unblock"); }];
}];
[actionSheet addAction:unblockAction]; [actionSheet addAction:unblockAction];
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dismiss")
style:UIAlertActionStyleCancel style:UIAlertActionStyleCancel
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
if (completionBlock) { if (completionBlock) {
completionBlock(YES); completionBlock(YES);
} }
}]; }];
dismissAction.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"dismiss");
[actionSheet addAction:dismissAction]; [actionSheet addAction:dismissAction];
[fromViewController presentAlert:actionSheet]; [fromViewController presentAlert:actionSheet];
} }
@ -406,31 +407,31 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
message:message message:message
preferredStyle:UIAlertControllerStyleActionSheet]; preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *unblockAction = [UIAlertAction UIAlertAction *unblockAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_UNBLOCK_BUTTON",
actionWithTitle:NSLocalizedString(@"BLOCK_LIST_UNBLOCK_BUTTON", @"Button label for the 'unblock' button") @"Button label for the 'unblock' button")
style:UIAlertActionStyleDestructive accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"unblock")
handler:^(UIAlertAction *_Nonnull action) { style:UIAlertActionStyleDestructive
[BlockListUIUtils unblockGroup:groupModel handler:^(UIAlertAction *_Nonnull action) {
displayName:displayName [BlockListUIUtils unblockGroup:groupModel
fromViewController:fromViewController displayName:displayName
blockingManager:blockingManager fromViewController:fromViewController
completionBlock:^(UIAlertAction *ignore) { blockingManager:blockingManager
if (completionBlock) { completionBlock:^(UIAlertAction *ignore) {
completionBlock(NO); if (completionBlock) {
} completionBlock(NO);
}]; }
}]; }];
unblockAction.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"unblock"); }];
[actionSheet addAction:unblockAction]; [actionSheet addAction:unblockAction];
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dismiss")
style:UIAlertActionStyleCancel style:UIAlertActionStyleCancel
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
if (completionBlock) { if (completionBlock) {
completionBlock(YES); completionBlock(YES);
} }
}]; }];
dismissAction.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"dismiss");
[actionSheet addAction:dismissAction]; [actionSheet addAction:dismissAction];
[fromViewController presentAlert:actionSheet]; [fromViewController presentAlert:actionSheet];
} }
@ -473,9 +474,9 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action);
[UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"ok")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:completionBlock]; handler:completionBlock];
okAction.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"ok");
[alert addAction:okAction]; [alert addAction:okAction];
[fromViewController presentAlert:alert]; [fromViewController presentAlert:alert];
} }

View File

@ -1,5 +1,5 @@
// //
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2019 Open Whisper Systems. All rights reserved.
// //
#import "UIColor+OWS.h" #import "UIColor+OWS.h"
@ -7,10 +7,10 @@
#import <SignalServiceKit/MIMETypeUtil.h> #import <SignalServiceKit/MIMETypeUtil.h>
#import <SignalServiceKit/UIImage+OWS.h> #import <SignalServiceKit/UIImage+OWS.h>
#define SUBVIEW_ACCESSIBILITY_IDENTIFIER(_root_view, _variable_name) \ #define ACCESSIBILITY_IDENTIFIER_WITH_NAME(_root_view, _variable_name) \
([NSString stringWithFormat:@"%@.%@", _root_view.class, _variable_name]) ([NSString stringWithFormat:@"%@.%@", _root_view.class, _variable_name])
#define SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(_root_view, _variable_name) \ #define SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(_root_view, _variable_name) \
_variable_name.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(_root_view, (@ #_variable_name)) _variable_name.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(_root_view, (@ #_variable_name))
typedef void (^completionBlock)(void); typedef void (^completionBlock)(void);