diff --git a/Signal/src/ViewControllers/AppSettings/AboutTableViewController.m b/Signal/src/ViewControllers/AppSettings/AboutTableViewController.m index 2b2bdf672..4a592b66e 100644 --- a/Signal/src/ViewControllers/AppSettings/AboutTableViewController.m +++ b/Signal/src/ViewControllers/AppSettings/AboutTableViewController.m @@ -58,7 +58,7 @@ [informationSection addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_LEGAL_TERMS_CELL", @"table cell label") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"terms") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"terms") actionBlock:^{ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:kLegalTermsUrlString]]; @@ -69,7 +69,7 @@ OWSTableSection *helpSection = [OWSTableSection new]; helpSection.headerTitle = NSLocalizedString(@"SETTINGS_HELP_HEADER", @""); [helpSection addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_SUPPORT", @"") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"support") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"support") actionBlock:^{ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://support.signal.org"]]; diff --git a/Signal/src/ViewControllers/AppSettings/AdvancedSettingsTableViewController.m b/Signal/src/ViewControllers/AppSettings/AdvancedSettingsTableViewController.m index 7369ffa93..8c7654ac2 100644 --- a/Signal/src/ViewControllers/AppSettings/AdvancedSettingsTableViewController.m +++ b/Signal/src/ViewControllers/AppSettings/AdvancedSettingsTableViewController.m @@ -89,7 +89,7 @@ NS_ASSUME_NONNULL_BEGIN OWSTableSection *loggingSection = [OWSTableSection new]; loggingSection.headerTitle = NSLocalizedString(@"LOGGING_SECTION", nil); [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:^{ return [OWSPreferences isLoggingEnabled]; } @@ -103,7 +103,7 @@ NS_ASSUME_NONNULL_BEGIN if ([OWSPreferences isLoggingEnabled]) { [loggingSection 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:^{ OWSLogInfo(@"Submitting debug logs"); [DDLog flushLog]; @@ -117,7 +117,7 @@ NS_ASSUME_NONNULL_BEGIN pushNotificationsSection.headerTitle = NSLocalizedString(@"PUSH_REGISTER_TITLE", @"Used in table section header and alert view title contexts"); [pushNotificationsSection addItem:[OWSTableItem actionItemWithText:NSLocalizedString(@"REREGISTER_FOR_PUSH", nil) - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER( + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME( self, @"reregister_push_notifications") actionBlock:^{ [weakSelf syncPushTokens]; @@ -187,7 +187,7 @@ NS_ASSUME_NONNULL_BEGIN [censorshipSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_CENSORSHIP_CIRCUMVENTION", @"Label for the 'manual censorship circumvention' switch.") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"censorship_circumvention") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"censorship_circumvention") isOnBlock:isCensorshipCircumventionOnBlock isEnabledBlock:isManualCensorshipCircumventionOnEnabledBlock target:weakSelf diff --git a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m index 6350714c4..1dc3e958a 100644 --- a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m @@ -165,7 +165,7 @@ [accessoryLabel sizeToFit]; cell.accessoryView = accessoryLabel; cell.accessibilityIdentifier - = SUBVIEW_ACCESSIBILITY_IDENTIFIER(AppSettingsViewController, @"network_status"); + = ACCESSIBILITY_IDENTIFIER_WITH_NAME(AppSettingsViewController, @"network_status"); return cell; } actionBlock:nil]]; @@ -173,29 +173,29 @@ [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_INVITE_TITLE", @"Settings table view cell label") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"invite") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"invite") actionBlock:^{ [weakSelf showInviteFlow]; }]]; [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_TITLE", @"Settings table view cell label") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"privacy") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"privacy") actionBlock:^{ [weakSelf showPrivacy]; }]]; [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_NOTIFICATIONS", nil) - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"notifications") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"notifications") actionBlock:^{ [weakSelf showNotifications]; }]]; [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"LINKED_DEVICES_TITLE", @"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:^{ [weakSelf showLinkedDevices]; }]]; [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_ADVANCED_TITLE", @"") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"advanced") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"advanced") actionBlock:^{ [weakSelf showAdvanced]; }]]; @@ -204,20 +204,20 @@ if (showBackup) { [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_BACKUP", @"Label for the backup view in app settings.") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"backup") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"backup") actionBlock:^{ [weakSelf showBackup]; }]]; } [section addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_ABOUT", @"") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"about") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"about") actionBlock:^{ [weakSelf showAbout]; }]]; #ifdef USE_DEBUG_UI [section addItem:[OWSTableItem disclosureItemWithText:@"Debug UI" - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"debugui") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"debugui") actionBlock:^{ [weakSelf showDebugUI]; }]]; @@ -226,19 +226,20 @@ if (TSAccountManager.sharedInstance.isDeregistered) { [section addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_REREGISTER_BUTTON", @"Label for re-registration button.") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"reregister") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"reregister") selector:@selector(reregisterUser) color:[UIColor ows_materialBlueColor]]]; [section addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_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) color:[UIColor ows_destructiveRedColor]]]; } else { - [section addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_DELETE_ACCOUNT_BUTTON", @"") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"delete_account") - selector:@selector(unregisterUser) - color:[UIColor ows_destructiveRedColor]]]; + [section + addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_DELETE_ACCOUNT_BUTTON", @"") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"delete_account") + selector:@selector(unregisterUser) + color:[UIColor ows_destructiveRedColor]]]; } [contents addSection:section]; @@ -352,7 +353,7 @@ [disclosureButton setContentCompressionResistancePriority:(UILayoutPriorityDefaultHigh + 1) forAxis:UILayoutConstraintAxisHorizontal]; - cell.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"profile"); + cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"profile"); return cell; } @@ -490,7 +491,7 @@ target:self action:@selector(didPressEnableDarkTheme:)]; } - barButtonItem.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"dark_theme"); + barButtonItem.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dark_theme"); return barButtonItem; } diff --git a/Signal/src/ViewControllers/AppSettings/BlockListViewController.m b/Signal/src/ViewControllers/AppSettings/BlockListViewController.m index 549ca71cf..2a02ff318 100644 --- a/Signal/src/ViewControllers/AppSettings/BlockListViewController.m +++ b/Signal/src/ViewControllers/AppSettings/BlockListViewController.m @@ -74,7 +74,7 @@ NS_ASSUME_NONNULL_BEGIN addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_BLOCK_LIST_ADD_BUTTON", @"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:^{ AddToBlockListViewController *vc = [[AddToBlockListViewController alloc] init]; [weakSelf.navigationController pushViewController:vc animated:YES]; @@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN itemWithCustomCellBlock:^{ ContactTableViewCell *cell = [ContactTableViewCell new]; [cell configureWithRecipientId:phoneNumber]; - cell.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER( + cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME( BlockListViewController, @"user"); return cell; } diff --git a/Signal/src/ViewControllers/AppSettings/NotificationSettingsOptionsViewController.m b/Signal/src/ViewControllers/AppSettings/NotificationSettingsOptionsViewController.m index 02b099a94..280c7d48a 100644 --- a/Signal/src/ViewControllers/AppSettings/NotificationSettingsOptionsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/NotificationSettingsOptionsViewController.m @@ -41,7 +41,7 @@ cell.accessoryType = UITableViewCellAccessoryCheckmark; } cell.accessibilityIdentifier - = SUBVIEW_ACCESSIBILITY_IDENTIFIER(NotificationSettingsOptionsViewController, + = ACCESSIBILITY_IDENTIFIER_WITH_NAME(NotificationSettingsOptionsViewController, NSStringForNotificationType(notificationType)); return cell; } diff --git a/Signal/src/ViewControllers/AppSettings/NotificationSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/NotificationSettingsViewController.m index 5ac5722c7..42c6dc393 100644 --- a/Signal/src/ViewControllers/AppSettings/NotificationSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/NotificationSettingsViewController.m @@ -48,7 +48,7 @@ NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND", @"Label for settings view that allows user to change the notification sound.") detailText:[OWSSounds displayNameForSound:[OWSSounds globalNotificationSound]] - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"message_sound") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"message_sound") actionBlock:^{ OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new]; [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 " @"foreground."); [soundsSection addItem:[OWSTableItem switchItemWithText:inAppSoundsLabelText - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"in_app_sounds") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"in_app_sounds") isOnBlock:^{ return [prefs soundInForeground]; } @@ -75,7 +75,7 @@ addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"NOTIFICATIONS_SHOW", nil) detailText:[prefs nameForNotificationPreviewType:[prefs notificationPreviewType]] - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"options") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"options") actionBlock:^{ NotificationSettingsOptionsViewController *vc = [NotificationSettingsOptionsViewController new]; diff --git a/Signal/src/ViewControllers/AppSettings/OWSLinkedDevicesTableViewController.m b/Signal/src/ViewControllers/AppSettings/OWSLinkedDevicesTableViewController.m index 0e5adbfb7..d3285b495 100644 --- a/Signal/src/ViewControllers/AppSettings/OWSLinkedDevicesTableViewController.m +++ b/Signal/src/ViewControllers/AppSettings/OWSLinkedDevicesTableViewController.m @@ -329,7 +329,7 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1; cell.detailTextLabel.text = NSLocalizedString(@"LINK_NEW_DEVICE_SUBTITLE", @"Subheading for 'Link New Device' navigation"); cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; - cell.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(OWSLinkedDevicesTableViewController, @"add"); + cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(OWSLinkedDevicesTableViewController, @"add"); return cell; } else if (indexPath.section == OWSLinkedDevicesTableViewControllerSectionExistingDevices) { OWSDeviceTableViewCell *cell = diff --git a/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m index 0bc9ff00a..49c5649b2 100644 --- a/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/OWSSoundSettingsViewController.m @@ -51,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelWasPressed:) - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"cancel")]; + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"cancel")]; self.navigationItem.leftBarButtonItem = cancelItem; if (self.isDirty) { @@ -59,7 +59,7 @@ NS_ASSUME_NONNULL_BEGIN [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(saveWasPressed:) - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"save")]; + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"save")]; self.navigationItem.rightBarButtonItem = saveItem; } else { self.navigationItem.rightBarButtonItem = nil; @@ -97,14 +97,14 @@ NS_ASSUME_NONNULL_BEGIN if (sound == self.currentSound) { item = [OWSTableItem checkmarkItemWithText:soundLabelText - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, [OWSSounds displayNameForSound:sound]) + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, [OWSSounds displayNameForSound:sound]) actionBlock:^{ [weakSelf soundWasSelected:sound]; }]; } else { item = [OWSTableItem actionItemWithText:soundLabelText - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, [OWSSounds displayNameForSound:sound]) + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, [OWSSounds displayNameForSound:sound]) actionBlock:^{ [weakSelf soundWasSelected:sound]; }]; diff --git a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m index 4cfae0f2a..0004f12f3 100644 --- a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m +++ b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m @@ -425,7 +425,7 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s [UIAlertAction actionWithTitle: NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION_BUTTON", @"Confirmation text for button which deletes all message, calling, attachments, etc.") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"delete") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"delete") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *_Nonnull action) { [self deleteThreadsAndMessages]; diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index 48792175e..3806974b9 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -750,7 +750,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) { style:UIBarButtonItemStylePlain target:self action:@selector(settingsButtonPressed:) - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"settings")]; + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"settings")]; } settingsButton.accessibilityLabel = CommonStrings.openSettingsButton; self.navigationItem.leftBarButtonItem = settingsButton; @@ -760,7 +760,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) { [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(showNewConversationView) - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"compose")]; + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"compose")]; } - (void)settingsButtonPressed:(id)sender @@ -1108,7 +1108,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) { // TODO: Work with Nancy to confirm that this is accessible via Appium. NSString *cellName = [NSString stringWithFormat:@"conversation-%@", NSUUID.UUID.UUIDString]; - cell.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, cellName); + cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, cellName); return cell; } @@ -1153,7 +1153,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) { [stackView autoPinEdgeToSuperviewMargin:ALEdgeTop]; [stackView autoPinEdgeToSuperviewMargin:ALEdgeBottom]; - cell.accessibilityIdentifier = SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"archived_conversations"); + cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"archived_conversations"); return cell; } diff --git a/Signal/src/ViewControllers/NewContactThreadViewController.m b/Signal/src/ViewControllers/NewContactThreadViewController.m index ee9eb2228..e41d5530e 100644 --- a/Signal/src/ViewControllers/NewContactThreadViewController.m +++ b/Signal/src/ViewControllers/NewContactThreadViewController.m @@ -104,14 +104,17 @@ NS_ASSUME_NONNULL_BEGIN self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop 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. UIImage *newGroupImage = [UIImage imageNamed:@"btnGroup--white"]; OWSAssertDebug(newGroupImage); - UIBarButtonItem *newGroupButton = [[UIBarButtonItem alloc] initWithImage:newGroupImage - style:UIBarButtonItemStylePlain - target:self - action:@selector(showNewGroupView:)]; + UIBarButtonItem *newGroupButton = + [[UIBarButtonItem alloc] initWithImage:newGroupImage + style:UIBarButtonItemStylePlain + target:self + action:@selector(showNewGroupView:) + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"new_group")]; newGroupButton.accessibilityLabel = NSLocalizedString(@"CREATE_NEW_GROUP", @"Accessibility label for the create group new group button"); self.navigationItem.rightBarButtonItem = newGroupButton; @@ -122,6 +125,7 @@ NS_ASSUME_NONNULL_BEGIN searchBar.delegate = self; searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @""); [searchBar sizeToFit]; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, searchBar); _tableViewController = [OWSTableViewController new]; _tableViewController.delegate = self; @@ -149,6 +153,7 @@ NS_ASSUME_NONNULL_BEGIN [self.noSignalContactsView autoPinWidthToSuperview]; [self.noSignalContactsView autoPinEdgeToSuperviewEdge:ALEdgeTop]; [self.noSignalContactsView autoPinToBottomLayoutGuideOfViewController:self withInset:0]; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _noSignalContactsView); UIRefreshControl *pullToRefreshView = [UIRefreshControl new]; pullToRefreshView.tintColor = [UIColor grayColor]; @@ -156,6 +161,7 @@ NS_ASSUME_NONNULL_BEGIN action:@selector(pullToRefreshPerformed:) forControlEvents:UIControlEventValueChanged]; [self.tableViewController.tableView insertSubview:pullToRefreshView atIndex:0]; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, pullToRefreshView); [self updateTableContents]; @@ -254,6 +260,7 @@ NS_ASSUME_NONNULL_BEGIN action:@selector(presentInviteFlow) forControlEvents:UIControlEventTouchUpInside]; lastSubview = inviteContactsButton; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, inviteContactsButton); UIButton *searchByPhoneNumberButton = [UIButton buttonWithType:UIButtonTypeCustom]; [searchByPhoneNumberButton setTitle:NSLocalizedString(@"NO_CONTACTS_SEARCH_BY_PHONE_NUMBER", @@ -268,6 +275,7 @@ NS_ASSUME_NONNULL_BEGIN action:@selector(hideBackgroundView) forControlEvents:UIControlEventTouchUpInside]; lastSubview = searchByPhoneNumberButton; + SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, searchByPhoneNumberButton); [lastSubview autoPinEdgeToSuperviewMargin:ALEdgeBottom]; @@ -320,7 +328,7 @@ NS_ASSUME_NONNULL_BEGIN if (self.contactsManager.isSystemContactsDenied) { OWSTableItem *contactReminderItem = [OWSTableItem itemWithCustomCellBlock:^{ - UITableViewCell *newCell = [OWSTableItem newCell]; + UITableViewCell *cell = [OWSTableItem newCell]; ReminderView *reminderView = [ReminderView nagWithText:NSLocalizedString(@"COMPOSE_SCREEN_MISSING_CONTACTS_PERMISSION", @@ -328,10 +336,13 @@ NS_ASSUME_NONNULL_BEGIN tapAction:^{ [[UIApplication sharedApplication] openSystemSettings]; }]; - [newCell.contentView addSubview:reminderView]; + [cell.contentView addSubview:reminderView]; [reminderView autoPinEdgesToSuperviewEdges]; - return newCell; + cell.accessibilityIdentifier + = ACCESSIBILITY_IDENTIFIER_WITH_NAME(NewContactThreadViewController, @"missing_contacts"); + + return cell; } customRowHeight:UITableViewAutomaticDimension actionBlock:nil]; @@ -347,6 +358,8 @@ NS_ASSUME_NONNULL_BEGIN [staticSection addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"NEW_CONVERSATION_FIND_BY_PHONE_NUMBER", @"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 actionBlock:^{ NewNonContactConversationViewController *viewController = @@ -360,12 +373,14 @@ NS_ASSUME_NONNULL_BEGIN // Invite Contacts [staticSection addItem:[OWSTableItem - disclosureItemWithText:NSLocalizedString(@"INVITE_FRIENDS_CONTACT_TABLE_BUTTON", - @"Label for the cell that presents the 'invite contacts' workflow.") - customRowHeight:UITableViewAutomaticDimension - actionBlock:^{ - [weakSelf presentInviteFlow]; - }]]; + disclosureItemWithText:NSLocalizedString(@"INVITE_FRIENDS_CONTACT_TABLE_BUTTON", + @"Label for the cell that presents the 'invite contacts' workflow.") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME( + NewContactThreadViewController, @"invite_contacts") + customRowHeight:UITableViewAutomaticDimension + actionBlock:^{ + [weakSelf presentInviteFlow]; + }]]; } [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 loadingCell.backgroundView = [UIView new]; + loadingCell.accessibilityIdentifier + = ACCESSIBILITY_IDENTIFIER_WITH_NAME(NewContactThreadViewController, @"loading"); + OWSTableItem *loadingItem = [OWSTableItem itemWithCustomCell:loadingCell customRowHeight:40 actionBlock:nil]; [contactsSection addItem:loadingItem]; @@ -495,6 +513,11 @@ NS_ASSUME_NONNULL_BEGIN [cell configureWithRecipientId:signalAccount.recipientId]; + NSString *cellName = [NSString + stringWithFormat:@"signal_contact.%@", signalAccount.recipientId]; + cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME( + NewContactThreadViewController, cellName); + return cell; } customRowHeight:UITableViewAutomaticDimension @@ -541,6 +564,11 @@ NS_ASSUME_NONNULL_BEGIN @"CONTACT_CELL_IS_BLOCKED", @"An indicator that a contact has been blocked."); } [cell configureWithRecipientId:phoneNumber]; + + NSString *cellName = [NSString stringWithFormat:@"non_signal_contact.%@", phoneNumber]; + cell.accessibilityIdentifier + = ACCESSIBILITY_IDENTIFIER_WITH_NAME(NewContactThreadViewController, cellName); + return cell; } customRowHeight:UITableViewAutomaticDimension @@ -552,11 +580,13 @@ NS_ASSUME_NONNULL_BEGIN @"Text for button to send a Signal invite via SMS. %@ is " @"placeholder for the recipient's phone number."), phoneNumber]; - [phoneNumbersSection addItem:[OWSTableItem disclosureItemWithText:text - customRowHeight:UITableViewAutomaticDimension - actionBlock:^{ - [weakSelf sendTextToPhoneNumber:phoneNumber]; - }]]; + [phoneNumbersSection + addItem:[OWSTableItem disclosureItemWithText:text + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"invite_via_sms") + customRowHeight:UITableViewAutomaticDimension + actionBlock:^{ + [weakSelf sendTextToPhoneNumber:phoneNumber]; + }]]; } } if (searchPhoneNumbers.count > 0) { @@ -590,6 +620,11 @@ NS_ASSUME_NONNULL_BEGIN [cell configureWithRecipientId:signalAccount.recipientId]; + NSString *cellName = + [NSString stringWithFormat:@"signal_contact.%@", signalAccount.recipientId]; + cell.accessibilityIdentifier + = ACCESSIBILITY_IDENTIFIER_WITH_NAME(NewContactThreadViewController, cellName); + return cell; } customRowHeight:UITableViewAutomaticDimension @@ -613,6 +648,13 @@ NS_ASSUME_NONNULL_BEGIN itemWithCustomCellBlock:^{ GroupTableViewCell *cell = [GroupTableViewCell new]; [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; } customRowHeight:UITableViewAutomaticDimension @@ -644,7 +686,9 @@ NS_ASSUME_NONNULL_BEGIN @"Text for button to send a Signal invite via SMS. %@ is " @"placeholder for the recipient's phone number."), displayName]; + NSString *accessibilityIdentifier = [NSString stringWithFormat:@"invite_via_sms.%@", phoneNumber.toE164]; [inviteeSection addItem:[OWSTableItem disclosureItemWithText:text + accessibilityIdentifier:accessibilityIdentifier customRowHeight:UITableViewAutomaticDimension actionBlock:^{ [weakSelf sendTextToPhoneNumber:phoneNumber.toE164]; @@ -738,7 +782,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)sendTextToPhoneNumber:(NSString *)phoneNumber { - OWSInviteFlow *inviteFlow = [[OWSInviteFlow alloc] initWithPresentingViewController:self]; OWSAssertDebug([phoneNumber length] > 0); @@ -753,16 +796,18 @@ NS_ASSUME_NONNULL_BEGIN preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *okAction = [UIAlertAction - actionWithTitle:NSLocalizedString(@"OK", @"") - style:UIAlertActionStyleDefault - handler:^(UIAlertAction *action) { - [self.searchBar resignFirstResponder]; - if ([MFMessageComposeViewController canSendText]) { - [inviteFlow sendSMSToPhoneNumbers:@[ phoneNumber ]]; - } else { - [OWSAlerts showErrorAlertWithMessage:NSLocalizedString(@"UNSUPPORTED_FEATURE_ERROR", @"")]; - } - }]; + actionWithTitle:NSLocalizedString(@"OK", @"") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"ok") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction *action) { + [self.searchBar resignFirstResponder]; + if ([MFMessageComposeViewController canSendText]) { + [inviteFlow sendSMSToPhoneNumbers:@[ phoneNumber ]]; + } else { + [OWSAlerts + showErrorAlertWithMessage:NSLocalizedString(@"UNSUPPORTED_FEATURE_ERROR", @"")]; + } + }]; [alert addAction:[OWSAlerts cancelAction]]; [alert addAction:okAction]; diff --git a/Signal/src/ViewControllers/OWS2FASettingsViewController.m b/Signal/src/ViewControllers/OWS2FASettingsViewController.m index af284f2ec..fae3c0e25 100644 --- a/Signal/src/ViewControllers/OWS2FASettingsViewController.m +++ b/Signal/src/ViewControllers/OWS2FASettingsViewController.m @@ -224,19 +224,19 @@ NS_ASSUME_NONNULL_BEGIN addItem:[OWSTableItem disclosureItemWithText: NSLocalizedString(@"ENABLE_2FA_VIEW_DISABLE_2FA", @"Label for the 'enable two-factor auth' item in the settings view") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"enable_2fa") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"enable_2fa") actionBlock:^{ [weakSelf tryToDisable2FA]; }]]; } else { - [section - addItem:[OWSTableItem disclosureItemWithText: - NSLocalizedString(@"ENABLE_2FA_VIEW_ENABLE_2FA", - @"Label for the 'enable two-factor auth' item in the settings view") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"disable_2fa") - actionBlock:^{ - [weakSelf showEnable2FAWorkUI]; - }]]; + [section addItem:[OWSTableItem + disclosureItemWithText: + NSLocalizedString(@"ENABLE_2FA_VIEW_ENABLE_2FA", + @"Label for the 'enable two-factor auth' item in the settings view") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"disable_2fa") + actionBlock:^{ + [weakSelf showEnable2FAWorkUI]; + }]]; } [contents addSection:section]; self.tableViewController.contents = contents; @@ -269,7 +269,7 @@ NS_ASSUME_NONNULL_BEGIN style:UIBarButtonItemStylePlain target:self action:@selector(backButtonWasPressed) - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"back")]; + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"back")]; self.navigationItem.backBarButtonItem = backButton; if (self.shouldHaveNextButton) { @@ -279,7 +279,7 @@ NS_ASSUME_NONNULL_BEGIN style:UIBarButtonItemStylePlain target:self action:@selector(nextButtonWasPressed) - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"next")]; + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"next")]; self.navigationItem.rightBarButtonItem = nextButton; } else { self.navigationItem.rightBarButtonItem = nil; diff --git a/Signal/src/ViewControllers/ProfileViewController.m b/Signal/src/ViewControllers/ProfileViewController.m index e562fcdce..a7599556a 100644 --- a/Signal/src/ViewControllers/ProfileViewController.m +++ b/Signal/src/ViewControllers/ProfileViewController.m @@ -112,7 +112,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat nameRow.userInteractionEnabled = YES; [nameRow 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]; UILabel *nameLabel = [UILabel new]; @@ -152,7 +152,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat avatarRow.userInteractionEnabled = YES; [avatarRow 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]; UILabel *avatarLabel = [UILabel new]; @@ -165,7 +165,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat [avatarLabel autoVCenterInSuperview]; 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"]; self.cameraImageView = [[UIImageView alloc] initWithImage:cameraImage]; @@ -189,7 +189,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat infoRow.userInteractionEnabled = YES; [infoRow 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]; UILabel *infoLabel = [UILabel new]; @@ -308,7 +308,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat UIAlertAction *discardAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"ALERT_DISCARD_BUTTON", @"The label for the 'discard' button in alerts and action sheets.") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"discard") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"discard") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { [weakSelf profileCompletedOrSkipped]; diff --git a/Signal/src/util/Pastelog.m b/Signal/src/util/Pastelog.m index 00329126d..c2077534c 100644 --- a/Signal/src/util/Pastelog.m +++ b/Signal/src/util/Pastelog.m @@ -323,7 +323,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_EMAIL", @"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 handler:^(UIAlertAction *action) { [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", @"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 handler:^(UIAlertAction *action) { UIPasteboard *pb = [UIPasteboard generalPasteboard]; @@ -344,7 +344,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_SEND_TO_SELF", @"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 handler:^(UIAlertAction *action) { [Pastelog.sharedManager sendToSelf:url]; @@ -352,7 +352,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error [alert addAction:[UIAlertAction actionWithTitle: NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_SEND_TO_LAST_THREAD", @"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 handler:^(UIAlertAction *action) { [Pastelog.sharedManager sendToMostRecentThread:url]; @@ -362,14 +362,14 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_BUG_REPORT", @"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 handler:^(UIAlertAction *action) { [Pastelog.sharedManager prepareRedirection:url completion:completion]; }]]; [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_SHARE", @"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 handler:^(UIAlertAction *action) { [AttachmentSharing showShareUIForText:url.absoluteString @@ -515,7 +515,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error message:message preferredStyle:UIAlertControllerStyleAlert]; [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"ok") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"ok") style:UIAlertActionStyleDefault handler:nil]]; UIViewController *presentingViewController = UIApplication.sharedApplication.frontmostViewControllerIgnoringAlerts; @@ -573,7 +573,7 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"ok") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"ok") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { [UIApplication.sharedApplication diff --git a/SignalMessaging/ViewControllers/OWSTableViewController.h b/SignalMessaging/ViewControllers/OWSTableViewController.h index 53942225c..0e22fd5bb 100644 --- a/SignalMessaging/ViewControllers/OWSTableViewController.h +++ b/SignalMessaging/ViewControllers/OWSTableViewController.h @@ -89,6 +89,11 @@ typedef BOOL (^OWSTableSwitchBlock)(void); customRowHeight:(CGFloat)customRowHeight 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 diff --git a/SignalMessaging/ViewControllers/OWSTableViewController.m b/SignalMessaging/ViewControllers/OWSTableViewController.m index 921d7c563..5a4303c9a 100644 --- a/SignalMessaging/ViewControllers/OWSTableViewController.m +++ b/SignalMessaging/ViewControllers/OWSTableViewController.m @@ -225,10 +225,22 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f; + (OWSTableItem *)disclosureItemWithText:(NSString *)text customRowHeight:(CGFloat)customRowHeight 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); - OWSTableItem *item = [self disclosureItemWithText:text actionBlock:actionBlock]; + OWSTableItem *item = + [self disclosureItemWithText:text accessibilityIdentifier:accessibilityIdentifier actionBlock:actionBlock]; item.customRowHeight = @(customRowHeight); return item; } diff --git a/SignalMessaging/utils/BlockListUIUtils.m b/SignalMessaging/utils/BlockListUIUtils.m index bb114cbab..8541fac45 100644 --- a/SignalMessaging/utils/BlockListUIUtils.m +++ b/SignalMessaging/utils/BlockListUIUtils.m @@ -118,7 +118,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action); UIAlertAction *blockAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", @"Button label for the 'block' button") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"block") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"block") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *_Nonnull action) { [self blockPhoneNumbers:phoneNumbers @@ -134,7 +134,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action); [actionSheet addAction:blockAction]; UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"dismiss") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dismiss") style:UIAlertActionStyleCancel handler:^(UIAlertAction *_Nonnull action) { if (completionBlock) { @@ -169,7 +169,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action); UIAlertAction *blockAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_BLOCK_BUTTON", @"Button label for the 'block' button") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"block") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"block") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *_Nonnull action) { [self blockGroup:groupThread @@ -185,7 +185,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action); [actionSheet addAction:blockAction]; UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"dismiss") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dismiss") style:UIAlertActionStyleCancel handler:^(UIAlertAction *_Nonnull action) { if (completionBlock) { @@ -336,7 +336,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action); UIAlertAction *unblockAction = [UIAlertAction actionWithTitle:NSLocalizedString( @"BLOCK_LIST_UNBLOCK_BUTTON", @"Button label for the 'unblock' button") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"unblock") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"unblock") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *_Nonnull action) { [BlockListUIUtils unblockPhoneNumbers:phoneNumbers @@ -352,7 +352,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action); [actionSheet addAction:unblockAction]; UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"dismiss") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dismiss") style:UIAlertActionStyleCancel handler:^(UIAlertAction *_Nonnull action) { if (completionBlock) { @@ -409,7 +409,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action); UIAlertAction *unblockAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_LIST_UNBLOCK_BUTTON", @"Button label for the 'unblock' button") - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"unblock") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"unblock") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *_Nonnull action) { [BlockListUIUtils unblockGroup:groupModel @@ -425,7 +425,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action); [actionSheet addAction:unblockAction]; UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"dismiss") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"dismiss") style:UIAlertActionStyleCancel handler:^(UIAlertAction *_Nonnull action) { if (completionBlock) { @@ -474,7 +474,7 @@ typedef void (^BlockAlertCompletionBlock)(UIAlertAction *action); [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) - accessibilityIdentifier:SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, @"ok") + accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"ok") style:UIAlertActionStyleDefault handler:completionBlock]; [alert addAction:okAction]; diff --git a/SignalMessaging/utils/UIUtil.h b/SignalMessaging/utils/UIUtil.h index 715c4be62..f5f17972e 100644 --- a/SignalMessaging/utils/UIUtil.h +++ b/SignalMessaging/utils/UIUtil.h @@ -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" @@ -7,10 +7,10 @@ #import #import -#define SUBVIEW_ACCESSIBILITY_IDENTIFIER(_root_view, _variable_name) \ -([NSString stringWithFormat:@"%@.%@", _root_view.class, _variable_name]) +#define ACCESSIBILITY_IDENTIFIER_WITH_NAME(_root_view, _variable_name) \ + ([NSString stringWithFormat:@"%@.%@", _root_view.class, _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);