Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios into vasavk/carousel
This commit is contained in:
commit
7a9910e830
@ -51,6 +51,14 @@ extension InputField {
|
||||
}
|
||||
}
|
||||
|
||||
public var accessibilityLabel: String {
|
||||
switch self {
|
||||
case .generic, .placeholder: return "credit card"
|
||||
default: return rawValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func separatorIndices(_ length: Int) -> [Int] {
|
||||
var indices: [Int] = [4, 8, 12]
|
||||
switch self {
|
||||
@ -135,7 +143,7 @@ extension InputField {
|
||||
fileprivate func updateLeftImage(_ inputField: InputField) {
|
||||
let imageName = inputField.cardType.imageName(surface: inputField.surface)
|
||||
creditCardImageView.image = BundleManager.shared.image(for: imageName)
|
||||
creditCardImageView.accessibilityLabel = inputField.cardType.rawValue
|
||||
creditCardImageView.accessibilityLabel = inputField.cardType.accessibilityLabel
|
||||
}
|
||||
|
||||
override func updateView(_ inputField: InputField) {
|
||||
|
||||
@ -414,7 +414,7 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
||||
/// Used to update any Accessibility properties.
|
||||
open override var accessibilityElements: [Any]? {
|
||||
get {
|
||||
var views = [UIView]()
|
||||
var views = [AnyObject]()
|
||||
|
||||
// grab the available views in order
|
||||
if badgeModel != nil {
|
||||
@ -422,9 +422,9 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
||||
}
|
||||
|
||||
if titleModel != nil || subTitleModel != nil || eyebrowModel != nil {
|
||||
views.append(titleLockup)
|
||||
let titleLockupViews = gatherAccessibilityElements(from: titleLockup)
|
||||
views.append(contentsOf: titleLockupViews)
|
||||
}
|
||||
|
||||
containerView.setAccessibilityLabel(for: views)
|
||||
|
||||
// get the views to return
|
||||
|
||||
@ -14,14 +14,14 @@ extension UIView {
|
||||
/// - views: Array of Views that you want to join the accessibilityLabel.
|
||||
/// - separator: Separator used between the accessibilityLabel for each UIView.
|
||||
/// - Returns: Joined String.
|
||||
public func combineAccessibilityLabel(for views: [UIView], separator: String = ", ") -> String? {
|
||||
let labels = views.map({($0.accessibilityLabel?.isEmpty ?? true) ? nil : $0.accessibilityLabel}).compactMap({$0})
|
||||
public func combineAccessibilityLabel(for views: [AnyObject], separator: String = ", ") -> String? {
|
||||
let labels: [String] = views.map({($0.accessibilityLabel?.isEmpty ?? true) ? nil : $0.accessibilityLabel}).compactMap({$0})
|
||||
return labels.joined(separator: separator)
|
||||
}
|
||||
|
||||
/// AccessibilityLabel helper for joining the accessibilityLabel property of all views passed in.
|
||||
/// - Parameter views: Array of Views that you want to join the accessibilityLabel.
|
||||
public func setAccessibilityLabel(for views: [UIView]) {
|
||||
public func setAccessibilityLabel(for views: [AnyObject]) {
|
||||
accessibilityLabel = combineAccessibilityLabel(for: views)
|
||||
}
|
||||
|
||||
@ -50,8 +50,8 @@ extension UIView {
|
||||
return isIntersecting
|
||||
}
|
||||
|
||||
public func gatherAccessibilityElements(from view: UIView) -> [Any] {
|
||||
var elements: [Any] = []
|
||||
public func gatherAccessibilityElements(from view: AnyObject) -> [AnyObject] {
|
||||
var elements: [AnyObject] = []
|
||||
|
||||
for subview in view.subviews {
|
||||
if subview.isAccessibilityElement && subview.isVisibleOnScreen {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user