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

@ -340,7 +340,6 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
[self.view addSubview:self.emptyInboxView];
[self.emptyInboxView autoPinWidthToSuperviewMargins];
[self.emptyInboxView autoVCenterInSuperview];
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _emptyInboxView);
[self createFirstConversationCueView];
[self.view addSubview:self.firstConversationCueView];
@ -361,6 +360,13 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
action:@selector(pullToRefreshPerformed:)
forControlEvents:UIControlEventValueChanged];
[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

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

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

@ -17,6 +17,7 @@ public class OnboardingCaptchaViewController: OnboardingBaseViewController {
view.layoutMargins = .zero
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: [
titleLabel
@ -43,6 +44,7 @@ public class OnboardingCaptchaViewController: OnboardingBaseViewController {
webView.allowsLinkPreview = false
webView.scrollView.contentInset = .zero
webView.layoutMargins = .zero
webView.accessibilityIdentifier = "onboarding.captcha." + "webView"
let stackView = UIStackView(arrangedSubviews: [
titleRow,

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

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

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

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

@ -277,11 +277,13 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
let titleLabel = self.titleLabel(text: "")
self.titleLabel = titleLabel
titleLabel.accessibilityIdentifier = "onboarding.verification." + "titleLabel"
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."),
selector: #selector(backLinkTapped))
self.backLink = backLink
backLink.accessibilityIdentifier = "onboarding.verification." + "backLink"
onboardingCodeView.delegate = self
@ -291,6 +293,7 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
errorLabel.font = UIFont.ows_dynamicTypeBodyClamped.ows_mediumWeight()
errorLabel.textAlignment = .center
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.
let errorRow = UIView()
@ -301,6 +304,7 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
selector: #selector(resendCodeLinkTapped))
codeStateLink.enableMultilineLabel()
self.codeStateLink = codeStateLink
codeStateLink.accessibilityIdentifier = "onboarding.verification." + "codeStateLink"
let topSpacer = 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
accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier
actionBlock:(nullable OWSTableActionBlock)actionBlock;
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text
detailText:(NSString *)detailText
actionBlock:(nullable OWSTableActionBlock)actionBlock;
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text
detailText:(NSString *)detailText
accessibilityIdentifier:(nullable NSString *)accessibilityIdentifier
actionBlock:(nullable OWSTableActionBlock)actionBlock;
+ (OWSTableItem *)disclosureItemWithText:(NSString *)text
@ -115,6 +124,13 @@ typedef BOOL (^OWSTableSwitchBlock)(void);
target:(id)target
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;
- (NSNumber *)customRowHeight;

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

@ -64,6 +64,11 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
if (self.delegate.shouldHideContacts) {
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

Loading…
Cancel
Save