From 931d24967762a51cfb72149c40dfbb735ba13b56 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 19 Mar 2019 15:43:35 -0400 Subject: [PATCH] Modify OWSFlatButton to propagate the accessibility identifier to wrapper button. --- .../ViewControllers/SelectRecipientViewController.m | 2 -- SignalMessaging/Views/OWSFlatButton.swift | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/SignalMessaging/ViewControllers/SelectRecipientViewController.m b/SignalMessaging/ViewControllers/SelectRecipientViewController.m index e13e05764..208cfc849 100644 --- a/SignalMessaging/ViewControllers/SelectRecipientViewController.m +++ b/SignalMessaging/ViewControllers/SelectRecipientViewController.m @@ -507,8 +507,6 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien UIView *buttonRow = [strongSelf createRowWithHeight:kButtonRowHeight previousRow:examplePhoneNumberRow superview:cell.contentView]; - OWSLogVerbose(@"strongSelf.phoneNumberButton: %@", strongSelf.phoneNumberButton.accessibilityIdentifier); - OWSLogFlush(); [buttonRow addSubview:strongSelf.phoneNumberButton]; [strongSelf.phoneNumberButton autoVCenterInSuperview]; [strongSelf.phoneNumberButton autoPinTrailingToSuperviewMargin]; diff --git a/SignalMessaging/Views/OWSFlatButton.swift b/SignalMessaging/Views/OWSFlatButton.swift index 134ccdef9..5e4358f46 100644 --- a/SignalMessaging/Views/OWSFlatButton.swift +++ b/SignalMessaging/Views/OWSFlatButton.swift @@ -15,6 +15,16 @@ public class OWSFlatButton: UIView { private var upColor: UIColor? private var downColor: UIColor? + @objc + public override var accessibilityIdentifier: String? { + didSet { + guard let accessibilityIdentifier = self.accessibilityIdentifier else { + return + } + button.accessibilityIdentifier = "\(accessibilityIdentifier).button" + } + } + override public var backgroundColor: UIColor? { willSet { owsFailDebug("Use setBackgroundColors(upColor:) instead.")