Merge branch 'charlesmchen/accessibilityIdentifiers'

pull/2/head
Matthew Chen 6 years ago
commit 07cb44c9ef

@ -88,6 +88,7 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
[blocklistSection [blocklistSection
addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_BLOCK_LIST_TITLE", addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_BLOCK_LIST_TITLE",
@"Label for the block list section of the settings view") @"Label for the block list section of the settings view")
accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"blocklist"]
actionBlock:^{ actionBlock:^{
[weakSelf showBlocklist]; [weakSelf showBlocklist];
}]]; }]];
@ -101,11 +102,15 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
[readReceiptsSection [readReceiptsSection
addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_READ_RECEIPT", addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_READ_RECEIPT",
@"Label for the 'read receipts' setting.") @"Label for the 'read receipts' setting.")
isOnBlock:^{ accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"read_receipts"]
return [OWSReadReceiptManager.sharedManager areReadReceiptsEnabled]; isOnBlock:^{
} return [OWSReadReceiptManager.sharedManager areReadReceiptsEnabled];
target:weakSelf }
selector:@selector(didToggleReadReceiptsSwitch:)]]; isEnabledBlock:^{
return YES;
}
target:weakSelf
selector:@selector(didToggleReadReceiptsSwitch:)]];
[contents addSection:readReceiptsSection]; [contents addSection:readReceiptsSection];
OWSTableSection *typingIndicatorsSection = [OWSTableSection new]; OWSTableSection *typingIndicatorsSection = [OWSTableSection new];
@ -116,11 +121,15 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
[typingIndicatorsSection [typingIndicatorsSection
addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_TYPING_INDICATORS", addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_TYPING_INDICATORS",
@"Label for the 'typing indicators' setting.") @"Label for the 'typing indicators' setting.")
isOnBlock:^{ accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"typing_indicators"]
return [SSKEnvironment.shared.typingIndicators areTypingIndicatorsEnabled]; isOnBlock:^{
} return [SSKEnvironment.shared.typingIndicators areTypingIndicatorsEnabled];
target:weakSelf }
selector:@selector(didToggleTypingIndicatorsSwitch:)]]; isEnabledBlock:^{
return YES;
}
target:weakSelf
selector:@selector(didToggleTypingIndicatorsSwitch:)]];
[contents addSection:typingIndicatorsSection]; [contents addSection:typingIndicatorsSection];
OWSTableSection *screenLockSection = [OWSTableSection new]; OWSTableSection *screenLockSection = [OWSTableSection new];
@ -132,11 +141,15 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
addItem:[OWSTableItem addItem:[OWSTableItem
switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_LOCK_SWITCH_LABEL", switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_LOCK_SWITCH_LABEL",
@"Label for the 'enable screen lock' switch of the privacy settings.") @"Label for the 'enable screen lock' switch of the privacy settings.")
isOnBlock:^{ accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"screenlock"]
return [OWSScreenLock.sharedManager isScreenLockEnabled]; isOnBlock:^{
} return [OWSScreenLock.sharedManager isScreenLockEnabled];
target:self }
selector:@selector(isScreenLockEnabledDidChange:)]]; isEnabledBlock:^{
return YES;
}
target:self
selector:@selector(isScreenLockEnabledDidChange:)]];
[contents addSection:screenLockSection]; [contents addSection:screenLockSection];
if (OWSScreenLock.sharedManager.isScreenLockEnabled) { if (OWSScreenLock.sharedManager.isScreenLockEnabled) {
@ -145,13 +158,15 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
NSString *screenLockTimeoutString = [self formatScreenLockTimeout:screenLockTimeout useShortFormat:YES]; NSString *screenLockTimeoutString = [self formatScreenLockTimeout:screenLockTimeout useShortFormat:YES];
[screenLockTimeoutSection [screenLockTimeoutSection
addItem:[OWSTableItem addItem:[OWSTableItem
disclosureItemWithText: disclosureItemWithText:
NSLocalizedString(@"SETTINGS_SCREEN_LOCK_ACTIVITY_TIMEOUT", NSLocalizedString(@"SETTINGS_SCREEN_LOCK_ACTIVITY_TIMEOUT",
@"Label for the 'screen lock activity timeout' setting of the privacy settings.") @"Label for the 'screen lock activity timeout' setting of the privacy settings.")
detailText:screenLockTimeoutString detailText:screenLockTimeoutString
actionBlock:^{ accessibilityIdentifier:[NSString
[weakSelf showScreenLockTimeoutUI]; stringWithFormat:@"settings.privacy.%@", @"screen_lock_timeout"]
}]]; actionBlock:^{
[weakSelf showScreenLockTimeoutUI];
}]];
[contents addSection:screenLockTimeoutSection]; [contents addSection:screenLockTimeoutSection];
} }
@ -160,11 +175,15 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
screenSecuritySection.footerTitle = NSLocalizedString(@"SETTINGS_SCREEN_SECURITY_DETAIL", nil); screenSecuritySection.footerTitle = NSLocalizedString(@"SETTINGS_SCREEN_SECURITY_DETAIL", nil);
[screenSecuritySection [screenSecuritySection
addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"") addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"")
isOnBlock:^{ accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"screen_security"]
return [Environment.shared.preferences screenSecurityIsEnabled]; isOnBlock:^{
} return [Environment.shared.preferences screenSecurityIsEnabled];
target:weakSelf }
selector:@selector(didToggleScreenSecuritySwitch:)]]; isEnabledBlock:^{
return YES;
}
target:weakSelf
selector:@selector(didToggleScreenSecuritySwitch:)]];
[contents addSection:screenSecuritySection]; [contents addSection:screenSecuritySection];
// Allow calls to connect directly vs. using TURN exclusively // Allow calls to connect directly vs. using TURN exclusively
@ -176,11 +195,16 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
[callingSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString( [callingSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(
@"SETTINGS_CALLING_HIDES_IP_ADDRESS_PREFERENCE_TITLE", @"SETTINGS_CALLING_HIDES_IP_ADDRESS_PREFERENCE_TITLE",
@"Table cell label") @"Table cell label")
isOnBlock:^{ accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@",
return [Environment.shared.preferences doCallsHideIPAddress]; @"calling_hide_ip_address"]
} isOnBlock:^{
target:weakSelf return [Environment.shared.preferences doCallsHideIPAddress];
selector:@selector(didToggleCallsHideIPAddressSwitch:)]]; }
isEnabledBlock:^{
return YES;
}
target:weakSelf
selector:@selector(didToggleCallsHideIPAddressSwitch:)]];
[contents addSection:callingSection]; [contents addSection:callingSection];
if (@available(iOS 11, *)) { if (@available(iOS 11, *)) {
@ -189,11 +213,15 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
addItem:[OWSTableItem switchItemWithText:NSLocalizedString( addItem:[OWSTableItem switchItemWithText:NSLocalizedString(
@"SETTINGS_PRIVACY_CALLKIT_SYSTEM_CALL_LOG_PREFERENCE_TITLE", @"SETTINGS_PRIVACY_CALLKIT_SYSTEM_CALL_LOG_PREFERENCE_TITLE",
@"Short table cell label") @"Short table cell label")
isOnBlock:^{ accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"callkit_history"]
return [Environment.shared.preferences isSystemCallLogEnabled]; isOnBlock:^{
} return [Environment.shared.preferences isSystemCallLogEnabled];
target:weakSelf }
selector:@selector(didToggleEnableSystemCallLogSwitch:)]]; isEnabledBlock:^{
return YES;
}
target:weakSelf
selector:@selector(didToggleEnableSystemCallLogSwitch:)]];
callKitSection.footerTitle = NSLocalizedString( callKitSection.footerTitle = NSLocalizedString(
@"SETTINGS_PRIVACY_CALLKIT_SYSTEM_CALL_LOG_PREFERENCE_DESCRIPTION", @"Settings table section footer."); @"SETTINGS_PRIVACY_CALLKIT_SYSTEM_CALL_LOG_PREFERENCE_DESCRIPTION", @"Settings table section footer.");
[contents addSection:callKitSection]; [contents addSection:callKitSection];
@ -201,23 +229,32 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
OWSTableSection *callKitSection = [OWSTableSection new]; OWSTableSection *callKitSection = [OWSTableSection new];
callKitSection.footerTitle callKitSection.footerTitle
= NSLocalizedString(@"SETTINGS_SECTION_CALL_KIT_DESCRIPTION", @"Settings table section footer."); = NSLocalizedString(@"SETTINGS_SECTION_CALL_KIT_DESCRIPTION", @"Settings table section footer.");
[callKitSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_CALLKIT_TITLE", [callKitSection
@"Short table cell label") addItem:[OWSTableItem switchItemWithText:NSLocalizedString(
isOnBlock:^{ @"SETTINGS_PRIVACY_CALLKIT_TITLE", @"Short table cell label")
return [Environment.shared.preferences isCallKitEnabled]; accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"callkit"]
} isOnBlock:^{
target:weakSelf return [Environment.shared.preferences isCallKitEnabled];
selector:@selector(didToggleEnableCallKitSwitch:)]]; }
isEnabledBlock:^{
return YES;
}
target:weakSelf
selector:@selector(didToggleEnableCallKitSwitch:)]];
if (self.preferences.isCallKitEnabled) { if (self.preferences.isCallKitEnabled) {
[callKitSection [callKitSection
addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_CALLKIT_PRIVACY_TITLE", addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_CALLKIT_PRIVACY_TITLE",
@"Label for 'CallKit privacy' preference") @"Label for 'CallKit privacy' preference")
isOnBlock:^{ accessibilityIdentifier:[NSString
return (BOOL) ! stringWithFormat:@"settings.privacy.%@", @"callkit_privacy"]
[Environment.shared.preferences isCallKitPrivacyEnabled]; isOnBlock:^{
} return (BOOL) ![Environment.shared.preferences isCallKitPrivacyEnabled];
target:weakSelf }
selector:@selector(didToggleEnableCallKitPrivacySwitch:)]]; isEnabledBlock:^{
return YES;
}
target:weakSelf
selector:@selector(didToggleEnableCallKitPrivacySwitch:)]];
} }
[contents addSection:callKitSection]; [contents addSection:callKitSection];
} }
@ -236,17 +273,20 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
@"Indicates that 'two factor auth' is enabled in the privacy settings.") @"Indicates that 'two factor auth' is enabled in the privacy settings.")
: NSLocalizedString(@"SETTINGS_TWO_FACTOR_AUTH_DISABLED", : NSLocalizedString(@"SETTINGS_TWO_FACTOR_AUTH_DISABLED",
@"Indicates that 'two factor auth' is disabled in the privacy settings.")) @"Indicates that 'two factor auth' is disabled in the privacy settings."))
actionBlock:^{ accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"2fa"]
[weakSelf show2FASettings]; actionBlock:^{
}]]; [weakSelf show2FASettings];
}]];
[contents addSection:twoFactorAuthSection]; [contents addSection:twoFactorAuthSection];
OWSTableSection *historyLogsSection = [OWSTableSection new]; OWSTableSection *historyLogsSection = [OWSTableSection new];
historyLogsSection.headerTitle = NSLocalizedString(@"SETTINGS_HISTORYLOG_TITLE", @"Section header"); historyLogsSection.headerTitle = NSLocalizedString(@"SETTINGS_HISTORYLOG_TITLE", @"Section header");
[historyLogsSection addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_CLEAR_HISTORY", @"") [historyLogsSection
actionBlock:^{ addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_CLEAR_HISTORY", @"")
[weakSelf clearHistoryLogs]; accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"clear_logs"]
}]]; actionBlock:^{
[weakSelf clearHistoryLogs];
}]];
[contents addSection:historyLogsSection]; [contents addSection:historyLogsSection];
OWSTableSection *unidentifiedDeliveryIndicatorsSection = [OWSTableSection new]; OWSTableSection *unidentifiedDeliveryIndicatorsSection = [OWSTableSection new];
@ -285,6 +325,8 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
action:@selector(didToggleUDShowIndicatorsSwitch:) action:@selector(didToggleUDShowIndicatorsSwitch:)
forControlEvents:UIControlEventValueChanged]; forControlEvents:UIControlEventValueChanged];
[cellSwitch setContentHuggingHorizontalHigh]; [cellSwitch setContentHuggingHorizontalHigh];
cellSwitch.accessibilityIdentifier =
[NSString stringWithFormat:@"settings.privacy.%@", @"sealed_sender"];
UIStackView *stackView = UIStackView *stackView =
[[UIStackView alloc] initWithArrangedSubviews:@[ label, iconView, spacer, cellSwitch ]]; [[UIStackView alloc] initWithArrangedSubviews:@[ label, iconView, spacer, cellSwitch ]];
@ -310,11 +352,15 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
OWSTableSection *unidentifiedDeliveryUnrestrictedSection = [OWSTableSection new]; OWSTableSection *unidentifiedDeliveryUnrestrictedSection = [OWSTableSection new];
OWSTableItem *unrestrictedAccessItem = [OWSTableItem OWSTableItem *unrestrictedAccessItem = [OWSTableItem
switchItemWithText:NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_UNRESTRICTED_ACCESS", @"switch label") switchItemWithText:NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_UNRESTRICTED_ACCESS", @"switch label")
isOnBlock:^{ accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"sealed_sender_unrestricted"]
return [SSKEnvironment.shared.udManager shouldAllowUnrestrictedAccessLocal]; isOnBlock:^{
} return [SSKEnvironment.shared.udManager shouldAllowUnrestrictedAccessLocal];
target:weakSelf }
selector:@selector(didToggleUDUnrestrictedAccessSwitch:)]; isEnabledBlock:^{
return YES;
}
target:weakSelf
selector:@selector(didToggleUDUnrestrictedAccessSwitch:)];
[unidentifiedDeliveryUnrestrictedSection addItem:unrestrictedAccessItem]; [unidentifiedDeliveryUnrestrictedSection addItem:unrestrictedAccessItem];
unidentifiedDeliveryUnrestrictedSection.footerTitle unidentifiedDeliveryUnrestrictedSection.footerTitle
= NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_UNRESTRICTED_ACCESS_FOOTER", @"table section footer"); = NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_UNRESTRICTED_ACCESS_FOOTER", @"table section footer");
@ -324,6 +370,8 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
[unidentifiedDeliveryLearnMoreSection [unidentifiedDeliveryLearnMoreSection
addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_LEARN_MORE", addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_LEARN_MORE",
@"Label for a link to more info about unidentified delivery.") @"Label for a link to more info about unidentified delivery.")
accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@",
@"sealed_sender_learn_more"]
actionBlock:^{ actionBlock:^{
NSURL *url = [NSURL URLWithString:kSealedSenderInfoURL]; NSURL *url = [NSURL URLWithString:kSealedSenderInfoURL];
OWSAssertDebug(url); OWSAssertDebug(url);
@ -335,11 +383,15 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
[linkPreviewsSection [linkPreviewsSection
addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_LINK_PREVIEWS", addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_LINK_PREVIEWS",
@"Setting for enabling & disabling link previews.") @"Setting for enabling & disabling link previews.")
isOnBlock:^{ accessibilityIdentifier:[NSString stringWithFormat:@"settings.privacy.%@", @"link_previews"]
return [SSKPreferences areLinkPreviewsEnabled]; isOnBlock:^{
} return [SSKPreferences areLinkPreviewsEnabled];
target:weakSelf }
selector:@selector(didToggleLinkPreviewsEnabled:)]]; isEnabledBlock:^{
return YES;
}
target:weakSelf
selector:@selector(didToggleLinkPreviewsEnabled:)]];
linkPreviewsSection.headerTitle = NSLocalizedString( linkPreviewsSection.headerTitle = NSLocalizedString(
@"SETTINGS_LINK_PREVIEWS_HEADER", @"Header for setting for enabling & disabling link previews."); @"SETTINGS_LINK_PREVIEWS_HEADER", @"Header for setting for enabling & disabling link previews.");
linkPreviewsSection.footerTitle = NSLocalizedString( linkPreviewsSection.footerTitle = NSLocalizedString(

@ -340,7 +340,6 @@ 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];
@ -361,6 +360,13 @@ 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, _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

@ -15,10 +15,10 @@
#import <SignalCoreKit/NSDate+OWS.h> #import <SignalCoreKit/NSDate+OWS.h>
#import <SignalMessaging/OWSNavigationController.h> #import <SignalMessaging/OWSNavigationController.h>
#import <SignalMessaging/OWSProfileManager.h> #import <SignalMessaging/OWSProfileManager.h>
#import <SignalMessaging/UIUtil.h>
#import <SignalMessaging/UIViewController+OWS.h> #import <SignalMessaging/UIViewController+OWS.h>
#import <SignalServiceKit/NSString+SSK.h> #import <SignalServiceKit/NSString+SSK.h>
#import <SignalServiceKit/OWSPrimaryStorage.h> #import <SignalServiceKit/OWSPrimaryStorage.h>
#import <SignalMessaging/UIUtil.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN

@ -32,6 +32,8 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
comment: "The first explanation in the 'onboarding 2FA' view.")) comment: "The first explanation in the 'onboarding 2FA' view."))
explanationLabel1.font = UIFont.ows_dynamicTypeCaption1 explanationLabel1.font = UIFont.ows_dynamicTypeCaption1
explanationLabel2.font = UIFont.ows_dynamicTypeCaption1 explanationLabel2.font = UIFont.ows_dynamicTypeCaption1
explanationLabel1.accessibilityIdentifier = "onboarding.2fa." + "explanationLabel1"
explanationLabel2.accessibilityIdentifier = "onboarding.2fa." + "explanationLabel2"
pinTextField.textAlignment = .center pinTextField.textAlignment = .center
pinTextField.delegate = self pinTextField.delegate = self
@ -41,6 +43,7 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
pinTextField.setContentHuggingHorizontalLow() pinTextField.setContentHuggingHorizontalLow()
pinTextField.setCompressionResistanceHorizontalLow() pinTextField.setCompressionResistanceHorizontalLow()
pinTextField.autoSetDimension(.height, toSize: 40) pinTextField.autoSetDimension(.height, toSize: 40)
pinTextField.accessibilityIdentifier = "onboarding.2fa." + "pinTextField"
pinStrokeNormal = pinTextField.addBottomStroke() pinStrokeNormal = pinTextField.addBottomStroke()
pinStrokeError = pinTextField.addBottomStroke(color: .ows_destructiveRed, strokeWidth: 2) pinStrokeError = pinTextField.addBottomStroke(color: .ows_destructiveRed, strokeWidth: 2)
@ -50,6 +53,7 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
validationWarningLabel.textColor = .ows_destructiveRed validationWarningLabel.textColor = .ows_destructiveRed
validationWarningLabel.font = UIFont.ows_dynamicTypeSubheadlineClamped validationWarningLabel.font = UIFont.ows_dynamicTypeSubheadlineClamped
validationWarningLabel.textAlignment = .center validationWarningLabel.textAlignment = .center
validationWarningLabel.accessibilityIdentifier = "onboarding.2fa." + "validationWarningLabel"
let validationWarningRow = UIView() let validationWarningRow = UIView()
validationWarningRow.addSubview(validationWarningLabel) validationWarningRow.addSubview(validationWarningLabel)
@ -59,10 +63,12 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
let forgotPinLink = self.linkButton(title: NSLocalizedString("ONBOARDING_2FA_FORGOT_PIN_LINK", let forgotPinLink = self.linkButton(title: NSLocalizedString("ONBOARDING_2FA_FORGOT_PIN_LINK",
comment: "Label for the 'forgot 2FA PIN' link in the 'onboarding 2FA' view."), comment: "Label for the 'forgot 2FA PIN' link in the 'onboarding 2FA' view."),
selector: #selector(forgotPinLinkTapped)) selector: #selector(forgotPinLinkTapped))
forgotPinLink.accessibilityIdentifier = "onboarding.2fa." + "forgotPinLink"
let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT", let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT",
comment: "Label for the 'next' button."), comment: "Label for the 'next' button."),
selector: #selector(nextPressed)) selector: #selector(nextPressed))
nextButton.accessibilityIdentifier = "onboarding.2fa." + "nextButton"
let topSpacer = UIView.vStretchingSpacer() let topSpacer = UIView.vStretchingSpacer()
let bottomSpacer = UIView.vStretchingSpacer() let bottomSpacer = UIView.vStretchingSpacer()

@ -17,6 +17,7 @@ public class OnboardingCaptchaViewController: OnboardingBaseViewController {
view.layoutMargins = .zero view.layoutMargins = .zero
let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_CAPTCHA_TITLE", comment: "Title of the 'onboarding Captcha' view.")) let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_CAPTCHA_TITLE", comment: "Title of the 'onboarding Captcha' view."))
titleLabel.accessibilityIdentifier = "onboarding.captcha." + "titleLabel"
let titleRow = UIStackView(arrangedSubviews: [ let titleRow = UIStackView(arrangedSubviews: [
titleLabel titleLabel
@ -43,6 +44,7 @@ public class OnboardingCaptchaViewController: OnboardingBaseViewController {
webView.allowsLinkPreview = false webView.allowsLinkPreview = false
webView.scrollView.contentInset = .zero webView.scrollView.contentInset = .zero
webView.layoutMargins = .zero webView.layoutMargins = .zero
webView.accessibilityIdentifier = "onboarding.captcha." + "webView"
let stackView = UIStackView(arrangedSubviews: [ let stackView = UIStackView(arrangedSubviews: [
titleRow, titleRow,

@ -20,17 +20,21 @@ public class OnboardingPermissionsViewController: OnboardingBaseViewController {
action: #selector(skipWasPressed)) action: #selector(skipWasPressed))
let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_PERMISSIONS_TITLE", comment: "Title of the 'onboarding permissions' view.")) let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_PERMISSIONS_TITLE", comment: "Title of the 'onboarding permissions' view."))
titleLabel.accessibilityIdentifier = "onboarding.permissions." + "titleLabel"
let explanationLabel = self.explanationLabel(explanationText: NSLocalizedString("ONBOARDING_PERMISSIONS_EXPLANATION", let explanationLabel = self.explanationLabel(explanationText: NSLocalizedString("ONBOARDING_PERMISSIONS_EXPLANATION",
comment: "Explanation in the 'onboarding permissions' view.")) comment: "Explanation in the 'onboarding permissions' view."))
explanationLabel.accessibilityIdentifier = "onboarding.permissions." + "explanationLabel"
let giveAccessButton = self.button(title: NSLocalizedString("ONBOARDING_PERMISSIONS_ENABLE_PERMISSIONS_BUTTON", let giveAccessButton = self.button(title: NSLocalizedString("ONBOARDING_PERMISSIONS_ENABLE_PERMISSIONS_BUTTON",
comment: "Label for the 'give access' button in the 'onboarding permissions' view."), comment: "Label for the 'give access' button in the 'onboarding permissions' view."),
selector: #selector(giveAccessPressed)) selector: #selector(giveAccessPressed))
giveAccessButton.accessibilityIdentifier = "onboarding.permissions." + "giveAccessButton"
let notNowButton = self.linkButton(title: NSLocalizedString("ONBOARDING_PERMISSIONS_NOT_NOW_BUTTON", let notNowButton = self.linkButton(title: NSLocalizedString("ONBOARDING_PERMISSIONS_NOT_NOW_BUTTON",
comment: "Label for the 'not now' button in the 'onboarding permissions' view."), comment: "Label for the 'not now' button in the 'onboarding permissions' view."),
selector: #selector(notNowPressed)) selector: #selector(notNowPressed))
notNowButton.accessibilityIdentifier = "onboarding.permissions." + "notNowButton"
let stackView = UIStackView(arrangedSubviews: [ let stackView = UIStackView(arrangedSubviews: [
titleLabel, titleLabel,

@ -34,6 +34,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
view.layoutMargins = .zero view.layoutMargins = .zero
let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_PHONE_NUMBER_TITLE", comment: "Title of the 'onboarding phone number' view.")) let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_PHONE_NUMBER_TITLE", comment: "Title of the 'onboarding phone number' view."))
titleLabel.accessibilityIdentifier = "onboarding.phoneNumber." + "titleLabel"
// Country // Country
@ -43,6 +44,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
countryNameLabel.font = UIFont.ows_dynamicTypeBodyClamped countryNameLabel.font = UIFont.ows_dynamicTypeBodyClamped
countryNameLabel.setContentHuggingHorizontalLow() countryNameLabel.setContentHuggingHorizontalLow()
countryNameLabel.setCompressionResistanceHorizontalLow() countryNameLabel.setCompressionResistanceHorizontalLow()
countryNameLabel.accessibilityIdentifier = "onboarding.phoneNumber." + "countryNameLabel"
let countryIcon = UIImage(named: (CurrentAppContext().isRTL let countryIcon = UIImage(named: (CurrentAppContext().isRTL
? "small_chevron_left" ? "small_chevron_left"
@ -51,6 +53,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
countryImageView.tintColor = Theme.placeholderColor countryImageView.tintColor = Theme.placeholderColor
countryImageView.setContentHuggingHigh() countryImageView.setContentHuggingHigh()
countryImageView.setCompressionResistanceHigh() countryImageView.setCompressionResistanceHigh()
countryImageView.accessibilityIdentifier = "onboarding.phoneNumber." + "countryImageView"
let countryRow = UIStackView(arrangedSubviews: [ let countryRow = UIStackView(arrangedSubviews: [
countryNameLabel, countryNameLabel,
@ -63,6 +66,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
countryRow.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(countryRowTapped))) countryRow.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(countryRowTapped)))
countryRow.autoSetDimension(.height, toSize: rowHeight) countryRow.autoSetDimension(.height, toSize: rowHeight)
_ = countryRow.addBottomStroke() _ = countryRow.addBottomStroke()
countryRow.accessibilityIdentifier = "onboarding.phoneNumber." + "countryRow"
callingCodeLabel.textColor = Theme.primaryColor callingCodeLabel.textColor = Theme.primaryColor
callingCodeLabel.font = UIFont.ows_dynamicTypeBodyClamped callingCodeLabel.font = UIFont.ows_dynamicTypeBodyClamped
@ -72,6 +76,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
callingCodeLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(countryCodeTapped))) callingCodeLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(countryCodeTapped)))
_ = callingCodeLabel.addBottomStroke() _ = callingCodeLabel.addBottomStroke()
callingCodeLabel.autoSetDimension(.width, toSize: rowHeight, relation: .greaterThanOrEqual) callingCodeLabel.autoSetDimension(.width, toSize: rowHeight, relation: .greaterThanOrEqual)
callingCodeLabel.accessibilityIdentifier = "onboarding.phoneNumber." + "callingCodeLabel"
phoneNumberTextField.textAlignment = .left phoneNumberTextField.textAlignment = .left
phoneNumberTextField.delegate = self phoneNumberTextField.delegate = self
@ -80,6 +85,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
phoneNumberTextField.font = UIFont.ows_dynamicTypeBodyClamped phoneNumberTextField.font = UIFont.ows_dynamicTypeBodyClamped
phoneNumberTextField.setContentHuggingHorizontalLow() phoneNumberTextField.setContentHuggingHorizontalLow()
phoneNumberTextField.setCompressionResistanceHorizontalLow() phoneNumberTextField.setCompressionResistanceHorizontalLow()
phoneNumberTextField.accessibilityIdentifier = "onboarding.phoneNumber." + "phoneNumberTextField"
phoneStrokeNormal = phoneNumberTextField.addBottomStroke() phoneStrokeNormal = phoneNumberTextField.addBottomStroke()
phoneStrokeError = phoneNumberTextField.addBottomStroke(color: .ows_destructiveRed, strokeWidth: 2) phoneStrokeError = phoneNumberTextField.addBottomStroke(color: .ows_destructiveRed, strokeWidth: 2)
@ -99,6 +105,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
validationWarningLabel.textColor = .ows_destructiveRed validationWarningLabel.textColor = .ows_destructiveRed
validationWarningLabel.font = UIFont.ows_dynamicTypeSubheadlineClamped validationWarningLabel.font = UIFont.ows_dynamicTypeSubheadlineClamped
validationWarningLabel.autoSetDimension(.height, toSize: validationWarningLabel.font.lineHeight) validationWarningLabel.autoSetDimension(.height, toSize: validationWarningLabel.font.lineHeight)
validationWarningLabel.accessibilityIdentifier = "onboarding.phoneNumber." + "validationWarningLabel"
let validationWarningRow = UIView() let validationWarningRow = UIView()
validationWarningRow.addSubview(validationWarningLabel) validationWarningRow.addSubview(validationWarningLabel)
@ -108,6 +115,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT", let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT",
comment: "Label for the 'next' button."), comment: "Label for the 'next' button."),
selector: #selector(nextPressed)) selector: #selector(nextPressed))
nextButton.accessibilityIdentifier = "onboarding.phoneNumber." + "nextButton"
self.nextButton = nextButton self.nextButton = nextButton
let topSpacer = UIView.vStretchingSpacer() let topSpacer = UIView.vStretchingSpacer()
let bottomSpacer = UIView.vStretchingSpacer() let bottomSpacer = UIView.vStretchingSpacer()

@ -31,13 +31,16 @@ public class OnboardingProfileViewController: OnboardingBaseViewController {
view.layoutMargins = .zero view.layoutMargins = .zero
let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_PROFILE_TITLE", comment: "Title of the 'onboarding profile' view.")) let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_PROFILE_TITLE", comment: "Title of the 'onboarding profile' view."))
titleLabel.accessibilityIdentifier = "onboarding.profile." + "titleLabel"
let explanationLabel = self.explanationLabel(explanationText: NSLocalizedString("ONBOARDING_PROFILE_EXPLANATION", let explanationLabel = self.explanationLabel(explanationText: NSLocalizedString("ONBOARDING_PROFILE_EXPLANATION",
comment: "Explanation in the 'onboarding profile' view.")) comment: "Explanation in the 'onboarding profile' view."))
explanationLabel.accessibilityIdentifier = "onboarding.profile." + "explanationLabel"
let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT", let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT",
comment: "Label for the 'next' button."), comment: "Label for the 'next' button."),
selector: #selector(nextPressed)) selector: #selector(nextPressed))
nextButton.accessibilityIdentifier = "onboarding.profile." + "nextButton"
avatarView.autoSetDimensions(to: CGSize(width: CGFloat(avatarSize), height: CGFloat(avatarSize))) avatarView.autoSetDimensions(to: CGSize(width: CGFloat(avatarSize), height: CGFloat(avatarSize)))
@ -64,6 +67,7 @@ public class OnboardingProfileViewController: OnboardingBaseViewController {
avatarWrapper.addSubview(cameraCircle) avatarWrapper.addSubview(cameraCircle)
cameraCircle.autoPinEdge(toSuperviewEdge: .trailing) cameraCircle.autoPinEdge(toSuperviewEdge: .trailing)
cameraCircle.autoPinEdge(toSuperviewEdge: .bottom) cameraCircle.autoPinEdge(toSuperviewEdge: .bottom)
avatarWrapper.accessibilityIdentifier = "onboarding.profile." + "avatarWrapper"
nameTextfield.textAlignment = .left nameTextfield.textAlignment = .left
nameTextfield.delegate = self nameTextfield.delegate = self
@ -74,6 +78,7 @@ public class OnboardingProfileViewController: OnboardingBaseViewController {
comment: "Placeholder text for the profile name in the 'onboarding profile' view.") comment: "Placeholder text for the profile name in the 'onboarding profile' view.")
nameTextfield.setContentHuggingHorizontalLow() nameTextfield.setContentHuggingHorizontalLow()
nameTextfield.setCompressionResistanceHorizontalLow() nameTextfield.setCompressionResistanceHorizontalLow()
nameTextfield.accessibilityIdentifier = "onboarding.profile." + "nameTextfield"
let nameWrapper = UIView.container() let nameWrapper = UIView.container()
nameWrapper.setCompressionResistanceHorizontalLow() nameWrapper.setCompressionResistanceHorizontalLow()

@ -21,10 +21,12 @@ public class OnboardingSplashViewController: OnboardingBaseViewController {
heroImageView.layer.magnificationFilter = kCAFilterTrilinear heroImageView.layer.magnificationFilter = kCAFilterTrilinear
heroImageView.setCompressionResistanceLow() heroImageView.setCompressionResistanceLow()
heroImageView.setContentHuggingVerticalLow() heroImageView.setContentHuggingVerticalLow()
heroImageView.accessibilityIdentifier = "onboarding.splash." + "heroImageView"
let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_SPLASH_TITLE", comment: "Title of the 'onboarding splash' view.")) let titleLabel = self.titleLabel(text: NSLocalizedString("ONBOARDING_SPLASH_TITLE", comment: "Title of the 'onboarding splash' view."))
view.addSubview(titleLabel) view.addSubview(titleLabel)
titleLabel.autoPinEdges(toSuperviewMarginsExcludingEdge: .bottom) titleLabel.autoPinEdges(toSuperviewMarginsExcludingEdge: .bottom)
titleLabel.accessibilityIdentifier = "onboarding.splash." + "titleLabel"
let explanationLabel = UILabel() let explanationLabel = UILabel()
explanationLabel.text = NSLocalizedString("ONBOARDING_SPLASH_TERM_AND_PRIVACY_POLICY", explanationLabel.text = NSLocalizedString("ONBOARDING_SPLASH_TERM_AND_PRIVACY_POLICY",
@ -36,11 +38,13 @@ public class OnboardingSplashViewController: OnboardingBaseViewController {
explanationLabel.lineBreakMode = .byWordWrapping explanationLabel.lineBreakMode = .byWordWrapping
explanationLabel.isUserInteractionEnabled = true explanationLabel.isUserInteractionEnabled = true
explanationLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(explanationLabelTapped))) explanationLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(explanationLabelTapped)))
explanationLabel.accessibilityIdentifier = "onboarding.splash." + "explanationLabel"
let continueButton = self.button(title: NSLocalizedString("BUTTON_CONTINUE", let continueButton = self.button(title: NSLocalizedString("BUTTON_CONTINUE",
comment: "Label for 'continue' button."), comment: "Label for 'continue' button."),
selector: #selector(continuePressed)) selector: #selector(continuePressed))
view.addSubview(continueButton) view.addSubview(continueButton)
continueButton.accessibilityIdentifier = "onboarding.splash." + "continueButton"
let stackView = UIStackView(arrangedSubviews: [ let stackView = UIStackView(arrangedSubviews: [
heroImageView, heroImageView,

@ -277,11 +277,13 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
let titleLabel = self.titleLabel(text: "") let titleLabel = self.titleLabel(text: "")
self.titleLabel = titleLabel self.titleLabel = titleLabel
titleLabel.accessibilityIdentifier = "onboarding.verification." + "titleLabel"
let backLink = self.linkButton(title: NSLocalizedString("ONBOARDING_VERIFICATION_BACK_LINK", let backLink = self.linkButton(title: NSLocalizedString("ONBOARDING_VERIFICATION_BACK_LINK",
comment: "Label for the link that lets users change their phone number in the onboarding views."), comment: "Label for the link that lets users change their phone number in the onboarding views."),
selector: #selector(backLinkTapped)) selector: #selector(backLinkTapped))
self.backLink = backLink self.backLink = backLink
backLink.accessibilityIdentifier = "onboarding.verification." + "backLink"
onboardingCodeView.delegate = self onboardingCodeView.delegate = self
@ -291,6 +293,7 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
errorLabel.font = UIFont.ows_dynamicTypeBodyClamped.ows_mediumWeight() errorLabel.font = UIFont.ows_dynamicTypeBodyClamped.ows_mediumWeight()
errorLabel.textAlignment = .center errorLabel.textAlignment = .center
errorLabel.autoSetDimension(.height, toSize: errorLabel.font.lineHeight) errorLabel.autoSetDimension(.height, toSize: errorLabel.font.lineHeight)
errorLabel.accessibilityIdentifier = "onboarding.verification." + "errorLabel"
// Wrap the error label in a row so that we can show/hide it without affecting view layout. // Wrap the error label in a row so that we can show/hide it without affecting view layout.
let errorRow = UIView() let errorRow = UIView()
@ -301,6 +304,7 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
selector: #selector(resendCodeLinkTapped)) selector: #selector(resendCodeLinkTapped))
codeStateLink.enableMultilineLabel() codeStateLink.enableMultilineLabel()
self.codeStateLink = codeStateLink self.codeStateLink = codeStateLink
codeStateLink.accessibilityIdentifier = "onboarding.verification." + "codeStateLink"
let topSpacer = UIView.vStretchingSpacer() let topSpacer = UIView.vStretchingSpacer()
let bottomSpacer = UIView.vStretchingSpacer() let bottomSpacer = UIView.vStretchingSpacer()

@ -72,8 +72,17 @@ typedef BOOL (^OWSTableSwitchBlock)(void);
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock; + (OWSTableItem *)disclosureItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock;
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text
accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier
actionBlock:(nullable OWSTableActionBlock)actionBlock;
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text
detailText:(NSString *)detailText
actionBlock:(nullable OWSTableActionBlock)actionBlock;
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text + (OWSTableItem *)disclosureItemWithText:(NSString *)text
detailText:(NSString *)detailText detailText:(NSString *)detailText
accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier
actionBlock:(nullable OWSTableActionBlock)actionBlock; actionBlock:(nullable OWSTableActionBlock)actionBlock;
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text + (OWSTableItem *)disclosureItemWithText:(NSString *)text
@ -115,6 +124,13 @@ typedef BOOL (^OWSTableSwitchBlock)(void);
target:(id)target target:(id)target
selector:(SEL)selector; selector:(SEL)selector;
+ (OWSTableItem *)switchItemWithText:(NSString *)text
accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier
isOnBlock:(OWSTableSwitchBlock)isOnBlock
isEnabledBlock:(OWSTableSwitchBlock)isEnabledBlock
target:(id)target
selector:(SEL)selector;
- (nullable UITableViewCell *)customCell; - (nullable UITableViewCell *)customCell;
- (NSNumber *)customRowHeight; - (NSNumber *)customRowHeight;

@ -170,6 +170,16 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
return [self itemWithText:text actionBlock:actionBlock accessoryType:UITableViewCellAccessoryDisclosureIndicator]; return [self itemWithText:text actionBlock:actionBlock accessoryType:UITableViewCellAccessoryDisclosureIndicator];
} }
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text
accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier
actionBlock:(nullable OWSTableActionBlock)actionBlock
{
return [self itemWithText:text
accessibilityIdentifier:accessibilityIdentifier
actionBlock:actionBlock
accessoryType:UITableViewCellAccessoryDisclosureIndicator];
}
+ (OWSTableItem *)checkmarkItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock + (OWSTableItem *)checkmarkItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock
{ {
return [self itemWithText:text actionBlock:actionBlock accessoryType:UITableViewCellAccessoryCheckmark]; return [self itemWithText:text actionBlock:actionBlock accessoryType:UITableViewCellAccessoryCheckmark];
@ -178,6 +188,14 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
+ (OWSTableItem *)itemWithText:(NSString *)text + (OWSTableItem *)itemWithText:(NSString *)text
actionBlock:(nullable OWSTableActionBlock)actionBlock actionBlock:(nullable OWSTableActionBlock)actionBlock
accessoryType:(UITableViewCellAccessoryType)accessoryType accessoryType:(UITableViewCellAccessoryType)accessoryType
{
return [self itemWithText:text accessibilityIdentifier:nil actionBlock:actionBlock accessoryType:accessoryType];
}
+ (OWSTableItem *)itemWithText:(NSString *)text
accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier
actionBlock:(nullable OWSTableActionBlock)actionBlock
accessoryType:(UITableViewCellAccessoryType)accessoryType
{ {
OWSAssertDebug(text.length > 0); OWSAssertDebug(text.length > 0);
OWSAssertDebug(actionBlock); OWSAssertDebug(actionBlock);
@ -188,6 +206,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
UITableViewCell *cell = [OWSTableItem newCell]; UITableViewCell *cell = [OWSTableItem newCell];
cell.textLabel.text = text; cell.textLabel.text = text;
cell.accessoryType = accessoryType; cell.accessoryType = accessoryType;
cell.accessibilityIdentifier = accessibilityIdentifier;
return cell; return cell;
}; };
return item; return item;
@ -207,6 +226,14 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text + (OWSTableItem *)disclosureItemWithText:(NSString *)text
detailText:(NSString *)detailText detailText:(NSString *)detailText
actionBlock:(nullable OWSTableActionBlock)actionBlock actionBlock:(nullable OWSTableActionBlock)actionBlock
{
return [self disclosureItemWithText:text detailText:detailText accessibilityIdentifier:nil actionBlock:actionBlock];
}
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text
detailText:(NSString *)detailText
accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier
actionBlock:(nullable OWSTableActionBlock)actionBlock
{ {
OWSAssertDebug(text.length > 0); OWSAssertDebug(text.length > 0);
OWSAssertDebug(actionBlock); OWSAssertDebug(actionBlock);
@ -220,6 +247,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
cell.textLabel.text = text; cell.textLabel.text = text;
cell.detailTextLabel.text = detailText; cell.detailTextLabel.text = detailText;
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator]; [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
cell.accessibilityIdentifier = accessibilityIdentifier;
return cell; return cell;
}; };
return item; return item;
@ -385,6 +413,21 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
isEnabledBlock:(OWSTableSwitchBlock)isEnabledBlock isEnabledBlock:(OWSTableSwitchBlock)isEnabledBlock
target:(id)target target:(id)target
selector:(SEL)selector selector:(SEL)selector
{
return [self switchItemWithText:text
accessibilityIdentifier:nil
isOnBlock:isOnBlock
isEnabledBlock:isEnabledBlock
target:target
selector:selector];
}
+ (OWSTableItem *)switchItemWithText:(NSString *)text
accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier
isOnBlock:(OWSTableSwitchBlock)isOnBlock
isEnabledBlock:(OWSTableSwitchBlock)isEnabledBlock
target:(id)target
selector:(SEL)selector
{ {
OWSAssertDebug(text.length > 0); OWSAssertDebug(text.length > 0);
OWSAssertDebug(target); OWSAssertDebug(target);
@ -401,6 +444,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
[cellSwitch setOn:isOnBlock()]; [cellSwitch setOn:isOnBlock()];
[cellSwitch addTarget:weakTarget action:selector forControlEvents:UIControlEventValueChanged]; [cellSwitch addTarget:weakTarget action:selector forControlEvents:UIControlEventValueChanged];
cellSwitch.enabled = isEnabledBlock(); cellSwitch.enabled = isEnabledBlock();
cellSwitch.accessibilityIdentifier = accessibilityIdentifier;
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;

@ -64,6 +64,11 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
if (self.delegate.shouldHideContacts) { if (self.delegate.shouldHideContacts) {
self.tableViewController.tableView.scrollEnabled = NO; self.tableViewController.tableView.scrollEnabled = NO;
} }
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _countryCodeButton);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _phoneNumberTextField);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _phoneNumberButton);
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _examplePhoneNumberLabel);
} }
- (void)viewDidLoad - (void)viewDidLoad

Loading…
Cancel
Save