From 714b0bd5224eb263ff93625ff9eaff337d91df42 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Wed, 22 Jul 2020 14:34:58 +0530 Subject: [PATCH 1/3] MOBFIRST - 21834 initial commit --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +++ .../ListThreeColumnBillChanges.swift | 9 +++ .../ListThreeColumnBillChangesModel.swift | 63 +++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 36867c64..bab89e70 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -122,6 +122,8 @@ 27F9736A246750BE00CAB5C5 /* ScreenBrightnessModifierBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27F97369246750BE00CAB5C5 /* ScreenBrightnessModifierBehavior.swift */; }; 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */; }; 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; }; + 323AC96A24C837F000F8E4C4 /* ListThreeColumnBillChangesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 323AC96924C837F000F8E4C4 /* ListThreeColumnBillChangesModel.swift */; }; + 323AC96C24C837FF00F8E4C4 /* ListThreeColumnBillChanges.swift in Sources */ = {isa = PBXBuildFile; fileRef = 323AC96B24C837FF00F8E4C4 /* ListThreeColumnBillChanges.swift */; }; 324FB6AA249366F3002552C7 /* ListLeftVariableNumberedListBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 324FB6A9249366F3002552C7 /* ListLeftVariableNumberedListBodyTextModel.swift */; }; 324FB6AC24936717002552C7 /* ListLeftVariableNumberedListBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 324FB6AB24936717002552C7 /* ListLeftVariableNumberedListBodyText.swift */; }; 3265B30224BCA737000D154B /* HeadersH1NoButtonsBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3265B30124BCA737000D154B /* HeadersH1NoButtonsBodyTextModel.swift */; }; @@ -593,6 +595,8 @@ 27F97369246750BE00CAB5C5 /* ScreenBrightnessModifierBehavior.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenBrightnessModifierBehavior.swift; sourceTree = ""; }; 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxLabelModel.swift; sourceTree = ""; }; 31BE15CA23D8924C00452370 /* CheckboxModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxModel.swift; sourceTree = ""; }; + 323AC96924C837F000F8E4C4 /* ListThreeColumnBillChangesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnBillChangesModel.swift; sourceTree = ""; }; + 323AC96B24C837FF00F8E4C4 /* ListThreeColumnBillChanges.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnBillChanges.swift; sourceTree = ""; }; 324FB6A9249366F3002552C7 /* ListLeftVariableNumberedListBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableNumberedListBodyTextModel.swift; sourceTree = ""; }; 324FB6AB24936717002552C7 /* ListLeftVariableNumberedListBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableNumberedListBodyText.swift; sourceTree = ""; }; 3265B30124BCA737000D154B /* HeadersH1NoButtonsBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1NoButtonsBodyTextModel.swift; sourceTree = ""; }; @@ -1144,6 +1148,8 @@ 8DD1E36F243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift */, 8DDD6C1E244D90E1006A2232 /* ListThreeColumnDataUsageModel.swift */, 8DDD6C1C244D90B8006A2232 /* ListThreeColumnDataUsage.swift */, + 323AC96924C837F000F8E4C4 /* ListThreeColumnBillChangesModel.swift */, + 323AC96B24C837FF00F8E4C4 /* ListThreeColumnBillChanges.swift */, ); path = ThreeColumn; sourceTree = ""; @@ -2367,6 +2373,7 @@ 0A41BA7F23453A6400D4C0BC /* TextEntryField.swift in Sources */, BB55B51D244482C1002001AD /* ListRightVariablePriceChangeBodyText.swift in Sources */, 017BEB382360C6AC0024EF95 /* RadioButtonLabel.swift in Sources */, + 323AC96C24C837FF00F8E4C4 /* ListThreeColumnBillChanges.swift in Sources */, D28A837923C7D5BC00DFE4FC /* PageModelProtocol.swift in Sources */, D2351C7C24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift in Sources */, 017BEB7B236763000024EF95 /* LineModel.swift in Sources */, @@ -2430,6 +2437,7 @@ BB2FB3BD247E7EF200DF73CD /* Tags.swift in Sources */, AA104ADC244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift in Sources */, BBAA4F03243D8E3B005AAD5F /* RadioBoxes.swift in Sources */, + 323AC96A24C837F000F8E4C4 /* ListThreeColumnBillChangesModel.swift in Sources */, D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */, 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */, D28BA730247EC2EB00B75CB8 /* NavigationButtomModelProtocol.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift new file mode 100644 index 00000000..f5250072 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift @@ -0,0 +1,9 @@ +// +// ListThreeColumnBillChanges.swift +// MVMCoreUI +// +// Created by Subhankar Acharya on 22/07/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift new file mode 100644 index 00000000..24336363 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift @@ -0,0 +1,63 @@ +// +// ListThreeColumnBillChangesModel.swift +// MVMCoreUI +// +// Created by Subhankar Acharya on 22/07/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListThreeColumnBillChangesModel: ListItemModel, MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public static var identifier: String = "list3CBillChg" + public var leftLabel: LabelModel + public var centerLabel: LabelModel + public var rightLabel: LabelModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + + public init(leftLabel:LabelModel, centerLabel:LabelModel, rightLabel:LabelModel) { + self.leftLabel = leftLabel + self.centerLabel = centerLabel + self.rightLabel = rightLabel + super.init() + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + + private enum CodingKeys: String, CodingKey { + case moleculeName + case leftLabel + case centerLabel + case rightLabel + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) + centerLabel = try typeContainer.decode(LabelModel.self, forKey: .centerLabel) + rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) + 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(leftLabel, forKey: .leftLabel) + try container.encode(centerLabel, forKey: .centerLabel) + try container.encode(rightLabel, forKey: .rightLabel) + } +} From 654e02ff8e69319a5a1f4a4f2de4903972c71a39 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Mon, 27 Jul 2020 10:34:56 +0530 Subject: [PATCH 2/3] map to model registry --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + .../ListThreeColumnBillChanges.swift | 86 +++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index e8c6af54..af394c62 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -191,6 +191,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnDropdownSelectors.self, viewModelClass: ListTwoColumnDropdownSelectorsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnInternationalData.self, viewModelClass: ListThreeColumnInternationalDataModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnDataUsage.self, viewModelClass: ListThreeColumnDataUsageModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnBillChanges.self, viewModelClass: ListThreeColumnBillChangesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListProgressBarThin.self, viewModelClass: ListProgressBarThinModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift index f5250072..8802a458 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift @@ -7,3 +7,89 @@ // import Foundation + +@objcMembers open class ListThreeColumnBillChanges: TableViewCell { + //----------------------------------------------------- + // MARK: - Outlets + //------------------------------------------------------- + public let leftLabel = Label(fontStyle: .RegularBodySmall) + public let centerLabel = Label(fontStyle: .RegularBodySmall) + public let rightLabel = Label(fontStyle: .RegularBodySmall) + var stack: Stack + + //------------------------------------------------------ + // MARK: - Initializers + //------------------------------------------------------ + + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 40, horizontalAlignment: .leading)), + (view: centerLabel, model: StackItemModel(percent: 37, horizontalAlignment: .leading)), + (view: rightLabel, model: StackItemModel(percent: 23, horizontalAlignment: .leading))], + 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() + leftLabel.numberOfLines = 1 + centerLabel.numberOfLines = 1 + rightLabel.numberOfLines = 1 + addMolecule(stack) + stack.restack() + } + + //-------------------------------------------------- + // MARK: - ModelMoleculeViewProtocol + //-------------------------------------------------- + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListThreeColumnBillChangesModel else { return } + leftLabel.set(with: model.leftLabel, delegateObject, additionalData) + centerLabel.set(with: model.centerLabel, delegateObject, additionalData) + rightLabel.set(with: model.rightLabel, delegateObject, additionalData) + updateAccessibilityLabel() + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 121 + } + + open override func reset() { + super.reset() + leftLabel.setFontStyle(.RegularBodySmall) + centerLabel.setFontStyle(.RegularBodySmall) + rightLabel.setFontStyle(.RegularBodySmall) + } + + //-------------------------------------------------- + // MARK: - Accessibility + //-------------------------------------------------- + + func updateAccessibilityLabel() { + isAccessibilityElement = true + var message = "" + + if let leftText = leftLabel.text, !leftText.isEmpty { + message += leftText + ", " + } + + if let centerText = centerLabel.text, !centerText.isEmpty { + message += centerText + ", " + } + + if let rightText = rightLabel.text, !rightText.isEmpty { + message += rightText + } + + accessibilityLabel = message + } +} From 70001b79c612fd5847f7c4224c0bb2ab226877f0 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 27 Jul 2020 11:35:27 -0400 Subject: [PATCH 3/3] update percents to match divider. --- .../List/ThreeColumn/ListThreeColumnBillChanges.swift | 4 ++-- .../List/ThreeColumn/ListThreeColumnBillChangesModel.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift index 8802a458..ac100a24 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift @@ -22,8 +22,8 @@ import Foundation //------------------------------------------------------ public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 40, horizontalAlignment: .leading)), - (view: centerLabel, model: StackItemModel(percent: 37, horizontalAlignment: .leading)), + stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 44, horizontalAlignment: .leading)), + (view: centerLabel, model: StackItemModel(percent: 33, horizontalAlignment: .leading)), (view: rightLabel, model: StackItemModel(percent: 23, horizontalAlignment: .leading))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift index 24336363..a9b5f9d0 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift @@ -22,7 +22,7 @@ public class ListThreeColumnBillChangesModel: ListItemModel, MoleculeModelProtoc // MARK: - Initializer //-------------------------------------------------- - public init(leftLabel:LabelModel, centerLabel:LabelModel, rightLabel:LabelModel) { + public init(leftLabel: LabelModel, centerLabel: LabelModel, rightLabel: LabelModel) { self.leftLabel = leftLabel self.centerLabel = centerLabel self.rightLabel = rightLabel