21804(iOS - List - Right Variable - Right Caret - All Text & Links) initial commit.

This commit is contained in:
Lekshmi S 2020-07-24 18:09:05 +05:30
parent f9ce6e9f0f
commit 5be8057fdb
5 changed files with 167 additions and 1 deletions

View File

@ -213,6 +213,8 @@
AA26850E244840C300CE34CC /* HeadersH2TinyButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA26850D244840C300CE34CC /* HeadersH2TinyButtonModel.swift */; };
AA2AD116244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */; };
AA2AD118244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */; };
AA3561AC24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift */; };
AA3561AE24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift */; };
AA45AA0B24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA45AA0A24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift */; };
AA45AA0D24BF0276007A6EA7 /* LockUpsPlanNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA45AA0C24BF0276007A6EA7 /* LockUpsPlanNames.swift */; };
AA56A20F243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA56A20E243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift */; };
@ -684,6 +686,8 @@
AA26850D244840C300CE34CC /* HeadersH2TinyButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2TinyButtonModel.swift; sourceTree = "<group>"; };
AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkMedium.swift; sourceTree = "<group>"; };
AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkMediumModel.swift; sourceTree = "<group>"; };
AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableRightCaretAlltextAndLinksModel.swift; sourceTree = "<group>"; };
AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableRightCaretAlltextAndLinks.swift; sourceTree = "<group>"; };
AA45AA0A24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockUpsPlanNamesModel.swift; sourceTree = "<group>"; };
AA45AA0C24BF0276007A6EA7 /* LockUpsPlanNames.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockUpsPlanNames.swift; sourceTree = "<group>"; };
AA56A20E243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnSubsectionDividerModel.swift; sourceTree = "<group>"; };
@ -1193,6 +1197,8 @@
C7F8012023E8303200396FBD /* ListRVWheel.swift */,
D2351C7924A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift */,
D2351C7B24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift */,
AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift */,
AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift */,
);
path = RightVariable;
sourceTree = "<group>";
@ -2329,6 +2335,7 @@
C6FA7D5423C77A4A00A3614A /* NumberedList.swift in Sources */,
0A7ECC702441001C00C828E8 /* UIToolbar+Extension.swift in Sources */,
D29DF26D21E6AA0B003B2FB9 /* FLAnimatedImageView.m in Sources */,
AA3561AC24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift in Sources */,
D209234F244F77FD0044AD09 /* ThreeLayerCenterTemplate.swift in Sources */,
525019E52406852100EED91C /* ListFourColumnDataUsageDividerModel.swift in Sources */,
32D2609624C19E2100B56344 /* LockupsPlanSMLXL.swift in Sources */,
@ -2548,6 +2555,7 @@
D29DF29E21E7AE3B003B2FB9 /* MFStyler.m in Sources */,
94C661D923CCF4B400D9FE5B /* LeftRightLabelModel.swift in Sources */,
D28BA7432480284E00B75CB8 /* TabBar.swift in Sources */,
AA3561AE24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift in Sources */,
AA26850C244840AE00CE34CC /* HeadersH2TinyButton.swift in Sources */,
011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */,
D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */,

View File

@ -183,6 +183,7 @@ import Foundation
MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePriceChangeBodyText.self, viewModelClass: ListRightVariablePriceChangeBodyTextModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePriceChangeAllTextAndLinks.self, viewModelClass: ListRightVariablePriceChangeAllTextAndLinksModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableToggleAllTextAndLinks.self, viewModelClass: ListRightVariableToggleAllTextAndLinksModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableRightCaretAlltextAndLinks.self, viewModelClass: ListRightVariableRightCaretAlltextAndLinksModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextBodyText.self, viewModelClass: ListOneColumnFullWidthTextBodyTextModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self)

View File

@ -87,7 +87,7 @@ import Foundation
//--------------------------------------------------
// MARK: - Accessibility
//--------------------------------------------------
func getAccessibilityMessage() -> String? {
guard let rightLabelText = rightLabel.text else {
return eyebrowHeadlineBodyLink.getAccessibilityMessage()

View File

@ -0,0 +1,97 @@
//
// ListRightVariableRightCaretAlltextAndLinks.swift
// MVMCoreUI
//
// Created by Lekshmi S on 23/07/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
@objcMembers open class ListRightVariableRightCaretAlltextAndLinks: TableViewCell {
//--------------------------------------------------
// MARK: - Outlets
//--------------------------------------------------
public let rightLabel = Label(fontStyle: .RegularBodySmall)
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
public var stack: Stack<StackModel>
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
stack = Stack<StackModel>.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)), (view: rightLabel, model: StackItemModel(horizontalAlignment:.fill, verticalAlignment: .top))], axis: .horizontal)
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
//-----------------------------------------------------
// MARK: - Lifecycle
//-----------------------------------------------------
open override func setupView() {
super.setupView()
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
addMolecule(stack)
stack.restack()
}
//--------------------------------------------------
// MARK: - Molecular
//--------------------------------------------------
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListRightVariableRightCaretAlltextAndLinksModel else { return }
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
updateAccessibilityLabel()
}
open override func reset() {
super.reset()
rightLabel.setFontStyle(.RegularBodySmall)
}
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
return 90
}
//--------------------------------------------------
// MARK: - Accessibility
//--------------------------------------------------
func getAccessibilityMessage() -> String? {
guard let rightLabelText = rightLabel.text else {
return eyebrowHeadlineBodyLink.getAccessibilityMessage()
}
guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else {
return rightLabelText
}
return label + ", " + rightLabelText
}
func updateAccessibilityLabel() {
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
isAccessibilityElement = !linkShowing
accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none
if !linkShowing {
// Make whole cell focusable if no link.
accessibilityLabel = getAccessibilityMessage()
} else if let accessoryView = accessoryView {
// Both caret and link. Read all content on caret.
accessoryView.accessibilityLabel = getAccessibilityMessage()
accessibilityElements = [accessoryView, eyebrowHeadlineBodyLink.link]
} else {
// Only link. Manually add accessibility elements to ensure they are read in the right order.
var elements: [Any] = []
if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() {
elements.append(otherElements)
}
if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty {
elements.append(rightLabel)
}
accessibilityElements = elements
}
}
}

View File

@ -0,0 +1,60 @@
//
// ListRightVariableRightCaretAlltextAndLinksModel.swift
// MVMCoreUI
//
// Created by Lekshmi S on 23/07/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
public class ListRightVariableRightCaretAlltextAndLinksModel: ListItemModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "listRVCaretAll"
public var rightLabel: LabelModel
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(rightLabel: LabelModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) {
self.rightLabel = rightLabel
self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
super.init()
}
override public func setDefaults() {
super.setDefaults()
rightLabel.hero = 0
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case rightLabel
case eyebrowHeadlineBodyLink
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel)
eyebrowHeadlineBodyLink = try typeContainer.decode(EyebrowHeadlineBodyLinkModel.self, forKey: .eyebrowHeadlineBodyLink)
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(rightLabel, forKey: .rightLabel)
try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink)
}
}