From f3a9c4b261ddac5972ea47ea520c69c0c5dac67c Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 16 Jul 2020 18:19:10 +0530 Subject: [PATCH 1/2] 21716(iOS - Lockups - Plan - Names) initial commit --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 3 + .../LockUps/LockUpsPlanNames.swift | 84 +++++++++++++++++++ .../LockUps/LockUpsPlanNamesModel.swift | 60 +++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/LockUpsPlanNames.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/LockUpsPlanNamesModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index fceb829b..69b311e4 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -211,6 +211,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 */; }; @@ -678,6 +680,8 @@ AA26850D244840C300CE34CC /* HeadersH2TinyButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2TinyButtonModel.swift; sourceTree = ""; }; AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkMedium.swift; sourceTree = ""; }; AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkMediumModel.swift; sourceTree = ""; }; + AA45AA0A24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockUpsPlanNamesModel.swift; sourceTree = ""; }; + AA45AA0C24BF0276007A6EA7 /* LockUpsPlanNames.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockUpsPlanNames.swift; sourceTree = ""; }; AA56A20E243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnSubsectionDividerModel.swift; sourceTree = ""; }; AA56A210243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnSubsectionDivider.swift; sourceTree = ""; }; AA617AAF2453010A00910B8F /* ListDeviceComplexLinkSmall.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkSmall.swift; sourceTree = ""; }; @@ -1119,6 +1123,8 @@ children = ( 525019DB2406430700EED91C /* ListProgressBarDataModel.swift */, 525019DC2406430800EED91C /* ListProgressBarData.swift */, + AA45AA0A24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift */, + AA45AA0C24BF0276007A6EA7 /* LockUpsPlanNames.swift */, ); path = LockUps; sourceTree = ""; @@ -2344,6 +2350,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 */, @@ -2468,6 +2475,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 */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 09ff554f..04409841 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -222,6 +222,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) try? ModelRegistry.register(RuleAnyRequiredModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/LockUpsPlanNames.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/LockUpsPlanNames.swift new file mode 100644 index 00000000..e8f77b2b --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/LockUpsPlanNames.swift @@ -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 + + //------------------------------------------------------- + // MARK: - Initializers + //------------------------------------------------------- + public override init(frame: CGRect) { + stack = Stack.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 + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/LockUpsPlanNamesModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/LockUpsPlanNamesModel.swift new file mode 100644 index 00000000..0d68da42 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/LockUpsPlanNamesModel.swift @@ -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) + } +} From 201c5a274f6ab064ace3deb9090c039e6456c54d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 20 Jul 2020 10:21:21 -0400 Subject: [PATCH 2/2] new tab colors --- .../HorizontalCombinationViews/TabBarModel.swift | 5 +---- .../Molecules/HorizontalCombinationViews/Tabs.swift | 9 ++++++--- .../Molecules/HorizontalCombinationViews/TabsModel.swift | 2 +- MVMCoreUI/Categories/UIColor+Extension.swift | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift index 212c63f1..9de2cd54 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift @@ -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 diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift index 8a6cb82d..f9a75e7d 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift @@ -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) } diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift index e318b47c..58990428 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift @@ -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 diff --git a/MVMCoreUI/Categories/UIColor+Extension.swift b/MVMCoreUI/Categories/UIColor+Extension.swift index 580a6ed6..ca763ac5 100644 --- a/MVMCoreUI/Categories/UIColor+Extension.swift +++ b/MVMCoreUI/Categories/UIColor+Extension.swift @@ -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")