Modify OWSFlatButton to propagate the accessibility identifier to wrapper button.

pull/2/head
Matthew Chen 6 years ago
parent 41a3c95831
commit 931d249677

@ -507,8 +507,6 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
UIView *buttonRow = [strongSelf createRowWithHeight:kButtonRowHeight UIView *buttonRow = [strongSelf createRowWithHeight:kButtonRowHeight
previousRow:examplePhoneNumberRow previousRow:examplePhoneNumberRow
superview:cell.contentView]; superview:cell.contentView];
OWSLogVerbose(@"strongSelf.phoneNumberButton: %@", strongSelf.phoneNumberButton.accessibilityIdentifier);
OWSLogFlush();
[buttonRow addSubview:strongSelf.phoneNumberButton]; [buttonRow addSubview:strongSelf.phoneNumberButton];
[strongSelf.phoneNumberButton autoVCenterInSuperview]; [strongSelf.phoneNumberButton autoVCenterInSuperview];
[strongSelf.phoneNumberButton autoPinTrailingToSuperviewMargin]; [strongSelf.phoneNumberButton autoPinTrailingToSuperviewMargin];

@ -15,6 +15,16 @@ public class OWSFlatButton: UIView {
private var upColor: UIColor? private var upColor: UIColor?
private var downColor: 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? { override public var backgroundColor: UIColor? {
willSet { willSet {
owsFailDebug("Use setBackgroundColors(upColor:) instead.") owsFailDebug("Use setBackgroundColors(upColor:) instead.")

Loading…
Cancel
Save