Member label VoiceOver support
This commit is contained in:
parent
3601bb4930
commit
f741f6fc16
@ -426,6 +426,10 @@ struct CVItemModelBuilder: CVItemBuilding {
|
||||
memberLabel = memberLabel?
|
||||
.components(separatedBy: .whitespaces)
|
||||
.joined(separator: SignalSymbol.LeadingCharacter.nonBreakingSpace.rawValue)
|
||||
|
||||
if let memberLabel {
|
||||
itemViewState.accessibilityAuthorName = authorName + "," + memberLabel
|
||||
}
|
||||
}
|
||||
|
||||
if shouldShowSenderName {
|
||||
|
||||
@ -532,6 +532,10 @@ struct ConversationHeaderBuilder {
|
||||
memberLabelLabel.numberOfLines = 0
|
||||
memberLabelLabel.highlightRange = NSRange(location: 0, length: (label as NSString).length)
|
||||
memberLabelLabel.highlightFont = .dynamicTypeSubheadlineClamped
|
||||
memberLabelLabel.axLabelPrefix = OWSLocalizedString(
|
||||
"MEMBER_LABEL_AX_PREFIX",
|
||||
comment: "Accessibility prefix for member labels.",
|
||||
)
|
||||
|
||||
subviews.append(memberLabelLabel)
|
||||
hasSubtitleLabel = true
|
||||
|
||||
@ -4996,6 +4996,9 @@
|
||||
/* Label for an action to add a member label */
|
||||
"MEMBER_LABEL_ADD" = "Add a Member Label";
|
||||
|
||||
/* Accessibility prefix for member labels. */
|
||||
"MEMBER_LABEL_AX_PREFIX" = "Member label: ";
|
||||
|
||||
/* Heading shown above the preview of a message bubble with the edited member label. */
|
||||
"MEMBER_LABEL_PREVIEW_HEADING" = "Preview";
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ import SignalServiceKit
|
||||
public class CVCapsuleLabel: UILabel {
|
||||
public var highlightRange: NSRange?
|
||||
public var highlightFont: UIFont?
|
||||
public var axLabelPrefix: String?
|
||||
|
||||
private static let horizontalInset: CGFloat = 6
|
||||
private static let verticalInset: CGFloat = 1
|
||||
@ -94,4 +95,14 @@ public class CVCapsuleLabel: UILabel {
|
||||
height: size.height + Self.verticalInset * 2,
|
||||
)
|
||||
}
|
||||
|
||||
override public var accessibilityLabel: String? {
|
||||
get {
|
||||
if let axLabelPrefix, let text = self.text {
|
||||
return axLabelPrefix + text
|
||||
}
|
||||
return super.accessibilityLabel
|
||||
}
|
||||
set { super.accessibilityLabel = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,6 +240,10 @@ public class ContactCellView: ManualStackView {
|
||||
memberLabelLabel.numberOfLines = 0
|
||||
memberLabelLabel.highlightRange = NSRange(location: 0, length: (memberLabel.label as NSString).length)
|
||||
memberLabelLabel.highlightFont = .dynamicTypeCaption1Clamped
|
||||
memberLabelLabel.axLabelPrefix = OWSLocalizedString(
|
||||
"MEMBER_LABEL_AX_PREFIX",
|
||||
comment: "Accessibility prefix for member labels.",
|
||||
)
|
||||
|
||||
textStackSubviews.append(memberLabelLabel)
|
||||
let memberLabelSize = memberLabelLabel.highlightLabelSize()
|
||||
|
||||
@ -765,6 +765,14 @@ open class InteractiveSheetViewController: OWSViewController {
|
||||
isInInteractiveTransition = false
|
||||
panningScrollView?.showsVerticalScrollIndicator = true
|
||||
}
|
||||
|
||||
override public func accessibilityPerformEscape() -> Bool {
|
||||
if presentingViewController != nil {
|
||||
dismiss(animated: true)
|
||||
return true
|
||||
}
|
||||
return super.accessibilityPerformEscape()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
||||
@ -182,7 +182,7 @@ public extension ProfileDetailLabel {
|
||||
},
|
||||
)
|
||||
}
|
||||
return ProfileDetailLabel(
|
||||
let detailLabelView = ProfileDetailLabel(
|
||||
title: label,
|
||||
icon: .memberLabel,
|
||||
font: .dynamicTypeBody,
|
||||
@ -191,6 +191,13 @@ public extension ProfileDetailLabel {
|
||||
tapAction()
|
||||
},
|
||||
)
|
||||
detailLabelView.isAccessibilityElement = true
|
||||
detailLabelView.accessibilityLabel = OWSLocalizedString(
|
||||
"MEMBER_LABEL_AX_PREFIX",
|
||||
comment: "Accessibility prefix for member labels.",
|
||||
) + label
|
||||
|
||||
return detailLabelView
|
||||
}
|
||||
|
||||
static func verified(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user