Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/lockups_plan_SMLXL

This commit is contained in:
Pfeil, Scott Robert 2020-07-20 14:50:31 -04:00
commit 482a31d08f
8 changed files with 164 additions and 9 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 */; };
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 */; };
AA56A211243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA56A210243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift */; };
AA617AB02453010A00910B8F /* ListDeviceComplexLinkSmall.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA617AAF2453010A00910B8F /* ListDeviceComplexLinkSmall.swift */; };
@ -682,6 +684,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>"; };
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>"; };
AA56A210243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnSubsectionDivider.swift; sourceTree = "<group>"; };
AA617AAF2453010A00910B8F /* ListDeviceComplexLinkSmall.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkSmall.swift; sourceTree = "<group>"; };
@ -1114,6 +1118,8 @@
32D2609424C19E2100B56344 /* LockupsPlanSMLXL.swift */,
525019DB2406430700EED91C /* ListProgressBarDataModel.swift */,
525019DC2406430800EED91C /* ListProgressBarData.swift */,
AA45AA0A24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift */,
AA45AA0C24BF0276007A6EA7 /* LockUpsPlanNames.swift */,
);
path = LockUps;
sourceTree = "<group>";
@ -2343,6 +2349,7 @@
0A775F2824893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift in Sources */,
8DD1E370243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift in Sources */,
D23EA802247EBED400D60C34 /* ImageBarButtonItem.swift in Sources */,
AA45AA0B24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift in Sources */,
D2D6CD4222E78FAB00D701B8 /* ThreeLayerTemplate.swift in Sources */,
D23EA800247EBD6C00D60C34 /* LabelBarButtonItem.swift in Sources */,
01EB368F23609801006832FA /* LabelModel.swift in Sources */,
@ -2466,6 +2473,7 @@
9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */,
D2351C7A24A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift in Sources */,
01EB369323609801006832FA /* HeaderModel.swift in Sources */,
AA45AA0D24BF0276007A6EA7 /* LockUpsPlanNames.swift in Sources */,
8DE5BECF2456F7B100772E76 /* ListTwoColumnDropdownSelectors.swift in Sources */,
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */,
0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */,

View File

@ -223,6 +223,9 @@ import Foundation
MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexLinkSmall.self, viewModelClass: ListDeviceComplexLinkSmallModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexLinkMedium.self, viewModelClass: ListDeviceComplexLinkMediumModel.self)
// MARK:- LockUps
MoleculeObjectMapping.shared()?.register(viewClass: LockUpsPlanNames.self, viewModelClass: LockUpsPlanNamesModel.self)
// MARK:- Helper models
try? ModelRegistry.register(RuleRequiredModel.self)

View File

@ -0,0 +1,84 @@
//
// LockUpsPlanNames.swift
// MVMCoreUI
//
// Created by Lekshmi S on 15/07/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
@objcMembers open class LockUpsPlanNames: View {
//--------------------------------------------------
// MARK: - Outlets
//--------------------------------------------------
public let headline = Label(fontStyle: .Title2XLarge)
public let subHeadline = Label(fontStyle: .RegularTitleLarge)
public let body = Label(fontStyle: .RegularBodySmall)
public let stack: Stack<StackModel>
//-------------------------------------------------------
// MARK: - Initializers
//-------------------------------------------------------
public override init(frame: CGRect) {
stack = Stack<StackModel>.createStack(with: [(view: headline, model: StackItemModel()),
(view: subHeadline, model: StackItemModel(spacing: 16)),
(view: body, model: StackItemModel(spacing: 8))])
super.init(frame: frame)
}
public required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
//-------------------------------------------------------
// MARK: - Lifecycle
//-------------------------------------------------------
open override func setupView() {
super.setupView()
addSubview(stack)
NSLayoutConstraint.constraintPinSubview(toSuperview: stack)
stack.restack()
}
//----------------------------------------------------
// MARK: - Molecule
//------------------------------------------------------
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? LockUpsPlanNamesModel else { return }
headline.set(with: model.headline, delegateObject, additionalData)
subHeadline.set(with: model.subHeadline, delegateObject, additionalData)
body.set(with: model.body, delegateObject, additionalData)
updateAccessibilityLabel()
}
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
return 121
}
open override func reset() {
super.reset()
headline.setFontStyle(.Title2XLarge)
subHeadline.setFontStyle(.RegularTitleLarge)
body.setFontStyle(.RegularBodySmall)
}
//--------------------------------------------------
// MARK: - Accessibility
//--------------------------------------------------
func updateAccessibilityLabel() {
isAccessibilityElement = true
var message = ""
if let headline = headline.text, !headline.isEmpty {
message += headline + ", "
}
if let subHeadline = subHeadline.text, !subHeadline.isEmpty {
message += subHeadline + ", "
}
if let body = body.text, !body.isEmpty {
message += body
}
accessibilityLabel = message
}
}

View File

@ -0,0 +1,60 @@
//
// LockUpsPlanNamesModel.swift
// MVMCoreUI
//
// Created by Lekshmi S on 15/07/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
public class LockUpsPlanNamesModel: MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "planNamesLockup"
public var backgroundColor: Color?
public var headline: LabelModel
public var subHeadline: LabelModel
public var body: LabelModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(headline: LabelModel, subHeadline: LabelModel, body: LabelModel) {
self.headline = headline
self.subHeadline = subHeadline
self.body = body
}
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case backgroundColor
case headline
case subHeadline
case body
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
subHeadline = try typeContainer.decode(LabelModel.self, forKey: .subHeadline)
body = try typeContainer.decode(LabelModel.self, forKey: .body)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(headline, forKey: .headline)
try container.encode(subHeadline, forKey: .subHeadline)
try container.encode(body, forKey: .body)
}
}

View File

@ -8,15 +8,12 @@
import Foundation
/// coolGray4: #A6A8A8. This color is currently limited to only the tab bar.
private let mvmCoolGray4 = UIColor(red: 0.65, green: 0.659, blue: 0.659, alpha: 1)
public class TabBarModel: MoleculeModelProtocol {
public static var identifier: String = "tabBar"
public var backgroundColor: Color? = Color(uiColor: .white)
public var tabs: [TabBarItemModel]
public var selectedColor = Color(uiColor: .mvmBlack)
public var unSelectedColor = Color(uiColor: mvmCoolGray4)
public var unSelectedColor = Color(uiColor: .mvmCoolGray6)
// Must be capped to 0...(tabs.count - 1)
public var selectedTab: Int = 0

View File

@ -156,7 +156,8 @@ import UIKit
self.delegateObject = delegateObject
self.additionalData = additionalData
selectedIndex = tabsModel?.selectedIndex ?? 0
bottomLine.backgroundColor = tabsModel?.selectedColor.uiColor
// TODO: Commented out until we have model support for bar color. Should also do unselected color.
//bottomLine.backgroundColor = tabsModel?.selectedColor.uiColor
reloadData()
}
}
@ -299,8 +300,10 @@ extension Tabs {
label.reset()
label.set(with: labelModel, delegateObject, additionalData)
self.labelModel = labelModel
if selected, let selectedColor = tabsModel?.selectedColor {
label.textColor = selectedColor.uiColor
if selected {
label.textColor = tabsModel?.selectedColor.uiColor ?? .black
} else {
label.textColor = .mvmCoolGray6
}
updateAccessibility(indexPath: indexPath, selected: selected, tabsModel: tabsModel)
}

View File

@ -12,7 +12,7 @@ public class TabsModel: MoleculeModelProtocol {
public static var identifier: String = "tabs"
public var backgroundColor: Color?
public var tabs: [TabItemModel]
public var selectedColor = Color(uiColor: .mfTomatoRed())
public var selectedColor = Color(uiColor: .black)
// Must be capped to 0...(tabs.count - 1)
public var selectedIndex: Int = 0

View File

@ -192,7 +192,7 @@ extension UIColor {
public static let mvmCoolGray3 = UIColor.assetColor(named: "coolGray3")
/// HEX: #747676
public static let mvmCoolGray6 = UIColor.assetColor(named: "coolGray6")
@objc public static let mvmCoolGray6 = UIColor.assetColor(named: "coolGray6")
/// HEX: #333333
public static let mvmCoolGray10 = UIColor.assetColor(named: "coolGray10")