From fc741e38df432ce44dcf1c3365c2e541972a6175 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 17 Mar 2020 14:54:26 +0530 Subject: [PATCH 01/61] initial commit --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++++++++ .../ListRightVariableButtonAllTextAndLinks.swift | 9 +++++++++ .../ListRightVariableButtonAllTextAndLinksModel.swift | 9 +++++++++ 3 files changed, 26 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 796d5b7d..b274b715 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -171,6 +171,8 @@ 94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; }; AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */; }; AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */; }; + BB6C6A7F2420CE5D005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6A7E2420CE5D005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift */; }; + BB6C6A812420CE6E005F7224 /* ListRightVariableButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6A802420CE6E005F7224 /* ListRightVariableButtonAllTextAndLinks.swift */; }; C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; }; C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; }; C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; }; @@ -542,6 +544,8 @@ 94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = ""; }; AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePayments.swift; sourceTree = ""; }; AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePaymentsModel.swift; sourceTree = ""; }; + BB6C6A7E2420CE5D005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinksModel.swift; sourceTree = ""; }; + BB6C6A802420CE6E005F7224 /* ListRightVariableButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinks.swift; sourceTree = ""; }; C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = ""; }; C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = ""; }; @@ -939,6 +943,8 @@ AA4FC2A323F4F69600E251DB /* RightVariable */ = { isa = PBXGroup; children = ( + BB6C6A7E2420CE5D005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift */, + BB6C6A802420CE6E005F7224 /* ListRightVariableButtonAllTextAndLinks.swift */, AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */, AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */, C7F8012223E846C300396FBD /* ListRVWheelModel.swift */, @@ -2027,6 +2033,7 @@ D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */, D260105F23D0BFFC00764D80 /* StackItem.swift in Sources */, 9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */, + BB6C6A7F2420CE5D005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */, 01EB369323609801006832FA /* HeaderModel.swift in Sources */, D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */, 0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */, @@ -2041,6 +2048,7 @@ 52B201D224081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift in Sources */, D26C5A6B23F4A40D007AEECE /* ListItemModel.swift in Sources */, 0A21DB8D235E06EF00C160A2 /* MFDigitTextField.m in Sources */, + BB6C6A812420CE6E005F7224 /* ListRightVariableButtonAllTextAndLinks.swift in Sources */, 94AF4A4323E9D19E00676048 /* MFCaretView.m in Sources */, 943784F6236B77BB006A1E82 /* GraphViewAnimationHandler.swift in Sources */, 011D95A1240453D0000E3791 /* RuleEqualsModel.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift new file mode 100644 index 00000000..8edcdb20 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -0,0 +1,9 @@ +// +// ListRightVariableButtonAllTextAndLinks.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 17/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift new file mode 100644 index 00000000..ce10407e --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift @@ -0,0 +1,9 @@ +// +// ListRightVariableButtonAllTextAndLinksModel.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 17/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation From f4f6557c90407a8a369ed8657aab9ac83bc85b6b Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 17 Mar 2020 16:02:39 +0530 Subject: [PATCH 02/61] ListRightVariableButtonAllTextAndLinks molecule implemented --- ...stRightVariableButtonAllTextAndLinks.swift | 43 +++++++++++++++++++ ...htVariableButtonAllTextAndLinksModel.swift | 37 ++++++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 3 files changed, 81 insertions(+) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index 8edcdb20..3f95682a 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -7,3 +7,46 @@ // import Foundation +@objcMembers open class ListRightVariableButtonAllTextAndLinks: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + var stack: Stack + let button = Button(frame: .zero) + let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) + // MARK: - Initializers + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(spacing: 5,horizontalAlignment: .leading)), + (view: button, 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: - View Lifecycle + //----------------------------------------------------- + override open func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + } + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListRightVariableTextButtonAllTextAndLinksModel else { return } + button.set(with: model.button, delegateObject, additionalData) + eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } + + open override func reset() { + super.reset() + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift index ce10407e..91e9ead2 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift @@ -7,3 +7,40 @@ // import Foundation +public class ListRightVariableTextButtonAllTextAndLinksModel: ListItemModel,MoleculeModelProtocol{ + public static var identifier: String = "listRVBtn" + public var button: ButtonModel + public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel + + public init(button: ButtonModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { + self.button = button + self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink + super.init() + } + /// Defaults to set + override public func setDefaults() { + super.setDefaults() + self.button.size = .tiny + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case button + case eyebrowHeadlineBodyLink + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + button = try typeContainer.decode(ButtonModel.self, forKey: .button) + 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(button, forKey: .button) + try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index cc3950cd..69eb4994 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -103,6 +103,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableButtonAllTextAndLinks.self, viewModelClass: ListRightVariableTextButtonAllTextAndLinksModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) From a336ec0f89a45d5f24970558bab0c65d9b896fc0 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Wed, 18 Mar 2020 12:53:26 +0530 Subject: [PATCH 03/61] button styles implemented --- .../ListRightVariableButtonAllTextAndLinks.swift | 12 +++++------- ...ListRightVariableButtonAllTextAndLinksModel.swift | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index 3f95682a..0712b9b1 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -13,12 +13,14 @@ import Foundation // MARK: - Outlets //----------------------------------------------------- var stack: Stack - let button = Button(frame: .zero) + let button = PrimaryButton.button() let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) + // MARK: - Initializers public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(spacing: 5,horizontalAlignment: .leading)), - (view: button, model: StackItemModel( horizontalAlignment:.fill, verticalAlignment: .top))],axis: .horizontal) + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(spacing: 5, horizontalAlignment: .leading)), + (view: button, model: StackItemModel( horizontalAlignment:.fill, verticalAlignment: .center))], + axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -45,8 +47,4 @@ import Foundation open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 90 } - - open override func reset() { - super.reset() - } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift index 91e9ead2..d98d784b 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift @@ -17,10 +17,12 @@ public class ListRightVariableTextButtonAllTextAndLinksModel: ListItemModel,Mole self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink super.init() } + /// Defaults to set override public func setDefaults() { super.setDefaults() self.button.size = .tiny + self.button.style = ButtonStyle.secondary } private enum CodingKeys: String, CodingKey { From e8eba296d581103105c9e296207d50a3fdc91fa7 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Thu, 19 Mar 2020 10:18:57 +0530 Subject: [PATCH 04/61] ListRightVariableTextLinkAllTextAndLinks Molecule implemented --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +++ ...RightVariableTextLinkAllTextAndLinks.swift | 49 +++++++++++++++++++ ...VariableTextLinkAllTextAndLinksModel.swift | 41 ++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index f17d7906..9c6f92dc 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -183,6 +183,8 @@ BB6C6AC1242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */; }; BB6C6AC824225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AC62422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift */; }; BB6C6AC924225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AC72422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift */; }; + BB6C6ADC24233065005F7224 /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ADB24233065005F7224 /* ListRightVariableTextLinkAllTextAndLinksModel.swift */; }; + BB6C6ADE24233090005F7224 /* ListRightVariableTextLinkAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ADD24233090005F7224 /* ListRightVariableTextLinkAllTextAndLinks.swift */; }; C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; }; C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; }; C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; }; @@ -567,6 +569,8 @@ BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ListOneColumnTextWithWhitespaceDividerTall.swift; path = MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift; sourceTree = SOURCE_ROOT; }; BB6C6AC62422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShort.swift; sourceTree = ""; }; BB6C6AC72422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShortModel.swift; sourceTree = ""; }; + BB6C6ADB24233065005F7224 /* ListRightVariableTextLinkAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinksModel.swift; sourceTree = ""; }; + BB6C6ADD24233090005F7224 /* ListRightVariableTextLinkAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinks.swift; sourceTree = ""; }; C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = ""; }; C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = ""; }; @@ -997,6 +1001,8 @@ AA4FC2A323F4F69600E251DB /* RightVariable */ = { isa = PBXGroup; children = ( + BB6C6ADB24233065005F7224 /* ListRightVariableTextLinkAllTextAndLinksModel.swift */, + BB6C6ADD24233090005F7224 /* ListRightVariableTextLinkAllTextAndLinks.swift */, AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */, AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */, 8D070BAF241B56530099AC56 /* ListRightVariableTotalDataModel.swift */, @@ -1991,6 +1997,7 @@ 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */, D260105523CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift in Sources */, D29DF13021E6851E003B2FB9 /* MVMCoreUITopAlertShortView.m in Sources */, + BB6C6ADE24233090005F7224 /* ListRightVariableTextLinkAllTextAndLinks.swift in Sources */, 5248BFEC23F12E350059236A /* ListThreeColumnPlanDataDivider.swift in Sources */, 0ABD136D237CAD1E0081388D /* DateDropdownEntryField.swift in Sources */, 0A7EF85B23D8A52800B2AAD1 /* EntryFieldModel.swift in Sources */, @@ -2060,6 +2067,7 @@ D2A6390522CBCE160052ED1F /* MoleculeCollectionViewCell.swift in Sources */, D2A6390122CBB1820052ED1F /* Carousel.swift in Sources */, D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */, + BB6C6ADC24233065005F7224 /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */, C7F8012123E8303200396FBD /* ListRVWheel.swift in Sources */, D29DF29521E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m in Sources */, D2FB151B23A2B65B00C20E10 /* MoleculeContainer.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift new file mode 100644 index 00000000..d9d04205 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift @@ -0,0 +1,49 @@ +// +// ListRightVariableTextLinkAllTextAndLinks.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 19/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +@objcMembers open class ListRightVariableTextLinkAllTextAndLinks: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + public var stack: Stack + public let link = Link(frame: .zero) + public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) + // MARK: - Initializers + + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(spacing: 5,horizontalAlignment: .leading)), + (view: link, 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: - View Lifecycle + //----------------------------------------------------- + override open func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + } + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListRightVariableTextLinkAllTextAndLinksModel else { return } + link.set(with: model.link, delegateObject, additionalData) + eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift new file mode 100644 index 00000000..7541d38d --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift @@ -0,0 +1,41 @@ +// +// ListRightVariableTextLinkAllTextAndLinksModel.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 19/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +public class ListRightVariableTextLinkAllTextAndLinksModel: ListItemModel,MoleculeModelProtocol{ + public static var identifier: String = "listRVLink" + public var link: LinkModel + public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel + + public init(link: LinkModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { + self.link = link + self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink + super.init() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case link + case eyebrowHeadlineBodyLink + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + link = try typeContainer.decode(LinkModel.self, forKey: .link) + 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(link, forKey: .link) + try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) + } +} From bc5f8f541e1f228a74d342edc440feb5913e7a0b Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Thu, 19 Mar 2020 10:41:08 +0530 Subject: [PATCH 05/61] Molecule added to mapping class --- MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index f2bf9e78..3abc86e7 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -106,6 +106,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableTotalData.self, viewModelClass: ListRightVariableTotalDataModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableTextLinkAllTextAndLinks.self, viewModelClass: ListRightVariableTextLinkAllTextAndLinksModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextBodyText.self, viewModelClass: ListOneColumnFullWidthTextBodyTextModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) From dc3796ccb3aa3dd9b3d2ff26b1155d961129a422 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Fri, 20 Mar 2020 11:11:27 +0530 Subject: [PATCH 06/61] Class name changed --- .../ListRightVariableButtonAllTextAndLinks.swift | 8 ++++---- .../ListRightVariableButtonAllTextAndLinksModel.swift | 2 +- MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index 0712b9b1..ba162be3 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -12,9 +12,9 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //----------------------------------------------------- - var stack: Stack - let button = PrimaryButton.button() - let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) + public var stack: Stack + public let button = PrimaryButton.button() + public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) // MARK: - Initializers public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { @@ -39,7 +39,7 @@ import Foundation open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ super.set(with: model, delegateObject, additionalData) - guard let model = model as? ListRightVariableTextButtonAllTextAndLinksModel else { return } + guard let model = model as? ListRightVariableButtonAllTextAndLinksModel else { return } button.set(with: model.button, delegateObject, additionalData) eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift index d98d784b..a306a86c 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift @@ -7,7 +7,7 @@ // import Foundation -public class ListRightVariableTextButtonAllTextAndLinksModel: ListItemModel,MoleculeModelProtocol{ +public class ListRightVariableButtonAllTextAndLinksModel: ListItemModel,MoleculeModelProtocol{ public static var identifier: String = "listRVBtn" public var button: ButtonModel public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 69eb4994..dda1e61f 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -103,7 +103,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableButtonAllTextAndLinks.self, viewModelClass: ListRightVariableTextButtonAllTextAndLinksModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableButtonAllTextAndLinks.self, viewModelClass: ListRightVariableButtonAllTextAndLinksModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) From d1a984191255cbc8b2a6e51a98a0597d4b4e9132 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Fri, 20 Mar 2020 11:32:33 +0530 Subject: [PATCH 07/61] files added after merging --- MVMCoreUI.xcodeproj/project.pbxproj | 12 ++++++++---- MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index fee58e68..37ca99a7 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -183,6 +183,8 @@ BB6C6AC1242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */; }; BB6C6AC824225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AC62422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift */; }; BB6C6AC924225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AC72422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift */; }; + BB6C6AE1242492F2005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ADF242492C0005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift */; }; + BB6C6AE2242492F2005F7224 /* ListRightVariableButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AE0242492F1005F7224 /* ListRightVariableButtonAllTextAndLinks.swift */; }; C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; }; C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; }; C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; }; @@ -567,6 +569,8 @@ BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ListOneColumnTextWithWhitespaceDividerTall.swift; path = MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift; sourceTree = SOURCE_ROOT; }; BB6C6AC62422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShort.swift; sourceTree = ""; }; BB6C6AC72422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShortModel.swift; sourceTree = ""; }; + BB6C6ADF242492C0005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinksModel.swift; sourceTree = ""; }; + BB6C6AE0242492F1005F7224 /* ListRightVariableButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinks.swift; sourceTree = ""; }; C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = ""; }; C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = ""; }; @@ -997,8 +1001,8 @@ AA4FC2A323F4F69600E251DB /* RightVariable */ = { isa = PBXGroup; children = ( - BB6C6A7E2420CE5D005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift */, - BB6C6A802420CE6E005F7224 /* ListRightVariableButtonAllTextAndLinks.swift */, + BB6C6ADF242492C0005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift */, + BB6C6AE0242492F1005F7224 /* ListRightVariableButtonAllTextAndLinks.swift */, AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */, AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */, 8D070BAF241B56530099AC56 /* ListRightVariableTotalDataModel.swift */, @@ -1961,6 +1965,7 @@ 017BEB4023620A230024EF95 /* TextFieldModel.swift in Sources */, D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */, D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */, + BB6C6AE1242492F2005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */, 94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */, 0103B84E23D7E33A009C315C /* HeadlineBodyToggleModel.swift in Sources */, D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */, @@ -2103,7 +2108,6 @@ D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */, D260105F23D0BFFC00764D80 /* StackItem.swift in Sources */, 9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */, - BB6C6A7F2420CE5D005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */, 01EB369323609801006832FA /* HeaderModel.swift in Sources */, D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */, 0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */, @@ -2118,12 +2122,12 @@ 52B201D224081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift in Sources */, D26C5A6B23F4A40D007AEECE /* ListItemModel.swift in Sources */, 0A21DB8D235E06EF00C160A2 /* MFDigitTextField.m in Sources */, - BB6C6A812420CE6E005F7224 /* ListRightVariableButtonAllTextAndLinks.swift in Sources */, 94AF4A4323E9D19E00676048 /* MFCaretView.m in Sources */, 943784F6236B77BB006A1E82 /* GraphViewAnimationHandler.swift in Sources */, 011D95A1240453D0000E3791 /* RuleEqualsModel.swift in Sources */, D29DF2AA21E7B2F9003B2FB9 /* MVMCoreUIConstants.m in Sources */, 011D95892404249B000E3791 /* FormProtocol.swift in Sources */, + BB6C6AE2242492F2005F7224 /* ListRightVariableButtonAllTextAndLinks.swift in Sources */, 948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */, 013F801923FB4A8E00AD8013 /* UIContentMode+Extension.swift in Sources */, 525239C22407BD1000454969 /* ListTwoColumnPriceDetails.swift in Sources */, diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index f2bf9e78..d4f79cc8 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -104,6 +104,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableButtonAllTextAndLinks.self, viewModelClass: ListRightVariableButtonAllTextAndLinksModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableTotalData.self, viewModelClass: ListRightVariableTotalDataModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextBodyText.self, viewModelClass: ListOneColumnFullWidthTextBodyTextModel.self) From e633ea564c6e10beb272cd074eb0530b4fed6d43 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Fri, 20 Mar 2020 15:50:17 +0530 Subject: [PATCH 08/61] spacing change --- .../RightVariable/ListRightVariableButtonAllTextAndLinks.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index ba162be3..0fd7fdad 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -18,7 +18,7 @@ import Foundation // MARK: - Initializers public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(spacing: 5, horizontalAlignment: .leading)), + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(spacing: 0, horizontalAlignment: .leading)), (view: button, model: StackItemModel( horizontalAlignment:.fill, verticalAlignment: .center))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) From 2226d9beed2b38bb41bcc581d51d436cd82950cd Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Tue, 24 Mar 2020 10:37:48 +0530 Subject: [PATCH 09/61] 190780 - List- Three Column - International Data Divider - Initial commit --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +++ ...tThreeColumnInternationalDataDivider.swift | 67 +++++++++++++++++++ ...eColumnInternationalDataDividerModel.swift | 52 ++++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 4 files changed, 128 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index f17d7906..06f3740f 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -134,6 +134,8 @@ 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */; }; 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; + 8DFBDE1D24288958007F3433 /* ListThreeColumnInternationalDataDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFBDE1C24288958007F3433 /* ListThreeColumnInternationalDataDividerModel.swift */; }; + 8DFBDE1F24288965007F3433 /* ListThreeColumnInternationalDataDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFBDE1E24288965007F3433 /* ListThreeColumnInternationalDataDivider.swift */; }; 942C372E241149170066E45E /* NHaasGroteskDSStd-75Bd.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */; }; 942C372F241149170066E45E /* NHaasGroteskDSStd-55Rg.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */; }; 942C378C2412F4FA0066E45E /* ModalMoleculeListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 942C378B2412F4FA0066E45E /* ModalMoleculeListTemplate.swift */; }; @@ -519,6 +521,8 @@ 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretModel.swift; sourceTree = ""; }; 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; + 8DFBDE1C24288958007F3433 /* ListThreeColumnInternationalDataDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnInternationalDataDividerModel.swift; sourceTree = ""; }; + 8DFBDE1E24288965007F3433 /* ListThreeColumnInternationalDataDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnInternationalDataDivider.swift; sourceTree = ""; }; 9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftRightLabelModel.swift; sourceTree = ""; }; 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NHaasGroteskDSStd-75Bd.otf"; sourceTree = ""; }; 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NHaasGroteskDSStd-55Rg.otf"; sourceTree = ""; }; @@ -1227,6 +1231,8 @@ children = ( 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */, 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */, + 8DFBDE1C24288958007F3433 /* ListThreeColumnInternationalDataDividerModel.swift */, + 8DFBDE1E24288965007F3433 /* ListThreeColumnInternationalDataDivider.swift */, ); path = ThreeColumn; sourceTree = ""; @@ -1909,6 +1915,7 @@ BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */, 012A88C8238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift in Sources */, 0A7EF86123D8AC2500B2AAD1 /* DigitEntryFieldModel.swift in Sources */, + 8DFBDE1D24288958007F3433 /* ListThreeColumnInternationalDataDividerModel.swift in Sources */, DBC4392122491730001AB423 /* LabelWithInternalButton.swift in Sources */, D224798C231450C8003FCCF9 /* HeadlineBodyToggle.swift in Sources */, 017BEB442362192F0024EF95 /* MVMCoreUIMoleculeMappingObject+ModelExtension.swift in Sources */, @@ -2123,6 +2130,7 @@ 948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */, 013F801923FB4A8E00AD8013 /* UIContentMode+Extension.swift in Sources */, 525239C22407BD1000454969 /* ListTwoColumnPriceDetails.swift in Sources */, + 8DFBDE1F24288965007F3433 /* ListThreeColumnInternationalDataDivider.swift in Sources */, D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */, D2E2A9A323E096B1000B42E6 /* DisableableModelProtocol.swift in Sources */, D29DF11821E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.m in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift new file mode 100644 index 00000000..60977ef1 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift @@ -0,0 +1,67 @@ +// +// ListThreeColumnInternationalDataDivider.swift +// MVMCoreUI +// +// Created by Kruthika KP on 23/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class ListThreeColumnInternationalDataDivider: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + let leftLabel = Label.createLabelBoldBodySmall(true) + let centerLabel = Label.createLabelBoldBodySmall(true) + let rightLabel = Label.createLabelBoldBodySmall(true) + var stack: Stack + + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 33, horizontalAlignment: .leading)), + (view: centerLabel, model: StackItemModel(percent: 34, horizontalAlignment: .leading)), + (view: rightLabel, model: StackItemModel(percent: 33, horizontalAlignment: .center))], + axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //----------------------------------------------------- + // MARK: - MFViewProtocol + //----------------------------------------------------- + open override func setupView() { + super.setupView() + 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? ListThreeColumnInternationalDataDividerModel else { return } + leftLabel.set(with: model.leftLabel, delegateObject, additionalData) + centerLabel.set(with: model.centerLabel, delegateObject, additionalData) + rightLabel.set(with: model.rightLabel, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 121 + } + + //----------------------------------------------------- + // MARK: - MVMCoreUIMoleculeViewProtocol + //----------------------------------------------------- + override open func reset() { + super.reset() + leftLabel.styleBoldBodySmall(true) + centerLabel.styleBoldBodySmall(true) + rightLabel.styleBoldBodySmall(true) + } +} + diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift new file mode 100644 index 00000000..19d71073 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift @@ -0,0 +1,52 @@ +// +// ListThreeColumnInternationalDataDividerModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 23/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListThreeColumnInternationalDataDividerModel : ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "list3CIntDataDiv" + public var leftLabel: LabelModel + public var centerLabel: LabelModel + public var rightLabel: LabelModel + + public init (leftLabel:LabelModel, centerLabel:LabelModel, rightLabel:LabelModel) { + self.leftLabel = leftLabel + self.centerLabel = centerLabel + self.rightLabel = rightLabel + super.init() + } + + override public func setDefaults() { + super.setDefaults() + style = "tallDivider" + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case leftLabel + case centerLabel + case rightLabel + } + + 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) + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index f2bf9e78..7bda1e5f 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -117,6 +117,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerTall.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerTallModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextDividerSubsection.self, viewModelClass: ListOneColumnFullWidthTextDividerSubsectionModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnInternationalDataDivider.self, viewModelClass: ListThreeColumnInternationalDataDividerModel.self) // Designed Headers MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) From 95d705abb48ec48e7a8e02d6a2bc37e38a25ab01 Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Tue, 24 Mar 2020 17:02:29 +0530 Subject: [PATCH 10/61] 19078 - List - Three Column - International Data - Updated to latest --- MVMCoreUI.xcodeproj/project.pbxproj | 25 +++++--- .../ListThreeColumnInternationalData.swift} | 59 ++++++++++--------- ...stThreeColumnInternationalDataModel.swift} | 25 +++++--- .../OtherHandlers/MoleculeObjectMapping.swift | 2 +- 4 files changed, 65 insertions(+), 46 deletions(-) rename MVMCoreUI/Molecules/DesignedComponents/{SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift => List/ThreeColumn/ListThreeColumnInternationalData.swift} (58%) rename MVMCoreUI/Molecules/DesignedComponents/{SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift => List/ThreeColumn/ListThreeColumnInternationalDataModel.swift} (62%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 06f3740f..a1bf3ac2 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -134,8 +134,8 @@ 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */; }; 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; - 8DFBDE1D24288958007F3433 /* ListThreeColumnInternationalDataDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFBDE1C24288958007F3433 /* ListThreeColumnInternationalDataDividerModel.swift */; }; - 8DFBDE1F24288965007F3433 /* ListThreeColumnInternationalDataDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFBDE1E24288965007F3433 /* ListThreeColumnInternationalDataDivider.swift */; }; + 8DFB6D8B242A137600A3F715 /* ListThreeColumnInternationalDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFB6D8A242A137600A3F715 /* ListThreeColumnInternationalDataModel.swift */; }; + 8DFB6D8D242A138000A3F715 /* ListThreeColumnInternationalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFB6D8C242A138000A3F715 /* ListThreeColumnInternationalData.swift */; }; 942C372E241149170066E45E /* NHaasGroteskDSStd-75Bd.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */; }; 942C372F241149170066E45E /* NHaasGroteskDSStd-55Rg.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */; }; 942C378C2412F4FA0066E45E /* ModalMoleculeListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 942C378B2412F4FA0066E45E /* ModalMoleculeListTemplate.swift */; }; @@ -521,8 +521,8 @@ 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretModel.swift; sourceTree = ""; }; 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; - 8DFBDE1C24288958007F3433 /* ListThreeColumnInternationalDataDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnInternationalDataDividerModel.swift; sourceTree = ""; }; - 8DFBDE1E24288965007F3433 /* ListThreeColumnInternationalDataDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnInternationalDataDivider.swift; sourceTree = ""; }; + 8DFB6D8A242A137600A3F715 /* ListThreeColumnInternationalDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnInternationalDataModel.swift; sourceTree = ""; }; + 8DFB6D8C242A138000A3F715 /* ListThreeColumnInternationalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnInternationalData.swift; sourceTree = ""; }; 9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftRightLabelModel.swift; sourceTree = ""; }; 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NHaasGroteskDSStd-75Bd.otf"; sourceTree = ""; }; 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NHaasGroteskDSStd-55Rg.otf"; sourceTree = ""; }; @@ -923,6 +923,7 @@ 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */, 8D084ACF2410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift */, 8D084AD12410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift */, + 8DFB6D89242A134600A3F715 /* ThreeColumn */, ); path = OneColumn; sourceTree = ""; @@ -965,6 +966,16 @@ path = TwoColumn; sourceTree = ""; }; + 8DFB6D89242A134600A3F715 /* ThreeColumn */ = { + isa = PBXGroup; + children = ( + 8DFB6D8A242A137600A3F715 /* ListThreeColumnInternationalDataModel.swift */, + 8DFB6D8C242A138000A3F715 /* ListThreeColumnInternationalData.swift */, + ); + name = ThreeColumn; + path = ../ThreeColumn; + sourceTree = ""; + }; 94C01508242155FE005811A9 /* Actions */ = { isa = PBXGroup; children = ( @@ -1231,8 +1242,6 @@ children = ( 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */, 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */, - 8DFBDE1C24288958007F3433 /* ListThreeColumnInternationalDataDividerModel.swift */, - 8DFBDE1E24288965007F3433 /* ListThreeColumnInternationalDataDivider.swift */, ); path = ThreeColumn; sourceTree = ""; @@ -1884,6 +1893,7 @@ D28A838123CCB0D800DFE4FC /* AccordionListItemModel.swift in Sources */, DBC4391822442197001AB423 /* CaretView.swift in Sources */, C07065C42395677300FBF997 /* Link.swift in Sources */, + 8DFB6D8D242A138000A3F715 /* ListThreeColumnInternationalData.swift in Sources */, 0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */, D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */, D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */, @@ -1915,7 +1925,6 @@ BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */, 012A88C8238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift in Sources */, 0A7EF86123D8AC2500B2AAD1 /* DigitEntryFieldModel.swift in Sources */, - 8DFBDE1D24288958007F3433 /* ListThreeColumnInternationalDataDividerModel.swift in Sources */, DBC4392122491730001AB423 /* LabelWithInternalButton.swift in Sources */, D224798C231450C8003FCCF9 /* HeadlineBodyToggle.swift in Sources */, 017BEB442362192F0024EF95 /* MVMCoreUIMoleculeMappingObject+ModelExtension.swift in Sources */, @@ -2130,7 +2139,6 @@ 948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */, 013F801923FB4A8E00AD8013 /* UIContentMode+Extension.swift in Sources */, 525239C22407BD1000454969 /* ListTwoColumnPriceDetails.swift in Sources */, - 8DFBDE1F24288965007F3433 /* ListThreeColumnInternationalDataDivider.swift in Sources */, D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */, D2E2A9A323E096B1000B42E6 /* DisableableModelProtocol.swift in Sources */, D29DF11821E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.m in Sources */, @@ -2157,6 +2165,7 @@ D2B18B922361E65A00A9AEDC /* CoreUIObject.swift in Sources */, D29DF2BE21E7BEA4003B2FB9 /* TopTabbar.m in Sources */, 014AA72E23C5059B006F3E93 /* StackCenteredPageTemplateModel.swift in Sources */, + 8DFB6D8B242A137600A3F715 /* ListThreeColumnInternationalDataModel.swift in Sources */, D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */, 011D959D2404536F000E3791 /* RuleAnyValueChangedModel.swift in Sources */, D260105923D0A92900764D80 /* ContainerProtocol.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift b/MVMCoreUI/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift similarity index 58% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift rename to MVMCoreUI/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift index 60977ef1..948bdb9b 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift @@ -1,28 +1,34 @@ // -// ListThreeColumnInternationalDataDivider.swift +// ListThreeColumnInternationalData.swift // MVMCoreUI // -// Created by Kruthika KP on 23/03/20. +// Created by Kruthika KP on 24/03/20. // Copyright © 2020 Verizon Wireless. All rights reserved. // import Foundation -@objcMembers open class ListThreeColumnInternationalDataDivider: TableViewCell { + +@objcMembers public class ListThreeColumnInternationalData: TableViewCell { //----------------------------------------------------- // MARK: - Outlets //----------------------------------------------------- - let leftLabel = Label.createLabelBoldBodySmall(true) - let centerLabel = Label.createLabelBoldBodySmall(true) - let rightLabel = Label.createLabelBoldBodySmall(true) var stack: Stack + let leftLabel = Label.createLabelRegularBodySmall(true) + let centerLabel = Label.createLabelRegularBodySmall(true) + let rightLabel = Label.createLabelRegularBodySmall(true) + let arrow = Arrow(frame: .zero) + //----------------------------------------------------- + // MARK: - Initializers + //----------------------------------------------------- public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 33, horizontalAlignment: .leading)), - (view: centerLabel, model: StackItemModel(percent: 34, horizontalAlignment: .leading)), - (view: rightLabel, model: StackItemModel(percent: 33, horizontalAlignment: .center))], - axis: .horizontal) + stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 30, horizontalAlignment: .leading)), + (view: arrow, model: StackItemModel(percent: 4, horizontalAlignment: .trailing)), + (view: centerLabel, model: StackItemModel(percent: 46, horizontalAlignment: .leading)), + (view: rightLabel, model: StackItemModel(percent:30,horizontalAlignment: .center))], + axis: .horizontal,spacing: 2) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -31,37 +37,34 @@ import Foundation } //----------------------------------------------------- - // MARK: - MFViewProtocol + // MARK: - View Lifecycle //----------------------------------------------------- - open override func setupView() { + override open func setupView() { super.setupView() addMolecule(stack) - stack.restack() + arrow.pinHeightAndWidth() } - //----------------------------------------------------- - // MARK: - ModelMoleculeViewProtocol - //----------------------------------------------------- - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ super.set(with: model, delegateObject, additionalData) - guard let model = model as? ListThreeColumnInternationalDataDividerModel else { return } + guard let model = model as? ListThreeColumnInternationalDataModel else { return } leftLabel.set(with: model.leftLabel, delegateObject, additionalData) centerLabel.set(with: model.centerLabel, delegateObject, additionalData) rightLabel.set(with: model.rightLabel, delegateObject, additionalData) + arrow.set(with: model.arrow, delegateObject, additionalData) + stack.restack() } - open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - return 121 + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 } - //----------------------------------------------------- - // MARK: - MVMCoreUIMoleculeViewProtocol - //----------------------------------------------------- - override open func reset() { + open override func reset() { super.reset() - leftLabel.styleBoldBodySmall(true) - centerLabel.styleBoldBodySmall(true) - rightLabel.styleBoldBodySmall(true) + leftLabel.styleRegularBodySmall(true) + centerLabel.styleRegularBodySmall(true) + rightLabel.styleRegularBodySmall(true) + arrow.reset() } + } - diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift similarity index 62% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift rename to MVMCoreUI/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift index 19d71073..5a2ceff2 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift @@ -1,36 +1,41 @@ // -// ListThreeColumnInternationalDataDividerModel.swift +// ListThreeColumnInternationalDataModel.swift // MVMCoreUI // -// Created by Kruthika KP on 23/03/20. +// Created by Kruthika KP on 24/03/20. // Copyright © 2020 Verizon Wireless. All rights reserved. // import Foundation -public class ListThreeColumnInternationalDataDividerModel : ListItemModel, MoleculeModelProtocol { - public static var identifier: String = "list3CIntDataDiv" +public class ListThreeColumnInternationalDataModel: ListItemModel, MoleculeModelProtocol { + + public static var identifier: String = "list3CIntData" public var leftLabel: LabelModel public var centerLabel: LabelModel public var rightLabel: LabelModel + public var arrow: ArrowModel - public init (leftLabel:LabelModel, centerLabel:LabelModel, rightLabel:LabelModel) { + public init(leftLabel:LabelModel, centerLabel:LabelModel, rightLabel:LabelModel,arrow:ArrowModel){ self.leftLabel = leftLabel self.centerLabel = centerLabel self.rightLabel = rightLabel + self.arrow = arrow super.init() } - override public func setDefaults() { + public override func setDefaults() { super.setDefaults() - style = "tallDivider" + arrow.degrees = 50 + arrow.color = Color.init(uiColor: .mvmGreen) } - private enum CodingKeys: String, CodingKey { + private enum CodingKeys: String, CodingKey{ case moleculeName case leftLabel case centerLabel case rightLabel + case arrow } required public init(from decoder: Decoder) throws { @@ -38,15 +43,17 @@ public class ListThreeColumnInternationalDataDividerModel : ListItemModel, Molec leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) centerLabel = try typeContainer.decode(LabelModel.self, forKey: .centerLabel) rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) + arrow = try typeContainer.decode(ArrowModel.self, forKey: .arrow) try super.init(from: decoder) } - public override func encode(to encoder: Encoder) throws { + 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) + try container.encode(arrow, forKey: .arrow) } } diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 7bda1e5f..666a5c61 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -110,6 +110,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnInternationalData.self, viewModelClass: ListThreeColumnInternationalDataModel.self) // Designed Section Dividers MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) @@ -117,7 +118,6 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerTall.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerTallModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextDividerSubsection.self, viewModelClass: ListOneColumnFullWidthTextDividerSubsectionModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnInternationalDataDivider.self, viewModelClass: ListThreeColumnInternationalDataDividerModel.self) // Designed Headers MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) From 26a530af2c8f29ab31cfa894849259c8b9053aaa Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 24 Mar 2020 17:20:19 -0400 Subject: [PATCH 11/61] Form Cleaning --- MVMCoreUI.xcodeproj/project.pbxproj | 26 ++-- .../Atomic/Atoms/Buttons/ButtonModel.swift | 10 +- .../Atomic/Atoms/Buttons/PillButton.swift | 6 +- .../Atomic/Atoms/Buttons/RadioButton.swift | 4 +- .../Atoms/Buttons/RadioButtonModel.swift | 17 ++- .../Buttons/RadioButtonSelectionHelper.swift | 4 +- .../Atoms/TextFields/EntryFieldModel.swift | 28 ++-- .../Atoms/TextFields/TextEntryField.swift | 12 +- MVMCoreUI/Atomic/Atoms/Views/Checkbox.swift | 4 +- .../Atomic/Atoms/Views/CheckboxModel.swift | 20 +-- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 4 +- .../Atomic/Atoms/Views/ToggleModel.swift | 26 ++-- .../BaseControllers/ViewController.swift | 6 +- .../FormActionFieldProtocol.swift | 14 -- .../FormUIHelpers/FormFieldProtocol.swift | 6 + .../FormGroupWatcherFieldProtocol.swift | 14 ++ .../FormHolderModelProtocol.swift | 2 +- .../FormUIHelpers/FormItemProtocol.swift | 10 +- .../FormRuleWatcherFieldProtocol.swift | 14 ++ MVMCoreUI/FormUIHelpers/FormValidator.swift | 139 ++++++++++-------- .../Rules/Rules/FormGroupRule.swift | 1 + .../Rules/Rules/RulesProtocol.swift | 30 +--- MVMCoreUI/FormUIHelpers/ValidProtocol.swift | 15 -- .../Controllers/MFViewController+Form.swift | 22 --- .../Controllers/MFViewController+Model.swift | 40 ----- .../Legacy/Controllers/MFViewController.m | 5 - 26 files changed, 214 insertions(+), 265 deletions(-) delete mode 100644 MVMCoreUI/FormUIHelpers/FormActionFieldProtocol.swift create mode 100644 MVMCoreUI/FormUIHelpers/FormGroupWatcherFieldProtocol.swift create mode 100644 MVMCoreUI/FormUIHelpers/FormRuleWatcherFieldProtocol.swift delete mode 100644 MVMCoreUI/FormUIHelpers/ValidProtocol.swift delete mode 100644 MVMCoreUI/Legacy/Controllers/MFViewController+Form.swift delete mode 100644 MVMCoreUI/Legacy/Controllers/MFViewController+Model.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 03335a4d..27346789 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -22,13 +22,12 @@ 011D95A1240453D0000E3791 /* RuleEqualsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D95A0240453D0000E3791 /* RuleEqualsModel.swift */; }; 011D95A3240453F8000E3791 /* RuleRegexModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D95A2240453F8000E3791 /* RuleRegexModel.swift */; }; 011D95A5240455DC000E3791 /* FormGroupRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D95A4240455DC000E3791 /* FormGroupRule.swift */; }; - 011D95A924057AC7000E3791 /* FormActionFieldProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D95A824057AC7000E3791 /* FormActionFieldProtocol.swift */; }; + 011D95A924057AC7000E3791 /* FormGroupWatcherFieldProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D95A824057AC7000E3791 /* FormGroupWatcherFieldProtocol.swift */; }; 011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D95AA2405C553000E3791 /* FormItemProtocol.swift */; }; 011D95AD2406BB57000E3791 /* FormHolderProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D95AC2406BB57000E3791 /* FormHolderProtocol.swift */; }; 011D95AF2407266E000E3791 /* RadioButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D95AE2407266E000E3791 /* RadioButtonModel.swift */; }; - 011D9602240DA20A000E3791 /* ValidProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D9601240DA20A000E3791 /* ValidProtocol.swift */; }; + 011D9602240DA20A000E3791 /* FormRuleWatcherFieldProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D9601240DA20A000E3791 /* FormRuleWatcherFieldProtocol.swift */; }; 011D9626240EBB16000E3791 /* RadioButtonLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D9625240EBB16000E3791 /* RadioButtonLabelModel.swift */; }; - 011D9628240EFA1E000E3791 /* MFViewController+Form.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D9627240EFA1E000E3791 /* MFViewController+Form.swift */; }; 012A889C23889E8400FE3DA1 /* TemplateModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A889B23889E8400FE3DA1 /* TemplateModelProtocol.swift */; }; 012A88AD238C418100FE3DA1 /* TemplateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */; }; 012A88B1238C880100FE3DA1 /* CarouselPagingModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88B0238C880100FE3DA1 /* CarouselPagingModelProtocol.swift */; }; @@ -52,7 +51,6 @@ 01509D932327ECFB00EF99AA /* ProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01509D922327ECFB00EF99AA /* ProgressBar.swift */; }; 01509D952327ED1900EF99AA /* HeadlineBodyLinkToggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01509D942327ED1900EF99AA /* HeadlineBodyLinkToggle.swift */; }; 017BEB382360C6AC0024EF95 /* RadioButtonLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */; }; - 017BEB3C2361EA1D0024EF95 /* MFViewController+Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB3B2361EA1D0024EF95 /* MFViewController+Model.swift */; }; 017BEB48236230DB0024EF95 /* MoleculeViewProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */; }; 017BEB7B236763000024EF95 /* LineModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB7A236763000024EF95 /* LineModel.swift */; }; 017BEB7F23676E870024EF95 /* MoleculeObjectMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */; }; @@ -415,13 +413,12 @@ 011D95A0240453D0000E3791 /* RuleEqualsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleEqualsModel.swift; sourceTree = ""; }; 011D95A2240453F8000E3791 /* RuleRegexModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleRegexModel.swift; sourceTree = ""; }; 011D95A4240455DC000E3791 /* FormGroupRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormGroupRule.swift; sourceTree = ""; }; - 011D95A824057AC7000E3791 /* FormActionFieldProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormActionFieldProtocol.swift; sourceTree = ""; }; + 011D95A824057AC7000E3791 /* FormGroupWatcherFieldProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormGroupWatcherFieldProtocol.swift; sourceTree = ""; }; 011D95AA2405C553000E3791 /* FormItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormItemProtocol.swift; sourceTree = ""; }; 011D95AC2406BB57000E3791 /* FormHolderProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormHolderProtocol.swift; sourceTree = ""; }; 011D95AE2407266E000E3791 /* RadioButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonModel.swift; sourceTree = ""; }; - 011D9601240DA20A000E3791 /* ValidProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValidProtocol.swift; sourceTree = ""; }; + 011D9601240DA20A000E3791 /* FormRuleWatcherFieldProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormRuleWatcherFieldProtocol.swift; sourceTree = ""; }; 011D9625240EBB16000E3791 /* RadioButtonLabelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadioButtonLabelModel.swift; sourceTree = ""; }; - 011D9627240EFA1E000E3791 /* MFViewController+Form.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFViewController+Form.swift"; sourceTree = ""; }; 012A889B23889E8400FE3DA1 /* TemplateModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateModelProtocol.swift; sourceTree = ""; }; 012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateProtocol.swift; sourceTree = ""; }; 012A88AE238C626E00FE3DA1 /* CarouselModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselModel.swift; sourceTree = ""; }; @@ -445,7 +442,6 @@ 01509D922327ECFB00EF99AA /* ProgressBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgressBar.swift; sourceTree = ""; }; 01509D942327ED1900EF99AA /* HeadlineBodyLinkToggle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeadlineBodyLinkToggle.swift; sourceTree = ""; }; 017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadioButtonLabel.swift; sourceTree = ""; }; - 017BEB3B2361EA1D0024EF95 /* MFViewController+Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFViewController+Model.swift"; sourceTree = ""; }; 017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeViewProtocol.swift; sourceTree = ""; }; 017BEB7A236763000024EF95 /* LineModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineModel.swift; sourceTree = ""; }; 017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeObjectMapping.swift; sourceTree = ""; }; @@ -827,13 +823,13 @@ 011D958A24042794000E3791 /* Rules */ = { isa = PBXGroup; children = ( + 011D95A4240455DC000E3791 /* FormGroupRule.swift */, 011D958424042432000E3791 /* RulesProtocol.swift */, 011D959A240451E3000E3791 /* RuleRequiredModel.swift */, 011D959C2404536F000E3791 /* RuleAnyValueChangedModel.swift */, 011D959E240453A1000E3791 /* RuleAllValueChangedModel.swift */, 011D95A0240453D0000E3791 /* RuleEqualsModel.swift */, 011D95A2240453F8000E3791 /* RuleRegexModel.swift */, - 011D95A4240455DC000E3791 /* FormGroupRule.swift */, 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */, ); name = Rules; @@ -855,8 +851,8 @@ 011D95AC2406BB57000E3791 /* FormHolderProtocol.swift */, 011D95AA2405C553000E3791 /* FormItemProtocol.swift */, 011D958624042492000E3791 /* FormFieldProtocol.swift */, - 011D95A824057AC7000E3791 /* FormActionFieldProtocol.swift */, - 011D9601240DA20A000E3791 /* ValidProtocol.swift */, + 011D95A824057AC7000E3791 /* FormGroupWatcherFieldProtocol.swift */, + 011D9601240DA20A000E3791 /* FormRuleWatcherFieldProtocol.swift */, 0105618A224BBE7700E1557D /* FormValidator.swift */, 011D958A24042794000E3791 /* Rules */, ); @@ -1015,8 +1011,6 @@ children = ( D29DF16021E69996003B2FB9 /* MFViewController.h */, D29DF15F21E69996003B2FB9 /* MFViewController.m */, - 017BEB3B2361EA1D0024EF95 /* MFViewController+Model.swift */, - 011D9627240EFA1E000E3791 /* MFViewController+Form.swift */, D29DF28F21E7ADB8003B2FB9 /* MFScrollingViewController.h */, D29DF29021E7ADB8003B2FB9 /* MFScrollingViewController.m */, D29DF29121E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.h */, @@ -1908,12 +1902,11 @@ D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */, 01004F3022721C3800991ECC /* RadioButton.swift in Sources */, D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */, - 017BEB3C2361EA1D0024EF95 /* MFViewController+Model.swift in Sources */, D236E5B7242007C500C38625 /* MVMControllerModelProtocol.swift in Sources */, D282AAB4223FDDAE00C46919 /* MFLoadImageView.swift in Sources */, D29DF11721E6805F003B2FB9 /* UIColor+MFConvenience.m in Sources */, D2B18B7F2360913400A9AEDC /* Control.swift in Sources */, - 011D95A924057AC7000E3791 /* FormActionFieldProtocol.swift in Sources */, + 011D95A924057AC7000E3791 /* FormGroupWatcherFieldProtocol.swift in Sources */, D236E5B4241FEB1000C38625 /* ListTwoColumnPriceDescription.swift in Sources */, 0AA33B3A2398524F0067DD0F /* Toggle.swift in Sources */, D29DF12F21E6851E003B2FB9 /* MVMCoreUITopAlertMainView.m in Sources */, @@ -1935,7 +1928,7 @@ 012A88AD238C418100FE3DA1 /* TemplateProtocol.swift in Sources */, BB6C6AC1242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift in Sources */, D29DF2B421E7B76D003B2FB9 /* MFLoadingSpinner.m in Sources */, - 011D9602240DA20A000E3791 /* ValidProtocol.swift in Sources */, + 011D9602240DA20A000E3791 /* FormRuleWatcherFieldProtocol.swift in Sources */, D260106323D0C05000764D80 /* StackItemModel.swift in Sources */, D2E2A99823D8D63C000B42E6 /* ActionDetailWithImageModel.swift in Sources */, D2E2A99D23DA3217000B42E6 /* UIStackViewAlignment+Extension.swift in Sources */, @@ -2122,7 +2115,6 @@ 94C2D9A123872BCC0006CF46 /* LabelAttributeUnderlineModel.swift in Sources */, D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */, D2B1E3E522F37D6A0065F95C /* ImageHeadlineBody.swift in Sources */, - 011D9628240EFA1E000E3791 /* MFViewController+Form.swift in Sources */, 0A21DB94235E24ED00C160A2 /* DigitEntryField.swift in Sources */, 52B201D224081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift in Sources */, D26C5A6B23F4A40D007AEECE /* ListItemModel.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift index ac9d1dc1..02244a69 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift @@ -18,8 +18,7 @@ public enum ButtonSize: String, Codable { case tiny } -public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormActionFieldProtocol { - +public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWatcherFieldProtocol { public static var identifier: String = "button" public var backgroundColor: Color? public var title: String @@ -33,13 +32,14 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormAction public var disabledFillColor: Color? public var disabledTextColor: Color? public var disabledBorderColor: Color? - public var groupName: String? = FormValidator.defaultGroupName + public var groupName: String = FormValidator.defaultGroupName - public func updateEnable(_ enabled: Bool) { - self.enabled = enabled + public func setValidity(_ valid: Bool, group: FormGroupRule) { + enabled = valid updateUI?() } + /// Temporary binding mechanism for the view to update on enable changes. public var updateUI: (() -> Void)? init(with title: String, action: ActionModelProtocol) { diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift index e3f99862..19f032fc 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift @@ -127,10 +127,12 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { setTitle(model.title, for: .normal) model.updateUI = { [weak self] in - self?.enableField(model.enabled) + MVMCoreDispatchUtility.performBlock(onMainThread: { + self?.enableField(model.enabled) + }) } - FormValidator.setupValidation(molecule: model, delegate: delegateObject?.formHolderDelegate) + FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate) } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/RadioButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButton.swift index 7dd5976a..56466020 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/RadioButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButton.swift @@ -81,7 +81,7 @@ import UIKit } else { isSelected = !isSelected } - FormValidator.validate(delegate: delegateObject?.formHolderDelegate) + _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) setNeedsDisplay() } @@ -130,7 +130,7 @@ import UIKit isSelected = model.state let radioButtonModel = RadioButtonSelectionHelper.setupForRadioButtonGroup(model, formValidator: delegateObject?.formHolderDelegate?.formValidator) - FormValidator.setupValidation(molecule: radioButtonModel, delegate: delegateObject?.formHolderDelegate) + FormValidator.setupValidation(for: radioButtonModel, delegate: delegateObject?.formHolderDelegate) } public override func reset() { diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonModel.swift index 581e03f8..579c0ed9 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonModel.swift @@ -20,11 +20,13 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol { public var state: Bool = false public var enabled: Bool = true - public var baseValue: AnyHashable? - public var groupName: String? - public var fieldKey: String? + /// The specific value to send to server. TODO: update this to be more generic. public var fieldValue: String? + public var baseValue: AnyHashable? + public var groupName: String = FormValidator.defaultGroupName + public var fieldKey: String? + //-------------------------------------------------- // MARK: - Keys //-------------------------------------------------- @@ -34,8 +36,8 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol { case backgroundColor case state case enabled - case fieldKey case fieldValue + case fieldKey case groupName } @@ -45,6 +47,7 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol { public init(_ state: Bool) { self.state = state + baseValue = state } //-------------------------------------------------- @@ -71,8 +74,12 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol { } backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + + baseValue = state fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey) - groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) + if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) { + self.groupName = groupName + } fieldValue = try typeContainer.decodeIfPresent(String.self, forKey: .fieldValue) } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonSelectionHelper.swift b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonSelectionHelper.swift index 263a85a4..a613695a 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonSelectionHelper.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonSelectionHelper.swift @@ -10,10 +10,8 @@ import Foundation import UIKit @objcMembers public class RadioButtonSelectionHelper: FormFieldProtocol { - - public var fieldKey: String? - public var groupName: String? = FormValidator.defaultGroupName + public var groupName: String = FormValidator.defaultGroupName private var selectedRadioButton: RadioButton? private var fieldGroupName: String? public var baseValue: AnyHashable? diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/EntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/TextFields/EntryFieldModel.swift index 54b441f7..729b3516 100644 --- a/MVMCoreUI/Atomic/Atoms/TextFields/EntryFieldModel.swift +++ b/MVMCoreUI/Atomic/Atoms/TextFields/EntryFieldModel.swift @@ -9,7 +9,7 @@ import Foundation -@objcMembers public class EntryFieldModel: MoleculeModelProtocol, FormFieldProtocol, ValidProtocol { +@objcMembers public class EntryFieldModel: MoleculeModelProtocol, FormFieldProtocol, FormRuleWatcherFieldProtocol { //-------------------------------------------------- // MARK: - Properties @@ -26,9 +26,10 @@ import Foundation public var isEnabled: Bool = true public var isLocked: Bool? public var isSelected: Bool? - public var fieldKey: String? - public var groupName: String? = FormValidator.defaultGroupName public var text: String? + + public var fieldKey: String? + public var groupName: String = FormValidator.defaultGroupName public var baseValue: AnyHashable? public var isValid: Bool? { @@ -36,9 +37,12 @@ import Foundation updateUI?() } } + + /// Temporary binding mechanism for the view to update on enable changes. public var updateUI: (() -> Void)? - public func setValidity(_ isValid: Bool) { - self.isValid = isValid + + public func setValidity(_ valid: Bool, rule: RulesProtocol) { + self.isValid = valid } //-------------------------------------------------- @@ -54,10 +58,10 @@ import Foundation case errorMessage = "errorMsg" case isLocked case isSelected - case fieldKey case isValid case isRequired = "required" case text + case fieldKey case groupName } @@ -69,6 +73,11 @@ import Foundation // MARK: - Initializers //-------------------------------------------------- + public init(with text: String) { + self.text = text + baseValue = text + } + required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) @@ -78,12 +87,13 @@ import Foundation isEnabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .isEnabled) ?? true isLocked = try typeContainer.decodeIfPresent(Bool.self, forKey: .isLocked) isSelected = try typeContainer.decodeIfPresent(Bool.self, forKey: .isSelected) - fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey) isValid = try typeContainer.decodeIfPresent(Bool.self, forKey: .isValid) text = try typeContainer.decodeIfPresent(String.self, forKey: .text) - + + baseValue = text + fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey) if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) { - self.groupName = groupName + self.groupName = groupName } } diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/TextEntryField.swift b/MVMCoreUI/Atomic/Atoms/TextFields/TextEntryField.swift index 2ef6f292..ad5f6392 100644 --- a/MVMCoreUI/Atomic/Atoms/TextFields/TextEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/TextFields/TextEntryField.swift @@ -232,7 +232,7 @@ import UIKit /// Validates the text of the entry field. @objc public func validateTextField() { text = textField.text - FormValidator.validate(delegate: delegateObject?.formHolderDelegate) + _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) } @objc public func updateValidation(_ isValid: Bool) { @@ -279,12 +279,14 @@ import UIKit guard let model = model as? TextEntryFieldModel else { return } model.updateUI = { [weak self] in - if self?.isSelected ?? false { - self?.updateValidation(model.isValid ?? true) - } + MVMCoreDispatchUtility.performBlock(onMainThread: { + if self?.isSelected ?? false { + self?.updateValidation(model.isValid ?? true) + } + }) } self.delegateObject = delegateObject - FormValidator.setupValidation(molecule: model, delegate: delegateObject?.formHolderDelegate) + FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate) textColor.enabled = model.enabledTextColor?.uiColor textColor.disabled = model.disabledTextColor?.uiColor text = model.text diff --git a/MVMCoreUI/Atomic/Atoms/Views/Checkbox.swift b/MVMCoreUI/Atomic/Atoms/Views/Checkbox.swift index c76383cb..0ab3bbf3 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Checkbox.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Checkbox.swift @@ -129,7 +129,7 @@ import MVMCore (model as? CheckboxModel)?.isChecked = isSelected shapeLayer?.removeAllAnimations() updateCheckboxUI(isSelected: isSelected, isAnimated: isAnimated) - FormValidator.validate(delegate: delegateObject?.formHolderDelegate) + _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) updateAccessibilityLabel() } } @@ -398,7 +398,7 @@ import MVMCore super.set(with: model, delegateObject, additionalData) guard let model = model as? CheckboxModel else { return } self.delegateObject = delegateObject - FormValidator.setupValidation(molecule: model, delegate: delegateObject?.formHolderDelegate) + FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate) if let fieldKey = model.fieldKey { self.fieldKey = fieldKey diff --git a/MVMCoreUI/Atomic/Atoms/Views/CheckboxModel.swift b/MVMCoreUI/Atomic/Atoms/Views/CheckboxModel.swift index 13b730a6..423ed1ee 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CheckboxModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CheckboxModel.swift @@ -29,10 +29,8 @@ import Foundation public var disabledCheckColor: Color = Color(uiColor: .mvmCoolGray3) public var action: ActionModelProtocol? - public var fieldKey: String? - public var fieldValue: JSONValue? - public var groupName: String? = FormValidator.defaultGroupName + public var groupName: String = FormValidator.defaultGroupName public var baseValue: AnyHashable? //-------------------------------------------------- @@ -41,8 +39,6 @@ import Foundation private enum CodingKeys: String, CodingKey { case moleculeName - case fieldKey - case fieldValue case isChecked = "checked" case isEnabled = "enabled" case isAnimated = "animated" @@ -56,23 +52,25 @@ import Foundation case disabledCheckColor case disabledBorderColor case action + case fieldKey case groupName } - - init(isChecked: Bool = false) {} public func formFieldValue() -> AnyHashable? { return isChecked } + public init(isChecked: Bool = false) { + self.isChecked = isChecked + baseValue = isChecked + } + //-------------------------------------------------- // MARK: - Codec //-------------------------------------------------- required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - fieldValue = try typeContainer.decodeIfPresent(JSONValue.self, forKey: .fieldValue) - fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey) borderWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .borderWidth) ?? 1 borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor) ?? Color(uiColor: .black) checkColor = try typeContainer.decodeIfPresent(Color.self, forKey: .checkColor) ?? Color(uiColor: .black) @@ -86,6 +84,9 @@ import Foundation isRound = try typeContainer.decodeIfPresent(Bool.self, forKey: .isRound) ?? false isEnabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .isEnabled) ?? true action = try typeContainer.decodeModelIfPresent(codingKey: .action) + + baseValue = isChecked + fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey) if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) { self.groupName = groupName } @@ -95,7 +96,6 @@ import Foundation var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) try container.encodeIfPresent(groupName, forKey: .groupName) - try container.encodeIfPresent(fieldValue, forKey: .fieldValue) try container.encodeIfPresent(fieldKey, forKey: .fieldKey) try container.encodeIfPresent(borderColor, forKey: .borderColor) try container.encode(borderWidth, forKey: .borderWidth) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 3d9a2f21..0f7ff8b1 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -102,7 +102,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) } (model as? ToggleModel)?.state = isOn - FormValidator.validate(delegate: delegateObject?.formHolderDelegate) + _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) accessibilityValue = isOn ? MVMCoreUIUtility.hardcodedString(withKey: "AccOn") : MVMCoreUIUtility.hardcodedString(withKey: "AccOff") setNeedsLayout() layoutIfNeeded() @@ -343,7 +343,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) self.model = model self.delegateObject = delegateObject - FormValidator.setupValidation(molecule: toggleModel, delegate: delegateObject?.formHolderDelegate) + FormValidator.setupValidation(for: toggleModel, delegate: delegateObject?.formHolderDelegate) guard let model = model as? ToggleModel else { return } if let color = model.onTintColor?.uiColor { containerTintColor?.on = color diff --git a/MVMCoreUI/Atomic/Atoms/Views/ToggleModel.swift b/MVMCoreUI/Atomic/Atoms/Views/ToggleModel.swift index 334ba00f..b7febf97 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/ToggleModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/ToggleModel.swift @@ -17,14 +17,15 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableMo public var enabled: Bool = true public var action: ActionModelProtocol? public var alternateAction: ActionModelProtocol? - public var fieldKey: String? - public var groupName: String? = FormValidator.defaultGroupName - public var baseValue: AnyHashable? public var onTintColor: Color? public var offTintColor: Color? public var onKnobTintColor: Color? public var offKnobTintColor: Color? + public var fieldKey: String? + public var groupName: String = FormValidator.defaultGroupName + public var baseValue: AnyHashable? + private enum CodingKeys: String, CodingKey { case moleculeName case state @@ -32,13 +33,13 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableMo case enabled case action case backgroundColor - case fieldKey case alternateAction - case groupName case onTintColor case offTintColor case onKnobTintColor case offKnobTintColor + case fieldKey + case groupName } public func formFieldValue() -> AnyHashable? { @@ -47,6 +48,7 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableMo public init(_ state: Bool) { self.state = state + baseValue = state } required public init(from decoder: Decoder) throws { @@ -63,14 +65,16 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableMo action = try typeContainer.decodeModelIfPresent(codingKey: .action) alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey) - if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) { - self.groupName = groupName - } onTintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .onTintColor) offTintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .offTintColor) onKnobTintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .onKnobTintColor) offKnobTintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .offKnobTintColor) + + baseValue = state + fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey) + if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) { + self.groupName = groupName + } } public func encode(to encoder: Encoder) throws { @@ -80,11 +84,11 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableMo try container.encodeModelIfPresent(alternateAction, forKey: .alternateAction) try container.encode(moleculeName, forKey: .moleculeName) try container.encode(state, forKey: .state) - try container.encodeIfPresent(fieldKey, forKey: .fieldKey) - try container.encodeIfPresent(groupName, forKey: .groupName) try container.encodeIfPresent(onTintColor, forKey: .onTintColor) try container.encodeIfPresent(onKnobTintColor, forKey: .onKnobTintColor) try container.encodeIfPresent(onKnobTintColor, forKey: .onKnobTintColor) try container.encodeIfPresent(offKnobTintColor, forKey: .offKnobTintColor) + try container.encodeIfPresent(fieldKey, forKey: .fieldKey) + try container.encodeIfPresent(groupName, forKey: .groupName) } } diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 7a3446d2..024606f4 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -170,8 +170,8 @@ import UIKit navigationModel.line = LineModel(type: .none) } pageModel?.navigationItem = navigationModel - if self.formValidator == nil { - let rules = pageModel?.formRules + if self.formValidator == nil, + let rules = pageModel?.formRules { self.formValidator = FormValidator(rules) } } @@ -244,7 +244,7 @@ import UIKit } open func updateViews() { - formValidator?.validate() + _ = formValidator?.validate() } override open func viewDidLoad() { diff --git a/MVMCoreUI/FormUIHelpers/FormActionFieldProtocol.swift b/MVMCoreUI/FormUIHelpers/FormActionFieldProtocol.swift deleted file mode 100644 index 31208e95..00000000 --- a/MVMCoreUI/FormUIHelpers/FormActionFieldProtocol.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// FormActionFieldProtocol.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 1/31/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -public protocol FormActionFieldProtocol: EnableableModelProtocol, FormItemProtocol { - func updateEnable(_ enabled: Bool) - var updateUI: (() -> Void)? { get set } -} diff --git a/MVMCoreUI/FormUIHelpers/FormFieldProtocol.swift b/MVMCoreUI/FormUIHelpers/FormFieldProtocol.swift index c59ccd08..b9d2defe 100644 --- a/MVMCoreUI/FormUIHelpers/FormFieldProtocol.swift +++ b/MVMCoreUI/FormUIHelpers/FormFieldProtocol.swift @@ -5,13 +5,19 @@ // Created by Suresh, Kamlesh on 1/31/20. // Copyright © 2020 Verizon Wireless. All rights reserved. // +// Form fields are items can be interacted with. They have value, and may need to be validated. import Foundation public protocol FormFieldProtocol: FormItemProtocol { + /// How the validator identifies the field when validating rules. var fieldKey: String? { get set } + + /// A place to store the initial value of the field for checking if the value has changed. var baseValue: AnyHashable? { get set } + + /// Returns the value of the field. Used for validations and possibly for sending to server. func formFieldValue() -> AnyHashable? } diff --git a/MVMCoreUI/FormUIHelpers/FormGroupWatcherFieldProtocol.swift b/MVMCoreUI/FormUIHelpers/FormGroupWatcherFieldProtocol.swift new file mode 100644 index 00000000..624ea374 --- /dev/null +++ b/MVMCoreUI/FormUIHelpers/FormGroupWatcherFieldProtocol.swift @@ -0,0 +1,14 @@ +// +// FormGroupWatcherFieldProtocol.swift +// MVMCoreUI +// +// Created by Suresh, Kamlesh on 1/31/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// +// Fields that want to be informed of group validity. + +import Foundation + +public protocol FormGroupWatcherFieldProtocol: FormItemProtocol { + func setValidity(_ valid: Bool, group: FormGroupRule) +} diff --git a/MVMCoreUI/FormUIHelpers/FormHolderModelProtocol.swift b/MVMCoreUI/FormUIHelpers/FormHolderModelProtocol.swift index a9428a2b..b548024c 100644 --- a/MVMCoreUI/FormUIHelpers/FormHolderModelProtocol.swift +++ b/MVMCoreUI/FormUIHelpers/FormHolderModelProtocol.swift @@ -5,7 +5,7 @@ // Created by Suresh, Kamlesh on 2/5/20. // Copyright © 2020 Verizon Wireless. All rights reserved. // -// A protocol for the model of the delegate object that holds the form validator. The rules are stored in the model. +// A protocol for the model of the delegate object that holds the form validator. The rules that need to be validated are stored in the model. import Foundation diff --git a/MVMCoreUI/FormUIHelpers/FormItemProtocol.swift b/MVMCoreUI/FormUIHelpers/FormItemProtocol.swift index 9b671238..0c7f71bd 100644 --- a/MVMCoreUI/FormUIHelpers/FormItemProtocol.swift +++ b/MVMCoreUI/FormUIHelpers/FormItemProtocol.swift @@ -5,15 +5,11 @@ // Created by Suresh, Kamlesh on 2/25/20. // Copyright © 2020 Verizon Wireless. All rights reserved. // +// The base form item protocol. Shared by different types of items. In our case, the models (not views) are form items which are registered with the validator. import Foundation public protocol FormItemProtocol { - static var defaultGroupName: String? { get } - var groupName: String? { get set } -} -extension FormItemProtocol{ - public static var defaultGroupName: String? { - return "default" - } + /// The group name to used to group this item for validation, enableability, and value getting. + var groupName: String { get set } } diff --git a/MVMCoreUI/FormUIHelpers/FormRuleWatcherFieldProtocol.swift b/MVMCoreUI/FormUIHelpers/FormRuleWatcherFieldProtocol.swift new file mode 100644 index 00000000..3fc47d25 --- /dev/null +++ b/MVMCoreUI/FormUIHelpers/FormRuleWatcherFieldProtocol.swift @@ -0,0 +1,14 @@ +// +// FormRuleWatcherFieldProtocol.swift +// MVMCoreUI +// +// Created by Suresh, Kamlesh on 3/2/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// +// Fields that want to be informed of rule validity. + +import Foundation + +public protocol FormRuleWatcherFieldProtocol { + func setValidity(_ valid: Bool, rule: RulesProtocol) +} diff --git a/MVMCoreUI/FormUIHelpers/FormValidator.swift b/MVMCoreUI/FormUIHelpers/FormValidator.swift index 0a14e027..a38b4b3f 100644 --- a/MVMCoreUI/FormUIHelpers/FormValidator.swift +++ b/MVMCoreUI/FormUIHelpers/FormValidator.swift @@ -12,103 +12,118 @@ import MVMCore @objcMembers public class FormValidator: NSObject { static var defaultGroupName: String = "default" - var extraValidationBlock: (() -> Bool)? - var formRules: [FormGroupRule]? + var formRules: [FormGroupRule] weak var delegate: FormHolderProtocol? - var fieldMolecules: [String: FormFieldProtocol] = [:] - var formActionMolecules: [FormActionFieldProtocol] = [] + var fields: [String: FormFieldProtocol] = [:] + var groupWatchers: [FormGroupWatcherFieldProtocol] = [] var radioButtonsModelByGroup: [String: RadioButtonSelectionHelper] = [:] - public init(_ formRules: [FormGroupRule]?) { + public init(_ formRules: [FormGroupRule]) { self.formRules = formRules } - public func insertMolecule(_ molecule: FormItemProtocol) { - if var molecule = molecule as? FormFieldProtocol, - let fieldKey = molecule.fieldKey { - if molecule.baseValue == nil { - molecule.baseValue = molecule.formFieldValue() - } - fieldMolecules[fieldKey] = molecule - } - if let molecule = molecule as? FormActionFieldProtocol { - formActionMolecules.append(molecule) + /// Adds the form field to the validator. + public func add(_ field: FormFieldProtocol) { + if let fieldKey = field.fieldKey { + fields[fieldKey] = field } } - public static func setupValidation(molecule: FormItemProtocol, delegate: FormHolderProtocol?) { + /// Adds the form action to the validator. + public func add(_ action: FormGroupWatcherFieldProtocol) { + groupWatchers.append(action) + } + + /// Determines the type of item and adds it. + private func insert(_ item: FormItemProtocol) { + if let item = item as? FormFieldProtocol { + add(item) + } else if let item = item as? FormGroupWatcherFieldProtocol { + add(item) + } + } + + /// Convenience function. Gets the form validator from the holder and sets up the item with it. + public static func setupValidation(for item: FormItemProtocol, delegate: FormHolderProtocol?) { if let validator = delegate?.formValidator { validator.delegate = delegate - validator.insertMolecule(molecule) + validator.insert(item) } } + + /// Convenience function. Gets the form validator from the holder and asks it to validate. + public static func validate(delegate: FormHolderProtocol?) -> Bool? { + return delegate?.formValidator?.validate() + } + + /// Validates all rule groups. Returns if valid + public func validate() -> Bool { + var valid = true + for group in formRules { + valid = valid && validateGroup(group) + } + return valid + } + + /// Validates a given rule group. Returns if valid + public func validateGroup(_ group: FormGroupRule) -> Bool { + // Validate each rule. + var valid = true + for rule in group.rules { + valid = valid && validateRule(rule) + } + + // Notify the group watchers of validity. + for watcher in groupWatchers { + if watcher.groupName == group.groupName { + watcher.setValidity(valid, group: group) + } + } + + return valid + } - public static func getFormValidatorFor(delegate: FormHolderProtocol?) -> FormValidator? { - return delegate?.formValidator - } - - public static func validate(delegate: FormHolderProtocol?) { - delegate?.formValidator?.validate() - } - - public func validate() { - guard let formRules = formRules else { - return - } - formActionMolecules.forEach { (actionModel) in - if let groupName = actionModel.groupName, - let formRule = formRules.first(where: { $0.groupName == groupName }) { - validate(groupName, actionModel, formRule.rules) - } - } - } - - public func validate(_ groupName: String, _ actionModel: FormActionFieldProtocol, _ rules: [RulesProtocol]) { + /// Validates a given rule. Returns if valid. + public func validateRule(_ rule: RulesProtocol) -> Bool { var valid = true - for rule in rules { - valid = valid && rule.isValid(fieldMolecules) - if !valid { - break - } + for formKey in rule.fields { + guard let formField = fields[formKey] else { continue } + let fieldValidity = rule.isValid(formField) + (formField as? FormRuleWatcherFieldProtocol)?.setValidity(fieldValidity, rule: rule) + valid = valid && fieldValidity } - actionModel.updateEnable(valid) - } - - public func formField(for fieldKey: String) -> FormFieldProtocol? { - return fieldMolecules[fieldKey] + return valid } } -// mark Form params +// mark Form params +// TODO: Temporary hacks, rewrite architecture to support this. @objc public extension FormValidator { @objc func addFormParams(requestParameters: MVMCoreRequestParameters) { - let formButton = getFormButton(forPageType: requestParameters.pageType) - let groupName = formButton?.groupName ?? FormValidator.defaultGroupName + let groupName = getGroupName(forPageType: requestParameters.pageType) ?? FormValidator.defaultGroupName let formParams = self.getFormParams(forGroup: groupName) requestParameters.add(formParams) } @objc func getFormParams( forGroup groupName: String) -> [String: Any] { var extraParam: [String: Any] = [:] - MVMCoreDispatchUtility.performSyncBlock(onMainThread: { - for (fieldKey, molecule) in self.fieldMolecules { - if let formFieldValue = molecule.formFieldValue(), - groupName == molecule.groupName { - extraParam[fieldKey] = formFieldValue - } + for (fieldKey, field) in fields { + if let formFieldValue = field.formFieldValue(), + groupName == field.groupName { + extraParam[fieldKey] = formFieldValue } - }) + } return extraParam } } -// Temporary +// TODO: Temporary hacks, rewrite architecture to support this. public extension FormValidator { - func getFormButton(forPageType pageType: String?) -> ButtonModel? { - for actionItem in formActionMolecules { + func getGroupName(forPageType pageType: String?) -> String? { + for actionItem in groupWatchers { if let buttonModel = actionItem as? ButtonModel, pageType == (buttonModel.action as? ActionOpenPageModel)?.pageType { - return buttonModel + return buttonModel.groupName } } return nil diff --git a/MVMCoreUI/FormUIHelpers/Rules/Rules/FormGroupRule.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/FormGroupRule.swift index 34dfb7b8..b40d0460 100644 --- a/MVMCoreUI/FormUIHelpers/Rules/Rules/FormGroupRule.swift +++ b/MVMCoreUI/FormUIHelpers/Rules/Rules/FormGroupRule.swift @@ -5,6 +5,7 @@ // Created by Suresh, Kamlesh on 2/24/20. // Copyright © 2020 Verizon Wireless. All rights reserved. // +// Used by the form validator for storing the rules for a particular group. import Foundation diff --git a/MVMCoreUI/FormUIHelpers/Rules/Rules/RulesProtocol.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/RulesProtocol.swift index 25119e03..6afe5b17 100644 --- a/MVMCoreUI/FormUIHelpers/Rules/Rules/RulesProtocol.swift +++ b/MVMCoreUI/FormUIHelpers/Rules/Rules/RulesProtocol.swift @@ -14,16 +14,19 @@ public enum RulesCodingKey: String, CodingKey { } public protocol RulesProtocol: ModelProtocol { - var type: String { get set } + // The type of rule + var type: String { get } + + // The fields that this rule applies to. var fields: [String] { get set } - func isValid(_ fieldMolecules: [String: FormFieldProtocol]) -> Bool + + // Returns if a given field is valid according to the rule func isValid(_ formField: FormFieldProtocol) -> Bool - func setValid(_ formField: FormFieldProtocol, _ isValid: Bool) } public extension RulesProtocol { - var ruleType: String? { + var type: String { get { return Self.identifier } } @@ -34,23 +37,4 @@ public extension RulesProtocol { static var categoryName: String { return "\(RulesProtocol.self)" } - - func isValid(_ fieldMolecules: [String: FormFieldProtocol]) -> Bool { - var valid = true - - for formKey in fields { - guard let formField = fieldMolecules[formKey] else { continue } - let fieldValidity = isValid(formField) - setValid(formField, fieldValidity) - valid = valid && fieldValidity - } - - return valid - } - - func setValid(_ formField: FormFieldProtocol, _ isValid: Bool) { - guard let formFieldValid = formField as? ValidProtocol else { return } - - formFieldValid.setValidity(isValid) - } } diff --git a/MVMCoreUI/FormUIHelpers/ValidProtocol.swift b/MVMCoreUI/FormUIHelpers/ValidProtocol.swift deleted file mode 100644 index 20afd256..00000000 --- a/MVMCoreUI/FormUIHelpers/ValidProtocol.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// ValidProtocol.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 3/2/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -public protocol ValidProtocol { - var isValid: Bool? { get set } - func setValidity(_ isValid: Bool) - var updateUI: (() -> Void)? { get set } -} diff --git a/MVMCoreUI/Legacy/Controllers/MFViewController+Form.swift b/MVMCoreUI/Legacy/Controllers/MFViewController+Form.swift deleted file mode 100644 index 2c3b14bf..00000000 --- a/MVMCoreUI/Legacy/Controllers/MFViewController+Form.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// MFViewController+Form.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 3/3/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -extension MFViewController: ObservingTextFieldDelegate { -} - -public extension MFViewController { - @objc func startValidation() { - (self as? FormHolderProtocol)?.formValidator?.validate() - } - - @objc func addFormParams(requestParameters: MVMCoreRequestParameters) { - (self as? FormHolderProtocol)?.formValidator?.addFormParams(requestParameters: requestParameters) - } -} diff --git a/MVMCoreUI/Legacy/Controllers/MFViewController+Model.swift b/MVMCoreUI/Legacy/Controllers/MFViewController+Model.swift deleted file mode 100644 index 30abf59d..00000000 --- a/MVMCoreUI/Legacy/Controllers/MFViewController+Model.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// MFViewController+Model.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 10/24/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - -extension MFViewController: MoleculeDelegateProtocol { - - public func getModuleWithName(_ name: String?) -> [AnyHashable: Any]? { - guard let name = name else { return nil } - - return loadObject?.modulesJSON?.optionalDictionaryForKey(name) - } - - public func getModuleWithName(_ moleculeName: String) -> MoleculeModelProtocol? { - guard let moduleJSON = loadObject?.modulesJSON?.optionalDictionaryForKey(moleculeName), - let moleculeName = moduleJSON.optionalStringForKey("moleculeName"), - let modelType = ModelRegistry.getType(for: moleculeName, with: MoleculeModelProtocol.self) - else { return nil } - - do { - return try modelType.decode(jsonDict: moduleJSON) as? MoleculeModelProtocol - } catch { - MVMCoreUILoggingHandler.logDebugMessage(withDelegate: "error: \(error)") - } - - return nil - } - - // These are required because swift will call the extension function otherwise. - public func moleculeLayoutUpdated(_ molecule: MoleculeViewProtocol) {} - - @objc public func addMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {} - @objc public func addMolecules(_ molecules: [[AnyHashable : Any]], indexPath: IndexPath, animation: UITableView.RowAnimation) {} - @objc public func removeMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {} -} diff --git a/MVMCoreUI/Legacy/Controllers/MFViewController.m b/MVMCoreUI/Legacy/Controllers/MFViewController.m index febb14cf..68dd75c4 100644 --- a/MVMCoreUI/Legacy/Controllers/MFViewController.m +++ b/MVMCoreUI/Legacy/Controllers/MFViewController.m @@ -467,9 +467,6 @@ - (void)newDataBuildAndUpdate { [MVMCoreDispatchUtility performBlockOnMainThread:^{ [self newDataBuildScreen]; - dispatch_async(dispatch_get_main_queue(), ^{ - [self startValidation]; - }); self.needToUpdateUI = YES; [self.view setNeedsLayout]; }]; @@ -666,8 +663,6 @@ if (requestParameters.openSupportPanel) { [[MVMCoreUISession sharedGlobal].splitViewController.rightPanel willOpenWithActionInformation:actionInformation]; } - - [self addFormParamsWithRequestParameters:requestParameters]; requestParameters.parentPageType = [self.loadObject.pageJSON stringForKey:@"parentPageType"]; [[MVMCoreLoadHandler sharedGlobal] loadRequest:requestParameters dataForPage:additionalData delegateObject:[self delegateObject]]; } From 11069d3f7342bf7d64d2c403c8784e6c3ac9b83e Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Wed, 25 Mar 2020 12:59:26 -0400 Subject: [PATCH 12/61] add convenience initializers for creating a legacy footer --- MVMCoreUI.xcodeproj/project.pbxproj | 20 +++++++++++ MVMCoreUI/Atoms/Buttons/ButtonModel.swift | 6 ++-- .../Legacy/Adapters/ActionModelAdapter.swift | 20 +++++++++++ .../Legacy/Adapters/FooterModelAdapter.swift | 36 +++++++++++++++++++ .../Legacy/Adapters/LabelModelAdapter.swift | 33 +++++++++++++++++ 5 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift create mode 100644 MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift create mode 100644 MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 5308ee86..0108ffc0 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -110,6 +110,9 @@ 0AE98BB323FF0934004C5109 /* ExternalLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */; }; 0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB423FF18D2004C5109 /* Arrow.swift */; }; 0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */; }; + 279B1567242BBBF200921D6C /* LabelModelAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279B1566242BBBF200921D6C /* LabelModelAdapter.swift */; }; + 279B1569242BBC2F00921D6C /* ActionModelAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */; }; + 279B156D242BBFF100921D6C /* FooterModelAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279B156C242BBFF100921D6C /* FooterModelAdapter.swift */; }; 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */; }; 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; }; 522679C123FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */; }; @@ -502,6 +505,9 @@ 0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalLinkModel.swift; sourceTree = ""; }; 0AE98BB423FF18D2004C5109 /* Arrow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Arrow.swift; sourceTree = ""; }; 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrowModel.swift; sourceTree = ""; }; + 279B1566242BBBF200921D6C /* LabelModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelModelAdapter.swift; sourceTree = ""; }; + 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionModelAdapter.swift; sourceTree = ""; }; + 279B156C242BBFF100921D6C /* FooterModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterModelAdapter.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 = ""; }; 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = ""; }; @@ -917,6 +923,16 @@ path = Link; sourceTree = ""; }; + 279B1565242BBB8500921D6C /* Adapters */ = { + isa = PBXGroup; + children = ( + 279B1566242BBBF200921D6C /* LabelModelAdapter.swift */, + 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */, + 279B156C242BBFF100921D6C /* FooterModelAdapter.swift */, + ); + path = Adapters; + sourceTree = ""; + }; 5206F150241144A900658DC5 /* Headers */ = { isa = PBXGroup; children = ( @@ -1260,6 +1276,7 @@ D22D1F582204D2590077CEC0 /* Legacy */ = { isa = PBXGroup; children = ( + 279B1565242BBB8500921D6C /* Adapters */, D213347523842FF5008E41B3 /* Views */, D213347423842FE3008E41B3 /* Controllers */, ); @@ -2088,6 +2105,7 @@ C7F8012123E8303200396FBD /* ListRVWheel.swift in Sources */, D29DF29521E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.m in Sources */, D2FB151B23A2B65B00C20E10 /* MoleculeContainer.swift in Sources */, + 279B1569242BBC2F00921D6C /* ActionModelAdapter.swift in Sources */, BB6C6AC0242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift in Sources */, D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */, D29DF16121E69996003B2FB9 /* MFViewController.m in Sources */, @@ -2113,6 +2131,7 @@ D29DF28C21E7AC2B003B2FB9 /* ViewConstrainingView.m in Sources */, 0AE14F64238315D2005417F8 /* TextField.swift in Sources */, D29DF17B21E69E1F003B2FB9 /* PrimaryButton.m in Sources */, + 279B1567242BBBF200921D6C /* LabelModelAdapter.swift in Sources */, D2C78CD224228BBD00B69FDE /* ActionOpenPanelModel.swift in Sources */, 017BEB4A236235BA0024EF95 /* ModelMoleculeViewProtocol.swift in Sources */, C695A68123C9830D00BFB94E /* NumberedListModel.swift in Sources */, @@ -2203,6 +2222,7 @@ 01509D932327ECFB00EF99AA /* ProgressBar.swift in Sources */, D260106523D0CEA700764D80 /* StackModel.swift in Sources */, D29770F521F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.m in Sources */, + 279B156D242BBFF100921D6C /* FooterModelAdapter.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MVMCoreUI/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atoms/Buttons/ButtonModel.swift index ac9d1dc1..f441ef64 100644 --- a/MVMCoreUI/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atoms/Buttons/ButtonModel.swift @@ -42,18 +42,18 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormAction public var updateUI: (() -> Void)? - init(with title: String, action: ActionModelProtocol) { + public init(with title: String, action: ActionModelProtocol) { self.title = title self.action = action } - init(secondaryButtonWith title: String, action: ActionModelProtocol) { + public init(secondaryButtonWith title: String, action: ActionModelProtocol) { self.title = title self.action = action style = .secondary } - init(primaryButtonWith title: String, action: ActionModelProtocol) { + public init(primaryButtonWith title: String, action: ActionModelProtocol) { self.title = title self.action = action style = .primary diff --git a/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift new file mode 100644 index 00000000..ba0ce96b --- /dev/null +++ b/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift @@ -0,0 +1,20 @@ +// +// ActionModelAdapter.swift +// MVMCoreUI +// +// Created by Kyle on 3/25/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +public extension Dictionary { + + func asActionModel() -> ActionModelProtocol? { + guard let castedSelf = self as? [String: Any], + let actionType = ModelRegistry.getType(for: castedSelf.stringForkey(KeyActionType), with: ActionModelProtocol.self), + let actionModel = try? actionType.decode(jsonDict: castedSelf) as? ActionModelProtocol else { + return nil + } + return actionModel + } + +} diff --git a/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift new file mode 100644 index 00000000..7c923ba0 --- /dev/null +++ b/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift @@ -0,0 +1,36 @@ +// +// FooterModelAdapter.swift +// MVMCoreUI +// +// Created by Kyle on 3/25/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +public extension FooterModel { + + convenience init(withPrimaryAction primaryMap: [AnyHashable: Any]? = nil, secondaryAction secondaryMap: [AnyHashable: Any]? = nil, bottomLinkAction linkMap: [AnyHashable: Any]? = nil) { + + var primaryButtonModel: ButtonModel? + var secondaryButtonModel: ButtonModel? + if let primaryActionModel = primaryMap?.asActionModel() { + primaryButtonModel = ButtonModel(primaryButtonWith: primaryActionModel.title ?? "", action: primaryActionModel) + } + if let secondaryActionModel = secondaryMap?.asActionModel() { + secondaryButtonModel = ButtonModel(secondaryButtonWith: secondaryActionModel.title ?? "", action: secondaryActionModel) + } + let twoButtonModel = TwoButtonViewModel(primaryButtonModel, secondaryButtonModel) + + let footerContentModel: MoleculeModelProtocol + if let linkActionJSON = linkMap { + let labelModel = LabelModel(linkAction: linkActionJSON) + let moleculeStack = MoleculeStackModel(molecules: [MoleculeStackItemModel(with: twoButtonModel), MoleculeStackItemModel(with: labelModel)]) + moleculeStack.spacing = MFStyler.defaultVerticalPaddingForApplicationWidth() + footerContentModel = moleculeStack + } else { + footerContentModel = twoButtonModel + } + + self.init(with: footerContentModel) + } + +} diff --git a/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift new file mode 100644 index 00000000..757b2ccb --- /dev/null +++ b/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift @@ -0,0 +1,33 @@ +// +// LabelModelAdapter.swift +// MVMCoreUI +// +// Created by Kyle on 3/25/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +public extension LabelModel { + + convenience init(linkAction: [AnyHashable: Any]) { + // Concatentate the text. + var titlePrefix = linkAction.stringForkey(KeyTitlePrefix) + var titlePostfix = linkAction.stringForkey(KeyTitlePostfix) + if !titlePrefix.isEmpty { + titlePrefix += " " + } + if !titlePostfix.isEmpty { + titlePostfix += " " + } + let title = linkAction.optionalStringForKey(KeyTitle) ?? "" + let text = "\(titlePrefix)\(title)\(titlePostfix)" + + // Initialize with text. + self.init(text: text) + + // Add action attribute. + if let linkActionModel = linkAction.asActionModel() { + attributes = [LabelAttributeActionModel(titlePrefix.isEmpty ? 0 : titlePrefix.count, title.count, action: linkActionModel)] + } + } + +} From f2f2b179dd6a91e059f411281174bcbafde17496 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Wed, 25 Mar 2020 17:34:47 -0400 Subject: [PATCH 13/61] link only handling --- MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift index 7c923ba0..449227e3 100644 --- a/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift +++ b/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift @@ -23,9 +23,13 @@ public extension FooterModel { let footerContentModel: MoleculeModelProtocol if let linkActionJSON = linkMap { let labelModel = LabelModel(linkAction: linkActionJSON) - let moleculeStack = MoleculeStackModel(molecules: [MoleculeStackItemModel(with: twoButtonModel), MoleculeStackItemModel(with: labelModel)]) - moleculeStack.spacing = MFStyler.defaultVerticalPaddingForApplicationWidth() - footerContentModel = moleculeStack + if primaryButtonModel != nil || secondaryButtonModel != nil { + let moleculeStack = MoleculeStackModel(molecules: [MoleculeStackItemModel(with: twoButtonModel), MoleculeStackItemModel(with: labelModel)]) + moleculeStack.spacing = MFStyler.defaultVerticalPaddingForApplicationWidth() + footerContentModel = moleculeStack + } else { + footerContentModel = labelModel + } } else { footerContentModel = twoButtonModel } From 4846d7ff8719579292230eff0a10074c1f5543bb Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 26 Mar 2020 17:33:47 +0530 Subject: [PATCH 14/61] Code cleanup - spacing issues. --- .../ListRightVariableTextLinkAllTextAndLinks.swift | 6 +++--- .../ListRightVariableTextLinkAllTextAndLinksModel.swift | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift index d9d04205..5f2bfcfc 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift @@ -15,10 +15,10 @@ import Foundation public var stack: Stack public let link = Link(frame: .zero) public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) - // MARK: - Initializers + // MARK: - Initializers public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(spacing: 5,horizontalAlignment: .leading)), + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading)), (view: link, model: StackItemModel( horizontalAlignment:.fill, verticalAlignment: .top))],axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -36,7 +36,7 @@ import Foundation stack.restack() } - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? ListRightVariableTextLinkAllTextAndLinksModel else { return } link.set(with: model.link, delegateObject, additionalData) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift index 7541d38d..9f6392fc 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift @@ -7,7 +7,7 @@ // import Foundation -public class ListRightVariableTextLinkAllTextAndLinksModel: ListItemModel,MoleculeModelProtocol{ +public class ListRightVariableTextLinkAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { public static var identifier: String = "listRVLink" public var link: LinkModel public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel From c7344b166dd7d202aa5e35bfe4ace6e1baccdbc4 Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Fri, 27 Mar 2020 18:23:03 +0530 Subject: [PATCH 15/61] MF-18985 - ListFourColumnDataUsageListItem --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + .../ListFourColumnDataUsageListItem.swift | 72 +++++++++++++++++++ ...ListFourColumnDataUsageListItemModel.swift | 64 +++++++++++++++++ 4 files changed, 145 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItemModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 03335a4d..ddf36e4b 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -130,6 +130,8 @@ 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */; }; 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; + 8D4687E2242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D4687E1242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift */; }; + 8D4687E4242E2DF300802879 /* ListFourColumnDataUsageListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D4687E3242E2DF300802879 /* ListFourColumnDataUsageListItem.swift */; }; 942C372E241149170066E45E /* NHaasGroteskDSStd-75Bd.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */; }; 942C372F241149170066E45E /* NHaasGroteskDSStd-55Rg.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */; }; 942C378C2412F4FA0066E45E /* ModalMoleculeListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 942C378B2412F4FA0066E45E /* ModalMoleculeListTemplate.swift */; }; @@ -514,6 +516,8 @@ 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretModel.swift; sourceTree = ""; }; 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; + 8D4687E1242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageListItemModel.swift; sourceTree = ""; }; + 8D4687E3242E2DF300802879 /* ListFourColumnDataUsageListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageListItem.swift; sourceTree = ""; }; 9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftRightLabelModel.swift; sourceTree = ""; }; 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NHaasGroteskDSStd-75Bd.otf"; sourceTree = ""; }; 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NHaasGroteskDSStd-55Rg.otf"; sourceTree = ""; }; @@ -919,6 +923,8 @@ children = ( 525019E42406852100EED91C /* ListFourColumnDataUsageDividerModel.swift */, 525019E62406853600EED91C /* ListFourColumnDataUsageDivider.swift */, + 8D4687E1242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift */, + 8D4687E3242E2DF300802879 /* ListFourColumnDataUsageListItem.swift */, ); path = FourColumn; sourceTree = ""; @@ -2029,6 +2035,7 @@ D2D6CD4222E78FAB00D701B8 /* ThreeLayerTemplate.swift in Sources */, 01EB368F23609801006832FA /* LabelModel.swift in Sources */, 942C378E2412F5B60066E45E /* ModalMoleculeStackTemplate.swift in Sources */, + 8D4687E4242E2DF300802879 /* ListFourColumnDataUsageListItem.swift in Sources */, 01F2A03223A4498200D954D8 /* CaretLinkModel.swift in Sources */, 0A7BAFA1232BE61800FB8E22 /* Checkbox.swift in Sources */, 011B58F023A2AA980085F53C /* ListItemModelProtocol.swift in Sources */, @@ -2168,6 +2175,7 @@ BB6C6AC924225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift in Sources */, C695A69423C9909000BFB94E /* DoughnutChartModel.swift in Sources */, D29DF32421ED0DA2003B2FB9 /* TextButtonView.m in Sources */, + 8D4687E2242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift in Sources */, D29E28DD23D7404C00ACEA85 /* ContainerHelper.swift in Sources */, 012A88C2238D7BCA00FE3DA1 /* CarouselItemModel.swift in Sources */, D29DF29E21E7AE3B003B2FB9 /* MFStyler.m in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index bfa6db01..02829367 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -136,6 +136,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) // Designed Section Dividers MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift new file mode 100644 index 00000000..5eb0664d --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift @@ -0,0 +1,72 @@ +// +// ListFourColumnDataUsageListItem.swift +// MVMCoreUI +// +// Created by Kruthika KP on 27/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers public class ListFourColumnDataUsageListItem: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + var stack: Stack + let label1 = Label.commonLabelB2(true) + let label2 = Label.commonLabelB2(true) + let label3 = Label.commonLabelB2(true) + let label4 = Label.commonLabelB2(true) + let arrow = Arrow(frame: .zero) + + //----------------------------------------------------- + // MARK: - Initializers + //----------------------------------------------------- + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: label1, model: StackItemModel(percent: 19, horizontalAlignment: .leading)), + (view: arrow, model: StackItemModel(percent: 4, horizontalAlignment: .leading)), + (view: label2, model: StackItemModel(percent: 40, horizontalAlignment: .leading)), + (view: label3, model: StackItemModel(percent:17,horizontalAlignment: .leading)), + (view: label4, model: StackItemModel(percent:20,horizontalAlignment: .leading))], + axis: .horizontal,spacing: 2) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //----------------------------------------------------- + // MARK: - View Lifecycle + //----------------------------------------------------- + override open func setupView() { + super.setupView() + addMolecule(stack) + arrow.pinHeightAndWidth() + } + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListFourColumnDataUsageListItemModel else { return } + label1.set(with: model.label1, delegateObject, additionalData) + label2.set(with: model.label2, delegateObject, additionalData) + label3.set(with: model.label3, delegateObject, additionalData) + label4.set(with: model.label4, delegateObject, additionalData) + arrow.set(with: model.arrow, delegateObject, additionalData) + stack.restack() + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 121 + } + + open override func reset() { + super.reset() + label1.styleB2(true) + label2.styleB2(true) + label3.styleB2(true) + label4.styleB2(true) + arrow.reset() + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItemModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItemModel.swift new file mode 100644 index 00000000..dd9e8fa6 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItemModel.swift @@ -0,0 +1,64 @@ +// +// ListFourColumnDataUsageListItemModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 27/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListFourColumnDataUsageListItemModel: ListItemModel, MoleculeModelProtocol { + + public static var identifier: String = "list4C" + public var label1: LabelModel + public var label2: LabelModel + public var label3: LabelModel + public var label4: LabelModel + public var arrow: ArrowModel + + public init(label1:LabelModel, label2:LabelModel, label3:LabelModel,label4:LabelModel, arrow:ArrowModel) { + self.label1 = label1 + self.label2 = label2 + self.label3 = label3 + self.label4 = label4 + self.arrow = arrow + super.init() + } + + public override func setDefaults() { + super.setDefaults() + style = "header" + arrow.degrees = 50 + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case label1 + case label2 + case label3 + case label4 + case arrow + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + label1 = try typeContainer.decode(LabelModel.self, forKey: .label1) + label2 = try typeContainer.decode(LabelModel.self, forKey: .label2) + label3 = try typeContainer.decode(LabelModel.self, forKey: .label3) + label4 = try typeContainer.decode(LabelModel.self, forKey: .label4) + arrow = try typeContainer.decode(ArrowModel.self, forKey: .arrow) + 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(label1, forKey: .label1) + try container.encode(label2, forKey: .label2) + try container.encode(label3, forKey: .label3) + try container.encode(label4, forKey: .label4) + try container.encode(arrow, forKey: .arrow) + } +} From 710adec0379d2570a881701d2d205e14a62e6ed5 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Mon, 30 Mar 2020 10:58:47 -0400 Subject: [PATCH 16/61] add web view --- MVMCoreUI.xcodeproj/project.pbxproj | 8 + MVMCoreUI/Atomic/Atoms/Views/WebView.swift | 181 ++++++++++++++++++ .../Atomic/Atoms/Views/WebViewModel.swift | 55 ++++++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + 4 files changed, 245 insertions(+) create mode 100644 MVMCoreUI/Atomic/Atoms/Views/WebView.swift create mode 100644 MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 03335a4d..9a942945 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -137,6 +137,8 @@ 9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9432A79E23DB47BA00719041 /* EntryFieldContainer.swift */; }; 943784F5236B77BB006A1E82 /* GraphView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F3236B77BB006A1E82 /* GraphView.swift */; }; 943784F6236B77BB006A1E82 /* GraphViewAnimationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */; }; + 943820842432382400B43AF3 /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943820832432382400B43AF3 /* WebView.swift */; }; + 94382086243238D100B43AF3 /* WebViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94382085243238D100B43AF3 /* WebViewModel.swift */; }; 9445890C2385BCE300DE9FD4 /* ProgressBarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9445890B2385BCE300DE9FD4 /* ProgressBarModel.swift */; }; 9445890E2385C3F800DE9FD4 /* MultiProgressModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9445890D2385C3F800DE9FD4 /* MultiProgressModel.swift */; }; 9445891F2385D2E900DE9FD4 /* CaretViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9445891E2385D2E900DE9FD4 /* CaretViewModel.swift */; }; @@ -522,6 +524,8 @@ 9432A79E23DB47BA00719041 /* EntryFieldContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EntryFieldContainer.swift; sourceTree = ""; }; 943784F3236B77BB006A1E82 /* GraphView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphView.swift; sourceTree = ""; }; 943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphViewAnimationHandler.swift; sourceTree = ""; }; + 943820832432382400B43AF3 /* WebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = ""; }; + 94382085243238D100B43AF3 /* WebViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewModel.swift; sourceTree = ""; }; 9445890B2385BCE300DE9FD4 /* ProgressBarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarModel.swift; sourceTree = ""; }; 9445890D2385C3F800DE9FD4 /* MultiProgressModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiProgressModel.swift; sourceTree = ""; }; 9445891E2385D2E900DE9FD4 /* CaretViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CaretViewModel.swift; sourceTree = ""; }; @@ -1526,6 +1530,8 @@ 0AA33B392398524F0067DD0F /* Toggle.swift */, 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */, 0AE98BB423FF18D2004C5109 /* Arrow.swift */, + 94382085243238D100B43AF3 /* WebViewModel.swift */, + 943820832432382400B43AF3 /* WebView.swift */, ); path = Views; sourceTree = ""; @@ -1902,6 +1908,7 @@ 0116A4E5228B19640094F3ED /* RadioButtonSelectionHelper.swift in Sources */, 017BEB48236230DB0024EF95 /* MoleculeViewProtocol.swift in Sources */, D2E1FADB2260D3D200AEFD8C /* MVMCoreUIDelegateObject.swift in Sources */, + 94382086243238D100B43AF3 /* WebViewModel.swift in Sources */, D27CD40E2322EEAF00C1DC07 /* TabsTableViewCell.swift in Sources */, D224799B231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift in Sources */, D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */, @@ -1972,6 +1979,7 @@ D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */, D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */, 94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */, + 943820842432382400B43AF3 /* WebView.swift in Sources */, 0103B84E23D7E33A009C315C /* HeadlineBodyToggleModel.swift in Sources */, D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */, 0A21DB85235E06EF00C160A2 /* MFTextField.m in Sources */, diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift new file mode 100644 index 00000000..64343aa7 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift @@ -0,0 +1,181 @@ +// +// MVMCoreUIWebView.swift +// MVMCoreUI +// +// Created by Ryan on 8/29/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +import UIKit +import WebKit + +@objcMembers open class WebView: View, MVMCoreUIViewConstrainingProtocol { + + public let loadingSpinner = MFLoadingSpinner(frame: .zero) + + var delegateObject: MVMCoreUIDelegateObject? + var webView: WKWebView? + var webViewHeight: NSLayoutConstraint? + var dynamicHeight: Bool = true + + var callHandlerName: String? + + override open func setupView() { + super.setupView() + let webView = createWebView(messageHandler: nil, jsScript: nil) + addSubview(webView) + NSLayoutConstraint.constraintPinSubview(toSuperview: webView) + self.webView = webView + pinSpinnerView() + } + + func createWebView(messageHandler: String?, jsScript:String?) -> WKWebView { + let wkUserController = WKUserContentController() + if let messageHandlerName = messageHandler { + wkUserController.add(self, name: messageHandlerName) + } + //inital-scale is necessary to update display correct scale + let source: String = "var meta = document.createElement('meta');" + + "meta.name = 'viewport';" + + //depends on how much clint driven + "meta.content = 'initial-scale=1.0';" + + "var head = document.getElementsByTagName('head')[0];" + "head.appendChild(meta);"; + let wkScript = WKUserScript(source: source, injectionTime: .atDocumentEnd, forMainFrameOnly: true) + wkUserController.addUserScript(wkScript) + + //server driven addition script + if let jsScript = jsScript { + let wkScript = WKUserScript(source: jsScript, injectionTime: .atDocumentStart, forMainFrameOnly: true) + wkUserController.addUserScript(wkScript) + } + + let wkConfig = WKWebViewConfiguration() + wkConfig.userContentController = wkUserController + let webView = WKWebView(frame: .zero, configuration: wkConfig) + webView.translatesAutoresizingMaskIntoConstraints = false + webView.uiDelegate = self + webView.navigationDelegate = self + return webView + } + + + // MARK: - MVMCoreUIMoleculeViewProtocol + override open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? WebViewModel else { return } + self.delegateObject = delegateObject + + if model.callHandler != nil || model.jsScript != nil { +/* + webView's configuration property is immutable. + In order to add call handler into webview, need to create a new webview. + callHanlder + */ + webView?.removeFromSuperview() + let webView = createWebView(messageHandler: model.callHandler, jsScript:model.jsScript) + addSubview(webView) + NSLayoutConstraint.constraintPinSubview(toSuperview: webView) + self.webView = webView + } + //init height for loading spinner + webViewHeight = webView?.heightAnchor.constraint(equalToConstant: 50) + webViewHeight?.isActive = true + + if let height = model.height { + webViewHeight?.constant = height + dynamicHeight = false + } + if let url = model.url { + webView?.load(URLRequest(url: url)) + } else if let htmlString = model.htmlString { + webView?.loadHTMLString(htmlString, baseURL: nil) + } + bringSubviewToFront(loadingSpinner) + //TO DO: local path? + } + + func pinSpinnerView() { + addSubview(loadingSpinner) + // Setup spinner. + loadingSpinner.clipsToBounds = true + loadingSpinner.translatesAutoresizingMaskIntoConstraints = false + + loadingSpinner.heightAnchor.constraint(equalToConstant: 50.0).isActive = true + loadingSpinner.widthAnchor.constraint(equalToConstant: 50.0).isActive = true + loadingSpinner.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true + loadingSpinner.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true + loadingSpinner.resumeSpinner() + } +} + + +// MARK: - WKUIDelegate +extension WebView : WKUIDelegate { + public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + // hide loading + loadingSpinner.pause() + + if !dynamicHeight { + return + } + //update webview's heigth when webview is ready + webView.evaluateJavaScript("document.readyState", completionHandler: { [weak self] (result, error) in + if result == nil || error != nil { + return + } + webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { (result, error) in + guard let height = result as? CGFloat else { return } + self?.webViewHeight?.constant = height + self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self!) + }) + }) + } + + public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { + // show loading + loadingSpinner.resumeSpinner() + } + public func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { + // hide loading + loadingSpinner.pause() + } + +} + + +// MARK: - WKNavigationDelegate +extension WebView : WKNavigationDelegate { + public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { + //validate request url + //all validated link should be open in safari + if (navigationAction.navigationType == .linkActivated), let urlString = navigationAction.request.url?.absoluteString.removingPercentEncoding, !urlString.contains("#") { + MVMCoreActionHandler.shared()?.openURL(inWebView: navigationAction.request.url, actionInformation: nil, additionalData: nil, delegateObject: nil) + decisionHandler(.cancel) + } else { + decisionHandler(.allow) + } + } +} + + +// MARK: - WKScriptMessageHandler +extension WebView: WKScriptMessageHandler { + public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { + if message.name == callHandlerName, let text = message.body as? String { + /* + receiving JavaScript func webkit.messageHandlers.{callHandler}.postMessage(body); + if body is dictionary string + MVMCoreActionHanlder handleAction + */ + if let data = text.data(using: .utf8) { + do { + let actionMap = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: self.delegateObject) + } catch { + // if post message is not dictionary string + print(error.localizedDescription) + } + } + } + } +} diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift b/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift new file mode 100644 index 00000000..bb141b57 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift @@ -0,0 +1,55 @@ +// +// WebviewModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 09/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers public class WebViewModel: MoleculeModelProtocol { + public static var identifier: String = "webview" + public var moleculeName: String = WebViewModel.identifier + public var backgroundColor: Color? + public var url: URL? + public var htmlString: String? + public var height: CGFloat? + public var jsScript: String? + public var callHandler: String? + public var buttonMap: [String: ButtonModel]? + + private enum CodingKeys: String, CodingKey{ + case moleculeName + case backgroundColor + case url + case htmlString + case height + case buttonMap + case jsScript + case callHandler + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + url = try typeContainer.decodeIfPresent(URL.self, forKey: .url) + htmlString = try typeContainer.decodeIfPresent(String.self, forKey: .htmlString) + height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height) + buttonMap = try typeContainer.decodeIfPresent([String: ButtonModel].self, forKey: .buttonMap) + jsScript = try typeContainer.decodeIfPresent(String.self, forKey: .jsScript) + callHandler = try typeContainer.decodeIfPresent(String.self, forKey: .callHandler) + } + + 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.encodeIfPresent(url, forKey: .url) + try container.encodeIfPresent(htmlString, forKey: .htmlString) + try container.encodeIfPresent(height, forKey: .height) + try container.encodeIfPresent(jsScript, forKey: .jsScript) + try container.encodeIfPresent(callHandler, forKey: .callHandler) + + } +} diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index bfa6db01..ba650ca8 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -80,6 +80,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: Arrow.self, viewModelClass: ArrowModel.self) MoleculeObjectMapping.shared()?.register(viewClass: RadioButton.self, viewModelClass: RadioButtonModel.self) MoleculeObjectMapping.shared()?.register(viewClass: RadioButtonLabel.self, viewModelClass: RadioButtonLabelModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: WebView.self, viewModelClass: WebViewModel.self) // Horizontal Combination Molecules MoleculeObjectMapping.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self) From 16810482796bf8ec5cfff76bc6ae1ee7532d66d1 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Mon, 30 Mar 2020 12:10:27 -0400 Subject: [PATCH 17/61] remove initial scale jscript --- MVMCoreUI/Atomic/Atoms/Views/WebView.swift | 46 +++++++++++----------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift index 64343aa7..b3016e00 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift @@ -19,6 +19,9 @@ import WebKit var dynamicHeight: Bool = true var callHandlerName: String? + var webviewModel: WebViewModel? { + return model as? WebViewModel + } override open func setupView() { super.setupView() @@ -34,14 +37,6 @@ import WebKit if let messageHandlerName = messageHandler { wkUserController.add(self, name: messageHandlerName) } - //inital-scale is necessary to update display correct scale - let source: String = "var meta = document.createElement('meta');" + - "meta.name = 'viewport';" + - //depends on how much clint driven - "meta.content = 'initial-scale=1.0';" + - "var head = document.getElementsByTagName('head')[0];" + "head.appendChild(meta);"; - let wkScript = WKUserScript(source: source, injectionTime: .atDocumentEnd, forMainFrameOnly: true) - wkUserController.addUserScript(wkScript) //server driven addition script if let jsScript = jsScript { @@ -65,12 +60,11 @@ import WebKit guard let model = model as? WebViewModel else { return } self.delegateObject = delegateObject - if model.callHandler != nil || model.jsScript != nil { + if model.callHandler != nil || model.jsScript != nil { /* webView's configuration property is immutable. In order to add call handler into webview, need to create a new webview. - callHanlder - */ +*/ webView?.removeFromSuperview() let webView = createWebView(messageHandler: model.callHandler, jsScript:model.jsScript) addSubview(webView) @@ -91,7 +85,6 @@ import WebKit webView?.loadHTMLString(htmlString, baseURL: nil) } bringSubviewToFront(loadingSpinner) - //TO DO: local path? } func pinSpinnerView() { @@ -115,20 +108,29 @@ extension WebView : WKUIDelegate { // hide loading loadingSpinner.pause() + //update webview's heigth when webview is ready if !dynamicHeight { return } - //update webview's heigth when webview is ready - webView.evaluateJavaScript("document.readyState", completionHandler: { [weak self] (result, error) in - if result == nil || error != nil { - return - } - webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { (result, error) in - guard let height = result as? CGFloat else { return } - self?.webViewHeight?.constant = height - self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self!) + if let _ = webviewModel?.jsScript { +/* evaluateJavaScript only works when webview contains userscrpt. + otherwise, it would return WKErrorDomain Code=4 "A JavaScript exception occurred" + */ + webView.evaluateJavaScript("document.readyState", completionHandler: { [weak self] (result, error) in + if result == nil || error != nil { + return + } + webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { (result, error) in + guard let height = result as? CGFloat else { return } + self?.webViewHeight?.constant = height + self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self!) + }) }) - }) + } else { + //get webview's content viewheight when no javescript setup + self.webViewHeight?.constant = webView.scrollView.contentSize.height + self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) + } } public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { From ab18db4a9690f362bf518865f6475167d95fe251 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 31 Mar 2020 11:31:45 +0530 Subject: [PATCH 18/61] Merge conflicts resolved --- MVMCoreUI.xcodeproj/project.pbxproj | 16 +++--- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 2 + ...RightVariableTextLinkAllTextAndLinks.swift | 49 +++++++++++++++++++ ...VariableTextLinkAllTextAndLinksModel.swift | 41 ++++++++++++++++ 4 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index f93bf655..f6f1ec92 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -173,14 +173,14 @@ AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */; }; AAA74A172410C04600080241 /* HeadersH2NoButtonsBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */; }; AAA74A192410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */; }; + BB2C968F24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */; }; + BB2C969224330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */; }; BB47A586241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */; }; BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */; }; BB6C6AC0242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ABE242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift */; }; BB6C6AC1242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */; }; BB6C6AC824225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AC62422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift */; }; BB6C6AC924225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AC72422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift */; }; - BB6C6ADC24233065005F7224 /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ADB24233065005F7224 /* ListRightVariableTextLinkAllTextAndLinksModel.swift */; }; - BB6C6ADE24233090005F7224 /* ListRightVariableTextLinkAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ADD24233090005F7224 /* ListRightVariableTextLinkAllTextAndLinks.swift */; }; C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; }; C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; }; C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; }; @@ -558,14 +558,14 @@ AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePaymentsModel.swift; sourceTree = ""; }; AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyText.swift; sourceTree = ""; }; AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyTextModel.swift; sourceTree = ""; }; + BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinksModel.swift; sourceTree = ""; }; + BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinks.swift; sourceTree = ""; }; BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = ""; }; BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsection.swift; sourceTree = ""; }; BB6C6ABE242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerTallModel.swift; sourceTree = ""; }; BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerTall.swift; sourceTree = ""; }; BB6C6AC62422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShort.swift; sourceTree = ""; }; BB6C6AC72422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShortModel.swift; sourceTree = ""; }; - BB6C6ADB24233065005F7224 /* ListRightVariableTextLinkAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinksModel.swift; sourceTree = ""; }; - BB6C6ADD24233090005F7224 /* ListRightVariableTextLinkAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinks.swift; sourceTree = ""; }; C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = ""; }; C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = ""; }; @@ -992,8 +992,8 @@ AA4FC2A323F4F69600E251DB /* RightVariable */ = { isa = PBXGroup; children = ( - BB6C6ADB24233065005F7224 /* ListRightVariableTextLinkAllTextAndLinksModel.swift */, - BB6C6ADD24233090005F7224 /* ListRightVariableTextLinkAllTextAndLinks.swift */, + BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */, + BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */, AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */, AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */, 8D070BAF241B56530099AC56 /* ListRightVariableTotalDataModel.swift */, @@ -2007,7 +2007,6 @@ 01509D952327ED1900EF99AA /* HeadlineBodyLinkToggle.swift in Sources */, 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */, D29DF13021E6851E003B2FB9 /* MVMCoreUITopAlertShortView.m in Sources */, - BB6C6ADE24233090005F7224 /* ListRightVariableTextLinkAllTextAndLinks.swift in Sources */, 5248BFEC23F12E350059236A /* ListThreeColumnPlanDataDivider.swift in Sources */, 0ABD136D237CAD1E0081388D /* DateDropdownEntryField.swift in Sources */, 0A7EF85B23D8A52800B2AAD1 /* EntryFieldModel.swift in Sources */, @@ -2070,6 +2069,7 @@ 526A265E240D200500B0D828 /* ListTwoColumnCompareChanges.swift in Sources */, 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */, D28A838F23CCDEDE00DFE4FC /* TwoButtonViewModel.swift in Sources */, + BB2C969224330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift in Sources */, D2D90B42240463E100DD6EC9 /* MoleculeHeaderModel.swift in Sources */, 012A88B1238C880100FE3DA1 /* CarouselPagingModelProtocol.swift in Sources */, D29DF2C921E7BFC6003B2FB9 /* MFSizeObject.m in Sources */, @@ -2078,8 +2078,8 @@ D2A6390522CBCE160052ED1F /* MoleculeCollectionViewCell.swift in Sources */, D2A6390122CBB1820052ED1F /* Carousel.swift in Sources */, D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */, - BB6C6ADC24233065005F7224 /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */, C7F8012123E8303200396FBD /* ListRVWheel.swift in Sources */, + BB2C968F24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */, D29DF29521E7ADB8003B2FB9 /* MFProgrammaticScrollViewController.m in Sources */, D2FB151B23A2B65B00C20E10 /* MoleculeContainer.swift in Sources */, BB6C6AC0242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index bfa6db01..b0577203 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -99,6 +99,8 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyToggle.self, viewModelClass: HeadlineBodyToggleModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableTextLinkAllTextAndLinks.self, viewModelClass: ListRightVariableTextLinkAllTextAndLinksModel.self) + // List items MoleculeObjectMapping.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift new file mode 100644 index 00000000..5f2bfcfc --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift @@ -0,0 +1,49 @@ +// +// ListRightVariableTextLinkAllTextAndLinks.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 19/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +@objcMembers open class ListRightVariableTextLinkAllTextAndLinks: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + public var stack: Stack + public let link = Link(frame: .zero) + public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) + + // MARK: - Initializers + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading)), + (view: link, 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: - View Lifecycle + //----------------------------------------------------- + override open func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + } + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListRightVariableTextLinkAllTextAndLinksModel else { return } + link.set(with: model.link, delegateObject, additionalData) + eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift new file mode 100644 index 00000000..9f6392fc --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift @@ -0,0 +1,41 @@ +// +// ListRightVariableTextLinkAllTextAndLinksModel.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 19/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +public class ListRightVariableTextLinkAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "listRVLink" + public var link: LinkModel + public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel + + public init(link: LinkModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { + self.link = link + self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink + super.init() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case link + case eyebrowHeadlineBodyLink + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + link = try typeContainer.decode(LinkModel.self, forKey: .link) + 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(link, forKey: .link) + try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) + } +} From bffd2475dff004940835422a953712ccc8f04999 Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Wed, 1 Apr 2020 12:42:41 +0530 Subject: [PATCH 19/61] Initial Commit of List - Three Column - International Data - Divider --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + ...tThreeColumnInternationalDataDivider.swift | 66 +++++++++++++++++++ ...eColumnInternationalDataDividerModel.swift | 52 +++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 03335a4d..142d72ec 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -129,6 +129,8 @@ 8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D084AD12410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift */; }; 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */; }; + 8D3BA9BD2433787000D341BA /* ListThreeColumnInternationalDataDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3BA9BC2433787000D341BA /* ListThreeColumnInternationalDataDividerModel.swift */; }; + 8D3BA9BF2433789900D341BA /* ListThreeColumnInternationalDataDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3BA9BE2433789900D341BA /* ListThreeColumnInternationalDataDivider.swift */; }; 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; 942C372E241149170066E45E /* NHaasGroteskDSStd-75Bd.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */; }; 942C372F241149170066E45E /* NHaasGroteskDSStd-55Rg.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */; }; @@ -513,6 +515,8 @@ 8D084AD12410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextBodyText.swift; sourceTree = ""; }; 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretModel.swift; sourceTree = ""; }; + 8D3BA9BC2433787000D341BA /* ListThreeColumnInternationalDataDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnInternationalDataDividerModel.swift; sourceTree = ""; }; + 8D3BA9BE2433789900D341BA /* ListThreeColumnInternationalDataDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnInternationalDataDivider.swift; sourceTree = ""; }; 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; 9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftRightLabelModel.swift; sourceTree = ""; }; 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NHaasGroteskDSStd-75Bd.otf"; sourceTree = ""; }; @@ -1244,6 +1248,8 @@ children = ( 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */, 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */, + 8D3BA9BC2433787000D341BA /* ListThreeColumnInternationalDataDividerModel.swift */, + 8D3BA9BE2433789900D341BA /* ListThreeColumnInternationalDataDivider.swift */, ); path = ThreeColumn; sourceTree = ""; @@ -1884,6 +1890,7 @@ 8D070BB0241B56530099AC56 /* ListRightVariableTotalDataModel.swift in Sources */, 943784F5236B77BB006A1E82 /* GraphView.swift in Sources */, 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */, + 8D3BA9BF2433789900D341BA /* ListThreeColumnInternationalDataDivider.swift in Sources */, 94C661DA23CCF4FB00D9FE5B /* UIColor+Extension.swift in Sources */, D29DF32121ED0CBA003B2FB9 /* LabelView.m in Sources */, D28A838123CCB0D800DFE4FC /* AccordionListItemModel.swift in Sources */, @@ -2181,6 +2188,7 @@ 01509D912327ECE600EF99AA /* CornerLabels.swift in Sources */, D22D1F1B220341F60077CEC0 /* MVMCoreUICheckBox.m in Sources */, C695A69823C990C200BFB94E /* DoughnutChartView.swift in Sources */, + 8D3BA9BD2433787000D341BA /* ListThreeColumnInternationalDataDividerModel.swift in Sources */, D29DF2CB21E7BFCC003B2FB9 /* MFSizeThreshold.m in Sources */, 011D959F240453A1000E3791 /* RuleAllValueChangedModel.swift in Sources */, 011D95AD2406BB57000E3791 /* FormHolderProtocol.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index bfa6db01..13c61445 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -143,6 +143,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerTall.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerTallModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextDividerSubsection.self, viewModelClass: ListOneColumnFullWidthTextDividerSubsectionModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnInternationalDataDivider.self, viewModelClass: ListThreeColumnInternationalDataDividerModel.self) // Designed Headers MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift new file mode 100644 index 00000000..89868806 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift @@ -0,0 +1,66 @@ +// +// ListThreeColumnInternationalDataDivider.swift +// MVMCoreUI +// +// Created by Kruthika KP on 31/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class ListThreeColumnInternationalDataDivider: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + let leftLabel = Label.createLabelBoldBodySmall(true) + let centerLabel = Label.createLabelBoldBodySmall(true) + let rightLabel = Label.createLabelBoldBodySmall(true) + var stack: Stack + + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 33, horizontalAlignment: .leading)), + (view: centerLabel, model: StackItemModel(percent: 27, horizontalAlignment: .leading)), + (view: rightLabel, model: StackItemModel(percent: 40, horizontalAlignment: .center))], + axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //----------------------------------------------------- + // MARK: - MFViewProtocol + //----------------------------------------------------- + open override func setupView() { + super.setupView() + 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? ListThreeColumnInternationalDataDividerModel else { return } + leftLabel.set(with: model.leftLabel, delegateObject, additionalData) + centerLabel.set(with: model.centerLabel, delegateObject, additionalData) + rightLabel.set(with: model.rightLabel, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 121 + } + + //----------------------------------------------------- + // MARK: - MVMCoreUIMoleculeViewProtocol + //----------------------------------------------------- + override open func reset() { + super.reset() + leftLabel.styleBoldBodySmall(true) + centerLabel.styleBoldBodySmall(true) + rightLabel.styleBoldBodySmall(true) + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift new file mode 100644 index 00000000..51786004 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift @@ -0,0 +1,52 @@ +// +// ListThreeColumnInternationalDataDividerModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 31/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListThreeColumnInternationalDataDividerModel : ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "list3CIntDataDiv" + public var leftLabel: LabelModel + public var centerLabel: LabelModel + public var rightLabel: LabelModel + + public init (leftLabel:LabelModel, centerLabel:LabelModel, rightLabel:LabelModel) { + self.leftLabel = leftLabel + self.centerLabel = centerLabel + self.rightLabel = rightLabel + super.init() + } + + override public func setDefaults() { + super.setDefaults() + style = "tallDivider" + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case leftLabel + case centerLabel + case rightLabel + } + + 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 a9ca55c7382f800e4ba62cb285eaf956abdfc9e4 Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Wed, 1 Apr 2020 16:01:00 +0530 Subject: [PATCH 20/61] alignment changes --- .../ListThreeColumnInternationalDataDivider.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift index 89868806..42d3d39f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift @@ -19,9 +19,9 @@ import Foundation var stack: Stack public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 33, horizontalAlignment: .leading)), - (view: centerLabel, model: StackItemModel(percent: 27, horizontalAlignment: .leading)), - (view: rightLabel, model: StackItemModel(percent: 40, horizontalAlignment: .center))], + stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 30, horizontalAlignment: .leading)), + (view: centerLabel, model: StackItemModel(percent: 40, horizontalAlignment: .leading)), + (view: rightLabel, model: StackItemModel(percent: 30, horizontalAlignment: .center))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } From dccf576f7adf8b818b6de025532a442876f83207 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 1 Apr 2020 10:05:32 -0400 Subject: [PATCH 21/61] Minor fixs --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++++++++ .../FourColumn/ListFourColumnDataUsageListItem.swift | 5 ++--- .../ListFourColumnDataUsageListItemModel.swift | 9 +-------- MVMCoreUI/Categories/UIStackView+Extension.swift | 6 ++++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index ddf36e4b..227d5f92 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -1016,6 +1016,13 @@ path = Extensions; sourceTree = ""; }; + D20492F12434CB5F00A5EED6 /* FourColumn */ = { + isa = PBXGroup; + children = ( + ); + path = FourColumn; + sourceTree = ""; + }; D213347423842FE3008E41B3 /* Controllers */ = { isa = PBXGroup; children = ( @@ -1213,6 +1220,7 @@ D22B38EA23F4E08B00490EF6 /* List */ = { isa = PBXGroup; children = ( + D20492F12434CB5F00A5EED6 /* FourColumn */, D22D8396241FDE4700D3DF69 /* TwoColumn */, 52267A0523FFE0A900906CBA /* OneColumn */, AA4FC2A323F4F69600E251DB /* RightVariable */, diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift index 5eb0664d..8c499cac 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift @@ -29,7 +29,7 @@ import Foundation (view: label2, model: StackItemModel(percent: 40, horizontalAlignment: .leading)), (view: label3, model: StackItemModel(percent:17,horizontalAlignment: .leading)), (view: label4, model: StackItemModel(percent:20,horizontalAlignment: .leading))], - axis: .horizontal,spacing: 2) + axis: .horizontal,spacing: 8) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -44,6 +44,7 @@ import Foundation super.setupView() addMolecule(stack) arrow.pinHeightAndWidth() + stack.restack() } open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { @@ -54,7 +55,6 @@ import Foundation label3.set(with: model.label3, delegateObject, additionalData) label4.set(with: model.label4, delegateObject, additionalData) arrow.set(with: model.arrow, delegateObject, additionalData) - stack.restack() } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { @@ -67,6 +67,5 @@ import Foundation label2.styleB2(true) label3.styleB2(true) label4.styleB2(true) - arrow.reset() } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItemModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItemModel.swift index dd9e8fa6..bf82bb5f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItemModel.swift @@ -9,13 +9,12 @@ import Foundation public class ListFourColumnDataUsageListItemModel: ListItemModel, MoleculeModelProtocol { - public static var identifier: String = "list4C" public var label1: LabelModel + public var arrow: ArrowModel public var label2: LabelModel public var label3: LabelModel public var label4: LabelModel - public var arrow: ArrowModel public init(label1:LabelModel, label2:LabelModel, label3:LabelModel,label4:LabelModel, arrow:ArrowModel) { self.label1 = label1 @@ -26,12 +25,6 @@ public class ListFourColumnDataUsageListItemModel: ListItemModel, MoleculeModelP super.init() } - public override func setDefaults() { - super.setDefaults() - style = "header" - arrow.degrees = 50 - } - private enum CodingKeys: String, CodingKey { case moleculeName case label1 diff --git a/MVMCoreUI/Categories/UIStackView+Extension.swift b/MVMCoreUI/Categories/UIStackView+Extension.swift index a793635a..b88dfb51 100644 --- a/MVMCoreUI/Categories/UIStackView+Extension.swift +++ b/MVMCoreUI/Categories/UIStackView+Extension.swift @@ -8,13 +8,15 @@ import Foundation -extension UIStackView: MoleculeViewProtocol { +extension UIStackView: MVMCoreViewProtocol { public func updateView(_ size: CGFloat) { for view in arrangedSubviews { (view as? MVMCoreViewProtocol)?.updateView(size) } } - +} + +extension UIStackView: MoleculeViewProtocol { public func reset() { for view in arrangedSubviews { (view as? MoleculeViewProtocol)?.reset() From df16745911b60a19f57f391099b5acac2c70b48f Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 1 Apr 2020 10:20:55 -0400 Subject: [PATCH 22/61] use another stack --- .../FourColumn/ListFourColumnDataUsageListItem.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift index 8c499cac..2377a1f2 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift @@ -19,14 +19,19 @@ import Foundation let label3 = Label.commonLabelB2(true) let label4 = Label.commonLabelB2(true) let arrow = Arrow(frame: .zero) + let arrowAndLabel2Stack: Stack //----------------------------------------------------- // MARK: - Initializers //----------------------------------------------------- public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + arrowAndLabel2Stack = Stack.createStack(with: [(view: arrow, model: StackItemModel(horizontalAlignment: .fill)), + (view: label2, model: StackItemModel(horizontalAlignment: .leading))], + axis: .horizontal, spacing: 4) + label2.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) + label2.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal) stack = Stack.createStack(with: [(view: label1, model: StackItemModel(percent: 19, horizontalAlignment: .leading)), - (view: arrow, model: StackItemModel(percent: 4, horizontalAlignment: .leading)), - (view: label2, model: StackItemModel(percent: 40, horizontalAlignment: .leading)), + (view: arrowAndLabel2Stack, model: StackItemModel(percent: 44, horizontalAlignment: .fill)), (view: label3, model: StackItemModel(percent:17,horizontalAlignment: .leading)), (view: label4, model: StackItemModel(percent:20,horizontalAlignment: .leading))], axis: .horizontal,spacing: 8) @@ -44,6 +49,7 @@ import Foundation super.setupView() addMolecule(stack) arrow.pinHeightAndWidth() + arrowAndLabel2Stack.restack() stack.restack() } From a3f81511b6cfde863407b9b8d15f9dbfb71866f2 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 1 Apr 2020 10:21:42 -0400 Subject: [PATCH 23/61] move files --- MVMCoreUI.xcodeproj/project.pbxproj | 4 ++-- .../FourColumn/ListFourColumnDataUsageListItem.swift | 0 .../FourColumn/ListFourColumnDataUsageListItemModel.swift | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename MVMCoreUI/Atomic/Molecules/DesignedComponents/{SectionDividers => List}/FourColumn/ListFourColumnDataUsageListItem.swift (100%) rename MVMCoreUI/Atomic/Molecules/DesignedComponents/{SectionDividers => List}/FourColumn/ListFourColumnDataUsageListItemModel.swift (100%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 227d5f92..18c6317e 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -923,8 +923,6 @@ children = ( 525019E42406852100EED91C /* ListFourColumnDataUsageDividerModel.swift */, 525019E62406853600EED91C /* ListFourColumnDataUsageDivider.swift */, - 8D4687E1242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift */, - 8D4687E3242E2DF300802879 /* ListFourColumnDataUsageListItem.swift */, ); path = FourColumn; sourceTree = ""; @@ -1019,6 +1017,8 @@ D20492F12434CB5F00A5EED6 /* FourColumn */ = { isa = PBXGroup; children = ( + 8D4687E1242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift */, + 8D4687E3242E2DF300802879 /* ListFourColumnDataUsageListItem.swift */, ); path = FourColumn; sourceTree = ""; diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift similarity index 100% rename from MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItem.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItemModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItemModel.swift similarity index 100% rename from MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageListItemModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItemModel.swift From bcf09b6fb86f21f471d58e5e51dcc502f19bf3ef Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 1 Apr 2020 10:42:12 -0400 Subject: [PATCH 24/61] move files --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + ...RightVariableTextLinkAllTextAndLinks.swift | 50 +++++++++++++++++++ ...VariableTextLinkAllTextAndLinksModel.swift | 41 +++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 02829367..dca0bef7 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -131,6 +131,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableTotalData.self, viewModelClass: ListRightVariableTotalDataModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableTextLinkAllTextAndLinks.self, viewModelClass: ListRightVariableTextLinkAllTextAndLinksModel.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) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift new file mode 100644 index 00000000..88d9448b --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift @@ -0,0 +1,50 @@ +// +// ListRightVariableTextLinkAllTextAndLinks.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 19/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +@objcMembers open class ListRightVariableTextLinkAllTextAndLinks: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + public var stack: Stack + public let link = Link(frame: .zero) + public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) + + // MARK: - Initializers + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)), + (view: link, 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: - View Lifecycle + //----------------------------------------------------- + override open func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + } + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListRightVariableTextLinkAllTextAndLinksModel else { return } + link.set(with: model.link, delegateObject, additionalData) + eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift new file mode 100644 index 00000000..9f6392fc --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift @@ -0,0 +1,41 @@ +// +// ListRightVariableTextLinkAllTextAndLinksModel.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 19/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +public class ListRightVariableTextLinkAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "listRVLink" + public var link: LinkModel + public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel + + public init(link: LinkModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { + self.link = link + self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink + super.init() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case link + case eyebrowHeadlineBodyLink + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + link = try typeContainer.decode(LinkModel.self, forKey: .link) + 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(link, forKey: .link) + try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) + } +} From 779c33108215f94f014c28210ac9a49bbcd458d6 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 1 Apr 2020 10:46:19 -0400 Subject: [PATCH 25/61] move files --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 2 - ...RightVariableTextLinkAllTextAndLinks.swift | 49 ------------------- ...VariableTextLinkAllTextAndLinksModel.swift | 41 ---------------- 3 files changed, 92 deletions(-) delete mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift delete mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 02660f1a..dca0bef7 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -99,8 +99,6 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyToggle.self, viewModelClass: HeadlineBodyToggleModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableTextLinkAllTextAndLinks.self, viewModelClass: ListRightVariableTextLinkAllTextAndLinksModel.self) - // List items MoleculeObjectMapping.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift deleted file mode 100644 index 5f2bfcfc..00000000 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift +++ /dev/null @@ -1,49 +0,0 @@ -// -// ListRightVariableTextLinkAllTextAndLinks.swift -// MVMCoreUI -// -// Created by Dhamodaram Nandi on 19/03/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation -@objcMembers open class ListRightVariableTextLinkAllTextAndLinks: TableViewCell { - - //----------------------------------------------------- - // MARK: - Outlets - //----------------------------------------------------- - public var stack: Stack - public let link = Link(frame: .zero) - public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) - - // MARK: - Initializers - public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading)), - (view: link, 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: - View Lifecycle - //----------------------------------------------------- - override open func setupView() { - super.setupView() - addMolecule(stack) - stack.restack() - } - - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - super.set(with: model, delegateObject, additionalData) - guard let model = model as? ListRightVariableTextLinkAllTextAndLinksModel else { return } - link.set(with: model.link, delegateObject, additionalData) - eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) - } - - open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { - return 90 - } -} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift deleted file mode 100644 index 9f6392fc..00000000 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift +++ /dev/null @@ -1,41 +0,0 @@ -// -// ListRightVariableTextLinkAllTextAndLinksModel.swift -// MVMCoreUI -// -// Created by Dhamodaram Nandi on 19/03/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation -public class ListRightVariableTextLinkAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { - public static var identifier: String = "listRVLink" - public var link: LinkModel - public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel - - public init(link: LinkModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { - self.link = link - self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink - super.init() - } - - private enum CodingKeys: String, CodingKey { - case moleculeName - case link - case eyebrowHeadlineBodyLink - } - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - link = try typeContainer.decode(LinkModel.self, forKey: .link) - 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(link, forKey: .link) - try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) - } -} From b0ab074675e1f515b8c87478f17dc1cd9cfe2192 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 1 Apr 2020 10:46:54 -0400 Subject: [PATCH 26/61] move files --- MVMCoreUI.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 9df66969..7ae72de5 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -996,8 +996,8 @@ AA4FC2A323F4F69600E251DB /* RightVariable */ = { isa = PBXGroup; children = ( - BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */, BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */, + BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */, AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */, AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */, 8D070BAF241B56530099AC56 /* ListRightVariableTotalDataModel.swift */, From aaec6da3275b2accb419e8a5668ad10c064ec126 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Wed, 1 Apr 2020 20:17:17 +0530 Subject: [PATCH 27/61] Button changes committed --- MVMCoreUI.xcodeproj/project.pbxproj | 17 ++++--- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 2 + ...stRightVariableButtonAllTextAndLinks.swift | 51 +++++++++++++++++++ ...htVariableButtonAllTextAndLinksModel.swift | 49 ++++++++++++++++++ 4 files changed, 111 insertions(+), 8 deletions(-) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index e20f5b3e..aa3712fa 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -15,7 +15,7 @@ 011B58F223A2AE2C0085F53C /* DropDownListItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011B58F123A2AE2C0085F53C /* DropDownListItemModel.swift */; }; 011D958524042432000E3791 /* RulesProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D958424042432000E3791 /* RulesProtocol.swift */; }; 011D958724042492000E3791 /* FormFieldProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D958624042492000E3791 /* FormFieldProtocol.swift */; }; - 011D95892404249B000E3791 /* FormProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D95882404249B000E3791 /* FormProtocol.swift */; }; + 011D95892404249B000E3791 /* FormHolderModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D95882404249B000E3791 /* FormHolderModelProtocol.swift */; }; 011D959B240451E3000E3791 /* RuleRequiredModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D959A240451E3000E3791 /* RuleRequiredModel.swift */; }; 011D959D2404536F000E3791 /* RuleAnyValueChangedModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D959C2404536F000E3791 /* RuleAnyValueChangedModel.swift */; }; 011D959F240453A1000E3791 /* RuleAllValueChangedModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D959E240453A1000E3791 /* RuleAllValueChangedModel.swift */; }; @@ -175,12 +175,12 @@ AAA74A192410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */; }; BB47A586241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */; }; BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */; }; + BB54C5202434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */; }; + BB54C5212434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB54C51F2434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift */; }; BB6C6AC0242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ABE242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift */; }; BB6C6AC1242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */; }; BB6C6AC824225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AC62422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift */; }; BB6C6AC924225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AC72422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift */; }; - BB6C6AE1242492F2005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ADF242492C0005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift */; }; - BB6C6AE2242492F2005F7224 /* ListRightVariableButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AE0242492F1005F7224 /* ListRightVariableButtonAllTextAndLinks.swift */; }; C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; }; C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; }; C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; }; @@ -560,12 +560,12 @@ AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyTextModel.swift; sourceTree = ""; }; BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = ""; }; BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsection.swift; sourceTree = ""; }; + BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinks.swift; sourceTree = ""; }; + BB54C51F2434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinksModel.swift; sourceTree = ""; }; BB6C6ABE242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerTallModel.swift; sourceTree = ""; }; BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerTall.swift; sourceTree = ""; }; BB6C6AC62422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShort.swift; sourceTree = ""; }; BB6C6AC72422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShortModel.swift; sourceTree = ""; }; - BB6C6ADF242492C0005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinksModel.swift; sourceTree = ""; }; - BB6C6AE0242492F1005F7224 /* ListRightVariableButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinks.swift; sourceTree = ""; }; C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = ""; }; C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = ""; }; @@ -992,8 +992,8 @@ AA4FC2A323F4F69600E251DB /* RightVariable */ = { isa = PBXGroup; children = ( - BB6C6ADF242492C0005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift */, - BB6C6AE0242492F1005F7224 /* ListRightVariableButtonAllTextAndLinks.swift */, + BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */, + BB54C51F2434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift */, AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */, AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */, 8D070BAF241B56530099AC56 /* ListRightVariableTotalDataModel.swift */, @@ -1977,7 +1977,6 @@ 014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */, D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */, D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */, - BB6C6AE1242492F2005F7224 /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */, 94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */, 0103B84E23D7E33A009C315C /* HeadlineBodyToggleModel.swift in Sources */, D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */, @@ -2033,6 +2032,7 @@ D282AACB2243C61700C46919 /* ButtonView.swift in Sources */, D260105D23D0BCD400764D80 /* Stack.swift in Sources */, 0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */, + BB54C5212434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */, D2D6CD4222E78FAB00D701B8 /* ThreeLayerTemplate.swift in Sources */, 01EB368F23609801006832FA /* LabelModel.swift in Sources */, 942C378E2412F5B60066E45E /* ModalMoleculeStackTemplate.swift in Sources */, @@ -2139,6 +2139,7 @@ 011D95A1240453D0000E3791 /* RuleEqualsModel.swift in Sources */, D29DF2AA21E7B2F9003B2FB9 /* MVMCoreUIConstants.m in Sources */, 011D95892404249B000E3791 /* FormHolderModelProtocol.swift in Sources */, + BB54C5202434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift in Sources */, 948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */, 013F801923FB4A8E00AD8013 /* UIContentMode+Extension.swift in Sources */, 525239C22407BD1000454969 /* ListTwoColumnPriceDetails.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index bfa6db01..3bf7c839 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -143,6 +143,8 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerTall.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerTallModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextDividerSubsection.self, viewModelClass: ListOneColumnFullWidthTextDividerSubsectionModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableButtonAllTextAndLinks.self, viewModelClass: ListRightVariableButtonAllTextAndLinksModel.self) + // Designed Headers MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift new file mode 100644 index 00000000..c5f66b9a --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -0,0 +1,51 @@ +// +// ListRightVariableButtonAllTextAndLinks.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 17/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +@objcMembers open class ListRightVariableButtonAllTextAndLinks: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + public var stack: Stack + public let button = PillButton(frame: .zero) + public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) + + // MARK: - Initializers + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(spacing: 0, horizontalAlignment: .leading)), + (view: button, model: StackItemModel( horizontalAlignment:.fill, verticalAlignment: .center))], + axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //----------------------------------------------------- + // MARK: - View Lifecycle + //----------------------------------------------------- + override open func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + } + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListRightVariableButtonAllTextAndLinksModel else { return } + button.set(with: model.button, delegateObject, additionalData) + eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } +} + diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift new file mode 100644 index 00000000..466456b4 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift @@ -0,0 +1,49 @@ +// +// ListRightVariableButtonAllTextAndLinksModel.swift +// MVMCoreUI +// +// Created by Dhamodaram Nandi on 17/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +public class ListRightVariableButtonAllTextAndLinksModel: ListItemModel,MoleculeModelProtocol{ + public static var identifier: String = "listRVBtn" + public var button: ButtonModel + public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel + + public init(button: ButtonModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { + self.button = button + self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink + super.init() + } + + /// Defaults to set + override public func setDefaults() { + super.setDefaults() + self.button.size = .tiny + self.button.style = ButtonStyle.secondary + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case button + case eyebrowHeadlineBodyLink + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + button = try typeContainer.decode(ButtonModel.self, forKey: .button) + 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(button, forKey: .button) + try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) + } +} + From d961e4d5dc27f471f71743e1baba6d4288081b2c Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 1 Apr 2020 11:52:01 -0400 Subject: [PATCH 28/61] more additions for radio label --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +++ .../Atomic/Atoms/Buttons/RadioButton.swift | 2 +- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 3 +- .../ListLeftVariableRadioButtonBodyText.swift | 67 +++++++++++++++++++ ...LeftVariableRadioButtonBodyTextModel.swift | 59 ++++++++++++++++ .../HeadlineBodyModel.swift | 25 +++++-- 6 files changed, 156 insertions(+), 8 deletions(-) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 03335a4d..9c3efc00 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -87,6 +87,8 @@ 0A41BA6E2344FCD400D4C0BC /* CATransaction+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */; }; 0A41BA7F23453A6400D4C0BC /* TextEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA7E23453A6400D4C0BC /* TextEntryField.swift */; }; 0A5D59C223AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */; }; + 0A6682A22434DB4F00AD3CA1 /* ListLeftVariableRadioButtonBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682A12434DB4F00AD3CA1 /* ListLeftVariableRadioButtonBodyText.swift */; }; + 0A6682A42434DB8D00AD3CA1 /* ListLeftVariableRadioButtonBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682A32434DB8D00AD3CA1 /* ListLeftVariableRadioButtonBodyTextModel.swift */; }; 0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */; }; 0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */; }; 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */; }; @@ -468,6 +470,8 @@ 0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CATransaction+Extension.swift"; sourceTree = ""; }; 0A41BA7E23453A6400D4C0BC /* TextEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextEntryField.swift; sourceTree = ""; }; 0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleGuidelinesProtocol.swift; sourceTree = ""; }; + 0A6682A12434DB4F00AD3CA1 /* ListLeftVariableRadioButtonBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonBodyText.swift; sourceTree = ""; }; + 0A6682A32434DB8D00AD3CA1 /* ListLeftVariableRadioButtonBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonBodyTextModel.swift; sourceTree = ""; }; 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleAnyRequiredModel.swift; sourceTree = ""; }; 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseDropdownEntryField.swift; sourceTree = ""; }; 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyButton.swift; sourceTree = ""; }; @@ -1224,6 +1228,8 @@ 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */, 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */, 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */, + 0A6682A32434DB8D00AD3CA1 /* ListLeftVariableRadioButtonBodyTextModel.swift */, + 0A6682A12434DB4F00AD3CA1 /* ListLeftVariableRadioButtonBodyText.swift */, ); path = LeftVariable; sourceTree = ""; @@ -1904,6 +1910,7 @@ D2E1FADB2260D3D200AEFD8C /* MVMCoreUIDelegateObject.swift in Sources */, D27CD40E2322EEAF00C1DC07 /* TabsTableViewCell.swift in Sources */, D224799B231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift in Sources */, + 0A6682A42434DB8D00AD3CA1 /* ListLeftVariableRadioButtonBodyTextModel.swift in Sources */, D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */, D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */, 01004F3022721C3800991ECC /* RadioButton.swift in Sources */, @@ -2177,6 +2184,7 @@ 525019DD2406430800EED91C /* ListProgressBarDataModel.swift in Sources */, C6FA7D5223C77A4A00A3614A /* UnOrderedList.swift in Sources */, 01509D8F2327EC6F00EF99AA /* MoleculeTableViewCell.swift in Sources */, + 0A6682A22434DB4F00AD3CA1 /* ListLeftVariableRadioButtonBodyText.swift in Sources */, 0105618D224BBE7700E1557D /* FormValidator.swift in Sources */, 01509D912327ECE600EF99AA /* CornerLabels.swift in Sources */, D22D1F1B220341F60077CEC0 /* MVMCoreUICheckBox.m in Sources */, diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/RadioButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButton.swift index 4158cb3f..588cefcb 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/RadioButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButton.swift @@ -28,7 +28,7 @@ import UIKit } lazy public var radioGroupName: String? = { - [unowned self] in return radioModel?.fieldKey + return radioModel?.fieldKey }() lazy public var radioButtonSelectionHelper: RadioButtonSelectionHelper? = { diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index bfa6db01..760e6eb1 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -136,13 +136,14 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) // Designed Section Dividers MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerTall.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerTallModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextDividerSubsection.self, viewModelClass: ListOneColumnFullWidthTextDividerSubsectionModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonBodyText.self, viewModelClass: ListLeftVariableRadioButtonBodyTextModel.self) // Designed Headers MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift new file mode 100644 index 00000000..9b45eec7 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift @@ -0,0 +1,67 @@ +// +// ListLeftVariableRadioButtonBodyText.swift +// MVMCoreUI +// +// Created by Kevin Christiano on 4/1/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + + +open class ListLeftVariableRadioButtonBodyText: TableViewCell { + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + + let radioButton = RadioButton(frame: .zero) + let headlineBody = HeadlineBody() + var stack: Stack + + //----------------------------------------------------- + // MARK: - Initializers + //----------------------------------------------------- + + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: radioButton, model: StackItemModel(horizontalAlignment: .fill)), + (view: headlineBody, model: StackItemModel(horizontalAlignment: .leading))], + axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //----------------------------------------------------- + // MARK: - View Lifecycle + //----------------------------------------------------- + + override open func setupView() { + super.setupView() + + addMolecule(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? ListLeftVariableRadioButtonBodyTextModel else { return } + + radioButton.set(with: model.radioButton, delegateObject, additionalData) + headlineBody.set(with: model.headlineBody, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } + + public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { + radioButton.tapAction() + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift new file mode 100644 index 00000000..359beafd --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift @@ -0,0 +1,59 @@ +// +// ListLeftVariableRadioButtonBodyTextModel.swift +// MVMCoreUI +// +// Created by Kevin Christiano on 4/1/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + + +open class ListLeftVariableRadioButtonBodyTextModel: ListItemModel, MoleculeModelProtocol { + //----------------------------------------------------- + // MARK: - Properties + //----------------------------------------------------- + + public static var identifier: String = "listLVRBBdy" + public var radioButton: RadioButtonModel + public var headlineBody: HeadlineBodyModel + + //----------------------------------------------------- + // MARK: - Initializer + //----------------------------------------------------- + + public init(radioButton: RadioButtonModel, headlineBody: HeadlineBodyModel) { + self.radioButton = radioButton + self.headlineBody = headlineBody + super.init() + } + + //----------------------------------------------------- + // MARK: - Keys + //----------------------------------------------------- + + private enum CodingKeys: String, CodingKey { + case moleculeName + case radioButton + case headlineBody + } + + //----------------------------------------------------- + // MARK: - Codec + //----------------------------------------------------- + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton) + headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) + 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(radioButton, forKey: .radioButton) + try container.encode(headlineBody, forKey: .headlineBody) + } +} diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift index 94c96c2b..ebc5614e 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift @@ -8,7 +8,23 @@ import Foundation + @objcMembers open class HeadlineBodyModel: MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public static var identifier: String = "headlineBody" + public var moleculeName: String = HeadlineBodyModel.identifier + public var headline: LabelModel? + public var body: LabelModel? + public var style: Style? + public var backgroundColor: Color? + + //-------------------------------------------------- + // MARK: - Enum + //-------------------------------------------------- + /// Convenience styles for common situations. public enum Style: String, Codable { case landingHeader @@ -17,12 +33,9 @@ import Foundation case item } - public static var identifier: String = "headlineBody" - public var moleculeName: String = HeadlineBodyModel.identifier - public var headline: LabelModel? - public var body: LabelModel? - public var style: Style? - public var backgroundColor: Color? + //-------------------------------------------------- + // MARK: - Initializers + //-------------------------------------------------- public init(headline: LabelModel) { self.headline = headline From 7d2d1366796367544d5d8d06f1c858e2458f3bb2 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 1 Apr 2020 12:08:59 -0400 Subject: [PATCH 29/61] more --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 760e6eb1..32736c2e 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -136,8 +136,8 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) - + MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonBodyText.self, viewModelClass: ListLeftVariableRadioButtonBodyTextModel.self) + // Designed Section Dividers MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) From b97c35fe91e6f9f639a6ba31fdfd03267bc5b98c Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 1 Apr 2020 12:11:02 -0400 Subject: [PATCH 30/61] more --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 32736c2e..61beb08a 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -143,7 +143,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerTall.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerTallModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonBodyText.self, viewModelClass: ListLeftVariableRadioButtonBodyTextModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextDividerSubsection.self, viewModelClass: ListOneColumnFullWidthTextDividerSubsectionModel.self) // Designed Headers MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) From bfe706908f23c960104735a0829632e6fb4527f4 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Wed, 1 Apr 2020 12:59:54 -0400 Subject: [PATCH 31/61] update web view with default call handler --- MVMCoreUI/Atomic/Atoms/Views/WebView.swift | 47 ++++++++-------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift index b3016e00..c5cc0cf9 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift @@ -10,7 +10,9 @@ import UIKit import WebKit @objcMembers open class WebView: View, MVMCoreUIViewConstrainingProtocol { - + + let mvmWebViewMessageHandler = "mvmWebViewMessageHandler" + public let loadingSpinner = MFLoadingSpinner(frame: .zero) var delegateObject: MVMCoreUIDelegateObject? @@ -25,7 +27,7 @@ import WebKit override open func setupView() { super.setupView() - let webView = createWebView(messageHandler: nil, jsScript: nil) + let webView = createWebView(messageHandler: mvmWebViewMessageHandler, jsScript: nil) addSubview(webView) NSLayoutConstraint.constraintPinSubview(toSuperview: webView) self.webView = webView @@ -112,24 +114,16 @@ extension WebView : WKUIDelegate { if !dynamicHeight { return } - if let _ = webviewModel?.jsScript { -/* evaluateJavaScript only works when webview contains userscrpt. - otherwise, it would return WKErrorDomain Code=4 "A JavaScript exception occurred" - */ - webView.evaluateJavaScript("document.readyState", completionHandler: { [weak self] (result, error) in - if result == nil || error != nil { - return - } - webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { (result, error) in - guard let height = result as? CGFloat else { return } - self?.webViewHeight?.constant = height - self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self!) - }) + + /* was using "document.readyState" to check the state, while evaluateJavaScript "document.readyState",only works when webview contains userscrpt.otherwise, it would return WKErrorDomain Code=4 "A JavaScript exception occurred". + so webView.isLoading to check load finished state + */ + if !webView.isLoading { + webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { [weak self] (result, error) in + guard let self = self, let height = result as? CGFloat else { return } + self.webViewHeight?.constant = height + self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) }) - } else { - //get webview's content viewheight when no javescript setup - self.webViewHeight?.constant = webView.scrollView.contentSize.height - self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) } } @@ -163,21 +157,14 @@ extension WebView : WKNavigationDelegate { // MARK: - WKScriptMessageHandler extension WebView: WKScriptMessageHandler { public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { - if message.name == callHandlerName, let text = message.body as? String { + if message.name == mvmWebViewMessageHandler, let actionMap = message.body as? [AnyHashable: Any] { /* receiving JavaScript func webkit.messageHandlers.{callHandler}.postMessage(body); - if body is dictionary string + if body is dictionary MVMCoreActionHanlder handleAction */ - if let data = text.data(using: .utf8) { - do { - let actionMap = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] - MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: self.delegateObject) - } catch { - // if post message is not dictionary string - print(error.localizedDescription) - } - } + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: self.delegateObject) + } } } From ae4855e358ff68451e0d36d5daf6270c73a12a43 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Wed, 1 Apr 2020 15:40:16 -0400 Subject: [PATCH 32/61] rules are optional --- MVMCoreUI/BaseControllers/ViewController.swift | 4 ++-- MVMCoreUI/FormUIHelpers/FormValidator.swift | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 024606f4..3376cf76 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -170,8 +170,8 @@ import UIKit navigationModel.line = LineModel(type: .none) } pageModel?.navigationItem = navigationModel - if self.formValidator == nil, - let rules = pageModel?.formRules { + if self.formValidator == nil { + let rules = pageModel?.formRules self.formValidator = FormValidator(rules) } } diff --git a/MVMCoreUI/FormUIHelpers/FormValidator.swift b/MVMCoreUI/FormUIHelpers/FormValidator.swift index a38b4b3f..7012e64d 100644 --- a/MVMCoreUI/FormUIHelpers/FormValidator.swift +++ b/MVMCoreUI/FormUIHelpers/FormValidator.swift @@ -12,13 +12,13 @@ import MVMCore @objcMembers public class FormValidator: NSObject { static var defaultGroupName: String = "default" - var formRules: [FormGroupRule] + var formRules: [FormGroupRule]? weak var delegate: FormHolderProtocol? var fields: [String: FormFieldProtocol] = [:] var groupWatchers: [FormGroupWatcherFieldProtocol] = [] var radioButtonsModelByGroup: [String: RadioButtonSelectionHelper] = [:] - public init(_ formRules: [FormGroupRule]) { + public init(_ formRules: [FormGroupRule]?) { self.formRules = formRules } @@ -59,6 +59,9 @@ import MVMCore /// Validates all rule groups. Returns if valid public func validate() -> Bool { var valid = true + guard let formRules = formRules else { + return valid + } for group in formRules { valid = valid && validateGroup(group) } From cd3889cf55ebb7ecaf2f6068534ac81f8b65bcea Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 1 Apr 2020 16:11:17 -0400 Subject: [PATCH 33/61] typo fix --- MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonSelectionHelper.swift | 2 +- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonSelectionHelper.swift b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonSelectionHelper.swift index f40a2dd1..3decadb5 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonSelectionHelper.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonSelectionHelper.swift @@ -33,7 +33,7 @@ import UIKit if radioButtonModel.state { radioButtonSelectionHelper.selectedRadioButton = radioButton } - FormValidator.setupValidation(molecule: radioButtonSelectionHelper, delegate: delegateObject?.formHolderDelegate) + FormValidator.setupValidation(for: radioButtonSelectionHelper, delegate: delegateObject?.formHolderDelegate) } public func selected(_ radioButton: RadioButton) { diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 1a27200f..487ad32f 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -342,7 +342,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) guard let model = model as? ToggleModel else { return } - FormValidator.setupValidation(molecule: model, delegate: delegateObject?.formHolderDelegate) + FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate) if let color = model.onTintColor?.uiColor { containerTintColor?.on = color From 83e04f0a1202776acf69a73a270bc46885e781e3 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Wed, 1 Apr 2020 17:16:23 -0400 Subject: [PATCH 34/61] update with message handler string --- MVMCoreUI/Atomic/Atoms/Views/WebView.swift | 61 +++++++++---------- .../Atomic/Atoms/Views/WebViewModel.swift | 13 ++-- 2 files changed, 32 insertions(+), 42 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift index c5cc0cf9..3d870f53 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift @@ -27,25 +27,19 @@ import WebKit override open func setupView() { super.setupView() - let webView = createWebView(messageHandler: mvmWebViewMessageHandler, jsScript: nil) + let webView = createWebView(messageHandler: mvmWebViewMessageHandler) addSubview(webView) NSLayoutConstraint.constraintPinSubview(toSuperview: webView) self.webView = webView pinSpinnerView() } - func createWebView(messageHandler: String?, jsScript:String?) -> WKWebView { + func createWebView(messageHandler: String?) -> WKWebView { let wkUserController = WKUserContentController() if let messageHandlerName = messageHandler { wkUserController.add(self, name: messageHandlerName) } - //server driven addition script - if let jsScript = jsScript { - let wkScript = WKUserScript(source: jsScript, injectionTime: .atDocumentStart, forMainFrameOnly: true) - wkUserController.addUserScript(wkScript) - } - let wkConfig = WKWebViewConfiguration() wkConfig.userContentController = wkUserController let webView = WKWebView(frame: .zero, configuration: wkConfig) @@ -59,33 +53,29 @@ import WebKit // MARK: - MVMCoreUIMoleculeViewProtocol override open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) - guard let model = model as? WebViewModel else { return } self.delegateObject = delegateObject - - if model.callHandler != nil || model.jsScript != nil { -/* - webView's configuration property is immutable. - In order to add call handler into webview, need to create a new webview. -*/ - webView?.removeFromSuperview() - let webView = createWebView(messageHandler: model.callHandler, jsScript:model.jsScript) - addSubview(webView) - NSLayoutConstraint.constraintPinSubview(toSuperview: webView) - self.webView = webView - } //init height for loading spinner - webViewHeight = webView?.heightAnchor.constraint(equalToConstant: 50) + webViewHeight = webView?.heightAnchor.constraint(equalToConstant: 44) webViewHeight?.isActive = true - if let height = model.height { + if let height = webviewModel?.height { webViewHeight?.constant = height dynamicHeight = false } - if let url = model.url { + if let url = webviewModel?.url { webView?.load(URLRequest(url: url)) - } else if let htmlString = model.htmlString { + } else if let htmlString = webviewModel?.htmlString { webView?.loadHTMLString(htmlString, baseURL: nil) } + + if let borderColor = webviewModel?.borderColor?.cgColor { + webView?.layer.borderWidth = 1.0 + webView?.layer.borderColor = borderColor + } else { + webView?.layer.borderWidth = 0.0 + webView?.layer.borderColor = UIColor.clear.cgColor + } + bringSubviewToFront(loadingSpinner) } @@ -95,8 +85,8 @@ import WebKit loadingSpinner.clipsToBounds = true loadingSpinner.translatesAutoresizingMaskIntoConstraints = false - loadingSpinner.heightAnchor.constraint(equalToConstant: 50.0).isActive = true - loadingSpinner.widthAnchor.constraint(equalToConstant: 50.0).isActive = true + loadingSpinner.heightAnchor.constraint(equalToConstant: 44.0).isActive = true + loadingSpinner.widthAnchor.constraint(equalToConstant: 44.0).isActive = true loadingSpinner.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true loadingSpinner.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true loadingSpinner.resumeSpinner() @@ -114,7 +104,6 @@ extension WebView : WKUIDelegate { if !dynamicHeight { return } - /* was using "document.readyState" to check the state, while evaluateJavaScript "document.readyState",only works when webview contains userscrpt.otherwise, it would return WKErrorDomain Code=4 "A JavaScript exception occurred". so webView.isLoading to check load finished state */ @@ -157,14 +146,20 @@ extension WebView : WKNavigationDelegate { // MARK: - WKScriptMessageHandler extension WebView: WKScriptMessageHandler { public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { - if message.name == mvmWebViewMessageHandler, let actionMap = message.body as? [AnyHashable: Any] { + if message.name == mvmWebViewMessageHandler, let text = message.body as? String { /* receiving JavaScript func webkit.messageHandlers.{callHandler}.postMessage(body); - if body is dictionary - MVMCoreActionHanlder handleAction + if body is string, will decode to actionmodel. + use legacy MVMCoreActionHanlder handleAction method for now */ - MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: self.delegateObject) - + if let data = text.data(using: .utf8) { + do { + let actionMap = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: self.delegateObject) + } catch { + //actionModel should report error when actionhandler is finshed with actionmodel + } + } } } } diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift b/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift index bb141b57..d20a5007 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift @@ -15,8 +15,7 @@ import Foundation public var url: URL? public var htmlString: String? public var height: CGFloat? - public var jsScript: String? - public var callHandler: String? + public var borderColor: Color? public var buttonMap: [String: ButtonModel]? private enum CodingKeys: String, CodingKey{ @@ -26,8 +25,7 @@ import Foundation case htmlString case height case buttonMap - case jsScript - case callHandler + case borderColor } required public init(from decoder: Decoder) throws { @@ -37,8 +35,7 @@ import Foundation htmlString = try typeContainer.decodeIfPresent(String.self, forKey: .htmlString) height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height) buttonMap = try typeContainer.decodeIfPresent([String: ButtonModel].self, forKey: .buttonMap) - jsScript = try typeContainer.decodeIfPresent(String.self, forKey: .jsScript) - callHandler = try typeContainer.decodeIfPresent(String.self, forKey: .callHandler) + borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor) } public func encode(to encoder: Encoder) throws { @@ -48,8 +45,6 @@ import Foundation try container.encodeIfPresent(url, forKey: .url) try container.encodeIfPresent(htmlString, forKey: .htmlString) try container.encodeIfPresent(height, forKey: .height) - try container.encodeIfPresent(jsScript, forKey: .jsScript) - try container.encodeIfPresent(callHandler, forKey: .callHandler) - + try container.encodeIfPresent(borderColor, forKey: .borderColor) } } From 3e7a1a3250e2eb52e7ed13a6eba09d29d018cf3f Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Wed, 1 Apr 2020 17:30:06 -0400 Subject: [PATCH 35/61] move some code --- MVMCoreUI/Atomic/Atoms/Views/WebView.swift | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift index 3d870f53..59306739 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift @@ -14,7 +14,6 @@ import WebKit let mvmWebViewMessageHandler = "mvmWebViewMessageHandler" public let loadingSpinner = MFLoadingSpinner(frame: .zero) - var delegateObject: MVMCoreUIDelegateObject? var webView: WKWebView? var webViewHeight: NSLayoutConstraint? @@ -27,26 +26,24 @@ import WebKit override open func setupView() { super.setupView() - let webView = createWebView(messageHandler: mvmWebViewMessageHandler) - addSubview(webView) - NSLayoutConstraint.constraintPinSubview(toSuperview: webView) - self.webView = webView + createWebView(messageHandler: mvmWebViewMessageHandler) pinSpinnerView() } - func createWebView(messageHandler: String?) -> WKWebView { + func createWebView(messageHandler: String?) { let wkUserController = WKUserContentController() if let messageHandlerName = messageHandler { wkUserController.add(self, name: messageHandlerName) } - let wkConfig = WKWebViewConfiguration() wkConfig.userContentController = wkUserController let webView = WKWebView(frame: .zero, configuration: wkConfig) webView.translatesAutoresizingMaskIntoConstraints = false webView.uiDelegate = self webView.navigationDelegate = self - return webView + self.webView = webView + addSubview(webView) + NSLayoutConstraint.constraintPinSubview(toSuperview: webView) } From 9851050aca094a2b61ae094ad29f3d070b78f6f0 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Wed, 1 Apr 2020 17:31:40 -0400 Subject: [PATCH 36/61] move some code --- MVMCoreUI/Atomic/Atoms/Views/WebView.swift | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift index 59306739..6e22d3f5 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift @@ -13,16 +13,15 @@ import WebKit let mvmWebViewMessageHandler = "mvmWebViewMessageHandler" - public let loadingSpinner = MFLoadingSpinner(frame: .zero) - var delegateObject: MVMCoreUIDelegateObject? - var webView: WKWebView? - var webViewHeight: NSLayoutConstraint? - var dynamicHeight: Bool = true - - var callHandlerName: String? var webviewModel: WebViewModel? { return model as? WebViewModel } + var webView: WKWebView? + public let loadingSpinner = MFLoadingSpinner(frame: .zero) + var delegateObject: MVMCoreUIDelegateObject? + var webViewHeight: NSLayoutConstraint? + var dynamicHeight: Bool = true + override open func setupView() { super.setupView() From 322f5caee52dbfd161bd72d275b150485bbc66bd Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 1 Apr 2020 18:10:48 -0400 Subject: [PATCH 37/61] removing redundant code. --- MVMCoreUI.xcodeproj/project.pbxproj | 2 +- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 5 +- ...stRightVariableButtonAllTextAndLinks.swift | 6 +-- ...htVariableButtonAllTextAndLinksModel.swift | 2 +- ...stRightVariableButtonAllTextAndLinks.swift | 50 ------------------- ...htVariableButtonAllTextAndLinksModel.swift | 48 ------------------ 6 files changed, 7 insertions(+), 106 deletions(-) delete mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableButtonAllTextAndLinks.swift delete mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index f11e633f..60829e96 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -1000,8 +1000,8 @@ AA4FC2A323F4F69600E251DB /* RightVariable */ = { isa = PBXGroup; children = ( - BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */, BB54C51F2434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift */, + BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */, BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */, BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */, AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 3e242905..7f56f142 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -128,17 +128,18 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonBodyText.self, viewModelClass: ListLeftVariableRadioButtonBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableTotalData.self, viewModelClass: ListRightVariableTotalDataModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableTextLinkAllTextAndLinks.self, viewModelClass: ListRightVariableTextLinkAllTextAndLinksModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableButtonAllTextAndLinks.self, viewModelClass: ListRightVariableButtonAllTextAndLinksModel.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) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonBodyText.self, viewModelClass: ListLeftVariableRadioButtonBodyTextModel.self) // Designed Section Dividers MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) @@ -146,8 +147,6 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerTall.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerTallModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextDividerSubsection.self, viewModelClass: ListOneColumnFullWidthTextDividerSubsectionModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableButtonAllTextAndLinks.self, viewModelClass: ListRightVariableButtonAllTextAndLinksModel.self) - // Designed Headers MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index c5f66b9a..25885044 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -18,8 +18,8 @@ import Foundation // MARK: - Initializers public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(spacing: 0, horizontalAlignment: .leading)), - (view: button, model: StackItemModel( horizontalAlignment:.fill, verticalAlignment: .center))], + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading)), + (view: button, model: StackItemModel(horizontalAlignment:.fill))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -37,7 +37,7 @@ import Foundation stack.restack() } - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? ListRightVariableButtonAllTextAndLinksModel else { return } button.set(with: model.button, delegateObject, additionalData) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift index 466456b4..41d4ec72 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift @@ -7,7 +7,7 @@ // import Foundation -public class ListRightVariableButtonAllTextAndLinksModel: ListItemModel,MoleculeModelProtocol{ +public class ListRightVariableButtonAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { public static var identifier: String = "listRVBtn" public var button: ButtonModel public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableButtonAllTextAndLinks.swift deleted file mode 100644 index 0fd7fdad..00000000 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// ListRightVariableButtonAllTextAndLinks.swift -// MVMCoreUI -// -// Created by Dhamodaram Nandi on 17/03/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation -@objcMembers open class ListRightVariableButtonAllTextAndLinks: TableViewCell { - - //----------------------------------------------------- - // MARK: - Outlets - //----------------------------------------------------- - public var stack: Stack - public let button = PrimaryButton.button() - public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) - - // MARK: - Initializers - public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(spacing: 0, horizontalAlignment: .leading)), - (view: button, model: StackItemModel( horizontalAlignment:.fill, verticalAlignment: .center))], - axis: .horizontal) - super.init(style: style, reuseIdentifier: reuseIdentifier) - } - - public required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - //----------------------------------------------------- - // MARK: - View Lifecycle - //----------------------------------------------------- - override open func setupView() { - super.setupView() - addMolecule(stack) - stack.restack() - } - - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ - super.set(with: model, delegateObject, additionalData) - guard let model = model as? ListRightVariableButtonAllTextAndLinksModel else { return } - button.set(with: model.button, delegateObject, additionalData) - eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) - } - - open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { - return 90 - } -} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift deleted file mode 100644 index a306a86c..00000000 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift +++ /dev/null @@ -1,48 +0,0 @@ -// -// ListRightVariableButtonAllTextAndLinksModel.swift -// MVMCoreUI -// -// Created by Dhamodaram Nandi on 17/03/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation -public class ListRightVariableButtonAllTextAndLinksModel: ListItemModel,MoleculeModelProtocol{ - public static var identifier: String = "listRVBtn" - public var button: ButtonModel - public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel - - public init(button: ButtonModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { - self.button = button - self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink - super.init() - } - - /// Defaults to set - override public func setDefaults() { - super.setDefaults() - self.button.size = .tiny - self.button.style = ButtonStyle.secondary - } - - private enum CodingKeys: String, CodingKey { - case moleculeName - case button - case eyebrowHeadlineBodyLink - } - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - button = try typeContainer.decode(ButtonModel.self, forKey: .button) - 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(button, forKey: .button) - try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) - } -} From 56dfb07949f6bdfbecb959d80db786d6343527fd Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 1 Apr 2020 18:13:22 -0400 Subject: [PATCH 38/61] remove extra file --- .../OtherHandlers/MoleculeObjectMapping.swift | 144 ------------------ 1 file changed, 144 deletions(-) delete mode 100644 MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift deleted file mode 100644 index d4f79cc8..00000000 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ /dev/null @@ -1,144 +0,0 @@ -// -// MVMCoreUIMoleculeMappingObject+ModelMapping.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 10/28/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - -@objcMembers public class MoleculeObjectMapping: NSObject { - public static func registerObjects() { - // Stacks - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeStackView.self, viewModelClass: MoleculeStackModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Stack.self, viewModelClass: StackModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: UnOrderedList.self, viewModelClass: UnOrderedListModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: NumberedList.self, viewModelClass: NumberedListModel.self) - - // Label - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Label.self, viewModelClass: LabelModel.self) - // need to move labelattributemodel to different method - try? ModelRegistry.register(LabelAttributeFontModel.self) - try? ModelRegistry.register(LabelAttributeColorModel.self) - try? ModelRegistry.register(LabelAttributeImageModel.self) // We need to separate the registry by types due to collisions... - try? ModelRegistry.register(LabelAttributeUnderlineModel.self) - try? ModelRegistry.register(LabelAttributeStrikeThroughModel.self) - try? ModelRegistry.register(LabelAttributeActionModel.self) - - // Buttons - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: PillButton.self, viewModelClass: ButtonModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: TwoButtonView.self, viewModelClass: TwoButtonViewModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ExternalLink.self, viewModelClass: ExternalLinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Link.self, viewModelClass: LinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CaretLink.self, viewModelClass: CaretLinkModel.self) - - // Entry Field - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: TextEntryField.self, viewModelClass: TextEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MdnEntryField.self, viewModelClass: MdnEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DigitEntryField.self, viewModelClass: DigitEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ItemDropdownEntryField.self, viewModelClass: ItemDropdownEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DateDropdownEntryField.self, viewModelClass: DateDropdownEntryFieldModel.self) - - // Other Atoms - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ProgressBar.self, viewModelClass: ProgressBarModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MultiProgress.self, viewModelClass: MultiProgressBarModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CaretView.self, viewModelClass: CaretViewModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DashLine.self, viewModelClass: DashLineModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MFLoadImageView.self, viewModelClass: ImageViewModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Line.self, viewModelClass: LineModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: GraphView.self, viewModelClass: CircleProgressModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Toggle.self, viewModelClass: ToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CheckboxLabel.self, viewModelClass: CheckboxLabelModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Arrow.self, viewModelClass: ArrowModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RadioButton.self, viewModelClass: RadioButtonModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RadioButtonLabel.self, viewModelClass: RadioButtonLabelModel.self) - - // Horizontal Combination Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self) - - // Vertical Combination Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBody.self, viewModelClass: HeadlineBodyModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadLineBodyCaretLinkImage.self, viewModelClass: HeadlineBodyCaretLinkImageModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: EyebrowHeadlineBodyLink.self, viewModelClass: EyebrowHeadlineBodyLinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLink.self, viewModelClass: HeadlineBodyLinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self) - - // Left Right Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: LeftRightLabelView.self, viewModelClass: LeftRightLabelModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: LabelToggle.self, viewModelClass: LabelToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyToggle.self, viewModelClass: HeadlineBodyToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self) - - // List items - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DropDownFilterTableViewCell.self, viewModelClass: DropDownListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: AccordionMoleculeTableViewCell.self, viewModelClass: AccordionListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: TabsTableViewCell.self, viewModelClass: TabsListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListProgressBarData.self, viewModelClass: ListProgressBarDataModel.self) - - // Other Items - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeStackItem.self, viewModelClass: MoleculeStackItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StackItem.self, viewModelClass: StackItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeCollectionViewCell.self, viewModelClass: CarouselItemModel.self) - - // Other Container Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeHeaderView.self, viewModelClass: MoleculeHeaderModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: FooterView.self, viewModelClass: FooterModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Scroller.self, viewModelClass: ScrollerModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ModuleMolecule.self, viewModelClass: ModuleMoleculeModel.self) - - // Other Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DoughnutChartView.self, viewModelClass: DoughnutChartModel.self) - - // Other Organisms - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Carousel.self, viewModelClass: CarouselModel.self) - - // Designed List Items - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableButtonAllTextAndLinks.self, viewModelClass: ListRightVariableButtonAllTextAndLinksModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableTotalData.self, viewModelClass: ListRightVariableTotalDataModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextBodyText.self, viewModelClass: ListOneColumnFullWidthTextBodyTextModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) - - // Designed Section Dividers - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerTall.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerTallModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextDividerSubsection.self, viewModelClass: ListOneColumnFullWidthTextDividerSubsectionModel.self) - - // Designed Headers - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) - - // TODO: Need model - MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(MVMCoreUIPageControl.self, forKey: "barsPager" as NSString) - - // TODO: Need View - try? ModelRegistry.register(TabsModel.self) - - // Helper models - try? ModelRegistry.register(RuleRequiredModel.self) - try? ModelRegistry.register(RuleAnyRequiredModel.self) - try? ModelRegistry.register(RuleAnyValueChangedModel.self) - try? ModelRegistry.register(RuleAllValueChangedModel.self) - try? ModelRegistry.register(RuleEqualsModel.self) - try? ModelRegistry.register(RuleRegexModel.self) - - // Actions - try? ModelRegistry.register(ActionTopAlertModel.self) - try? ModelRegistry.register(ActionCollapseNotificationModel.self) - try? ModelRegistry.register(ActionOpenPanelModel.self) - } -} From 9cb75817e5f56695e6bf67e4112ae87bb1ae1930 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Wed, 1 Apr 2020 19:15:49 -0400 Subject: [PATCH 39/61] check previous content --- MVMCoreUI/Atomic/Atoms/Views/WebView.swift | 41 +++++++++++++++++----- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift index 6e22d3f5..72c8c33a 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift @@ -27,6 +27,10 @@ import WebKit super.setupView() createWebView(messageHandler: mvmWebViewMessageHandler) pinSpinnerView() + + //init height for loading spinner + webViewHeight = webView?.heightAnchor.constraint(equalToConstant: 44) + webViewHeight?.isActive = true } func createWebView(messageHandler: String?) { @@ -44,24 +48,37 @@ import WebKit addSubview(webView) NSLayoutConstraint.constraintPinSubview(toSuperview: webView) } - // MARK: - MVMCoreUIMoleculeViewProtocol override open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + + //store the previous webview properties + let previousHtmlString = webviewModel?.htmlString + let previousURL = webView?.url + super.set(with: model, delegateObject, additionalData) self.delegateObject = delegateObject - //init height for loading spinner - webViewHeight = webView?.heightAnchor.constraint(equalToConstant: 44) - webViewHeight?.isActive = true if let height = webviewModel?.height { webViewHeight?.constant = height dynamicHeight = false } if let url = webviewModel?.url { - webView?.load(URLRequest(url: url)) + if let previousUrl = previousURL, url == previousUrl { + //dont load the new + } else { + webView?.load(URLRequest(url: url)) + webViewHeight?.constant = 44 + loadingSpinner.resumeSpinner() + } } else if let htmlString = webviewModel?.htmlString { - webView?.loadHTMLString(htmlString, baseURL: nil) + if let previousHTML = previousHtmlString, previousHTML == htmlString { + //dont load the new html since they are the same html string as preivous + } else { + webViewHeight?.constant = 44 + webView?.loadHTMLString(htmlString, baseURL: nil) + loadingSpinner.resumeSpinner() + } } if let borderColor = webviewModel?.borderColor?.cgColor { @@ -105,8 +122,16 @@ extension WebView : WKUIDelegate { */ if !webView.isLoading { webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { [weak self] (result, error) in - guard let self = self, let height = result as? CGFloat else { return } - self.webViewHeight?.constant = height + guard let self = self else { + return + } + if let height = result as? CGFloat { + self.webViewHeight?.constant = height + } else { + //if failed to get height from javascript, using scrollview.contensize's height + let scrollHeight = self.webView?.scrollView.contentSize.height + self.webViewHeight?.constant = scrollHeight ?? 44 + } self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) }) } From 95d305254f937995d67b1bf3faf81910e7be3e71 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Wed, 1 Apr 2020 19:28:31 -0400 Subject: [PATCH 40/61] add overlay --- MVMCoreUI/Atomic/Atoms/Views/WebView.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift index 72c8c33a..dd8b9776 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift @@ -17,6 +17,7 @@ import WebKit return model as? WebViewModel } var webView: WKWebView? + var overLayer = MVMCoreUICommonViewsUtility.commonView() public let loadingSpinner = MFLoadingSpinner(frame: .zero) var delegateObject: MVMCoreUIDelegateObject? var webViewHeight: NSLayoutConstraint? @@ -26,6 +27,7 @@ import WebKit override open func setupView() { super.setupView() createWebView(messageHandler: mvmWebViewMessageHandler) + setupOverLayer() pinSpinnerView() //init height for loading spinner @@ -69,6 +71,7 @@ import WebKit } else { webView?.load(URLRequest(url: url)) webViewHeight?.constant = 44 + overLayer.isHidden = false loadingSpinner.resumeSpinner() } } else if let htmlString = webviewModel?.htmlString { @@ -77,6 +80,7 @@ import WebKit } else { webViewHeight?.constant = 44 webView?.loadHTMLString(htmlString, baseURL: nil) + overLayer.isHidden = false loadingSpinner.resumeSpinner() } } @@ -88,8 +92,6 @@ import WebKit webView?.layer.borderWidth = 0.0 webView?.layer.borderColor = UIColor.clear.cgColor } - - bringSubviewToFront(loadingSpinner) } func pinSpinnerView() { @@ -104,6 +106,12 @@ import WebKit loadingSpinner.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true loadingSpinner.resumeSpinner() } + + func setupOverLayer() { + addSubview(overLayer) + overLayer.backgroundColor = .white + NSLayoutConstraint.constraintPinSubview(toSuperview: overLayer) + } } @@ -111,6 +119,7 @@ import WebKit extension WebView : WKUIDelegate { public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { // hide loading + overLayer.isHidden = true loadingSpinner.pause() //update webview's heigth when webview is ready From 4abfeef11ac426a8209e5c9bff2b1af2b5afa894 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Wed, 1 Apr 2020 19:32:36 -0400 Subject: [PATCH 41/61] add stop loading, although it not loading --- MVMCoreUI/Atomic/Atoms/Views/WebView.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift index dd8b9776..997f0f96 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift @@ -69,6 +69,7 @@ import WebKit if let previousUrl = previousURL, url == previousUrl { //dont load the new } else { + webView?.stopLoading() webView?.load(URLRequest(url: url)) webViewHeight?.constant = 44 overLayer.isHidden = false @@ -78,6 +79,7 @@ import WebKit if let previousHTML = previousHtmlString, previousHTML == htmlString { //dont load the new html since they are the same html string as preivous } else { + webView?.stopLoading() webViewHeight?.constant = 44 webView?.loadHTMLString(htmlString, baseURL: nil) overLayer.isHidden = false From 0edc7a8f00472e07d2c58e1fe02e43fe9f9c4971 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Wed, 1 Apr 2020 19:51:19 -0400 Subject: [PATCH 42/61] update based on Scott's comment --- MVMCoreUI/Atomic/Atoms/Views/WebView.swift | 8 ++++---- MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift index 997f0f96..4244c330 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift @@ -60,8 +60,9 @@ import WebKit super.set(with: model, delegateObject, additionalData) self.delegateObject = delegateObject - + var webViewHeightConstant: CGFloat = 44 if let height = webviewModel?.height { + webViewHeightConstant = height webViewHeight?.constant = height dynamicHeight = false } @@ -71,7 +72,7 @@ import WebKit } else { webView?.stopLoading() webView?.load(URLRequest(url: url)) - webViewHeight?.constant = 44 + webViewHeight?.constant = webViewHeightConstant overLayer.isHidden = false loadingSpinner.resumeSpinner() } @@ -80,7 +81,7 @@ import WebKit //dont load the new html since they are the same html string as preivous } else { webView?.stopLoading() - webViewHeight?.constant = 44 + webViewHeight?.constant = webViewHeightConstant webView?.loadHTMLString(htmlString, baseURL: nil) overLayer.isHidden = false loadingSpinner.resumeSpinner() @@ -106,7 +107,6 @@ import WebKit loadingSpinner.widthAnchor.constraint(equalToConstant: 44.0).isActive = true loadingSpinner.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true loadingSpinner.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true - loadingSpinner.resumeSpinner() } func setupOverLayer() { diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift b/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift index d20a5007..25142fa5 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift @@ -16,7 +16,6 @@ import Foundation public var htmlString: String? public var height: CGFloat? public var borderColor: Color? - public var buttonMap: [String: ButtonModel]? private enum CodingKeys: String, CodingKey{ case moleculeName @@ -24,7 +23,6 @@ import Foundation case url case htmlString case height - case buttonMap case borderColor } @@ -33,8 +31,10 @@ import Foundation backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) url = try typeContainer.decodeIfPresent(URL.self, forKey: .url) htmlString = try typeContainer.decodeIfPresent(String.self, forKey: .htmlString) + if url == nil, htmlString == nil { + throw ModelRegistry.Error.decoderErrorModelNotMapped + } height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height) - buttonMap = try typeContainer.decodeIfPresent([String: ButtonModel].self, forKey: .buttonMap) borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor) } From 39e2001533a08dcdf136acebd3baa3ef90579f73 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 2 Apr 2020 10:18:40 -0400 Subject: [PATCH 43/61] fiix --- MVMCoreUI/FormUIHelpers/FormValidator.swift | 3 +++ MVMCoreUI/FormUIHelpers/Rules/Rules/RuleRequiredModel.swift | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/FormUIHelpers/FormValidator.swift b/MVMCoreUI/FormUIHelpers/FormValidator.swift index 7012e64d..592132f5 100644 --- a/MVMCoreUI/FormUIHelpers/FormValidator.swift +++ b/MVMCoreUI/FormUIHelpers/FormValidator.swift @@ -48,6 +48,9 @@ import MVMCore if let validator = delegate?.formValidator { validator.delegate = delegate validator.insert(item) + + // TODO: Temporary hacks, rewrite architecture to support this. + _ = validator.validate() } } diff --git a/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleRequiredModel.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleRequiredModel.swift index 3900249a..cfff35eb 100644 --- a/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleRequiredModel.swift +++ b/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleRequiredModel.swift @@ -11,7 +11,7 @@ import Foundation public class RuleRequiredModel: RulesProtocol { - public static var identifier: String = "required" + public static var identifier: String = "allRequired" public var type: String = RuleRequiredModel.identifier public var fields: [String] From 614a2b89c8c6df204644e31cff10652720d5b199 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Thu, 2 Apr 2020 10:42:23 -0400 Subject: [PATCH 44/61] code review --- MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift | 14 +++++++++----- MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift | 8 ++++---- MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift | 4 ++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift index ba0ce96b..5e45b6ed 100644 --- a/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift +++ b/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift @@ -8,11 +8,15 @@ public extension Dictionary { - func asActionModel() -> ActionModelProtocol? { - guard let castedSelf = self as? [String: Any], - let actionType = ModelRegistry.getType(for: castedSelf.stringForkey(KeyActionType), with: ActionModelProtocol.self), - let actionModel = try? actionType.decode(jsonDict: castedSelf) as? ActionModelProtocol else { - return nil + func asActionModel() throws -> ActionModelProtocol { + guard let castedSelf = self as? [String: Any] else { + throw ModelRegistry.Error.decoderOther(message: "Dictionary is not of type [String: Any]") + } + guard let actionType = ModelRegistry.getType(for: castedSelf.stringForkey(KeyActionType), with: ActionModelProtocol.self) else { + throw ModelRegistry.Error.decoderErrorModelNotMapped + } + guard let actionModel = try actionType.decode(jsonDict: castedSelf) as? ActionModelProtocol else { + throw ModelRegistry.Error.decoderOther(message: "Could not decode to ActionModelProtocol") } return actionModel } diff --git a/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift index 449227e3..3672a21f 100644 --- a/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift +++ b/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift @@ -12,11 +12,11 @@ public extension FooterModel { var primaryButtonModel: ButtonModel? var secondaryButtonModel: ButtonModel? - if let primaryActionModel = primaryMap?.asActionModel() { - primaryButtonModel = ButtonModel(primaryButtonWith: primaryActionModel.title ?? "", action: primaryActionModel) + if let primaryActionModel = try? primaryMap?.asActionModel(), let title = primaryActionModel.title { + primaryButtonModel = ButtonModel(primaryButtonWith: title, action: primaryActionModel) } - if let secondaryActionModel = secondaryMap?.asActionModel() { - secondaryButtonModel = ButtonModel(secondaryButtonWith: secondaryActionModel.title ?? "", action: secondaryActionModel) + if let secondaryActionModel = try? secondaryMap?.asActionModel(), let title = secondaryActionModel.title { + secondaryButtonModel = ButtonModel(secondaryButtonWith: title, action: secondaryActionModel) } let twoButtonModel = TwoButtonViewModel(primaryButtonModel, secondaryButtonModel) diff --git a/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift index 757b2ccb..396de6ea 100644 --- a/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift +++ b/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift @@ -16,7 +16,7 @@ public extension LabelModel { titlePrefix += " " } if !titlePostfix.isEmpty { - titlePostfix += " " + titlePostfix = " " + titlePostfix } let title = linkAction.optionalStringForKey(KeyTitle) ?? "" let text = "\(titlePrefix)\(title)\(titlePostfix)" @@ -25,7 +25,7 @@ public extension LabelModel { self.init(text: text) // Add action attribute. - if let linkActionModel = linkAction.asActionModel() { + if let linkActionModel = try? linkAction.asActionModel() { attributes = [LabelAttributeActionModel(titlePrefix.isEmpty ? 0 : titlePrefix.count, title.count, action: linkActionModel)] } } From 3279ef91fdcd6b4be45b8a4d3b3655e80a2a6939 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Thu, 2 Apr 2020 13:40:24 -0400 Subject: [PATCH 45/61] update did fail method --- MVMCoreUI/Atomic/Atoms/Views/WebView.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift index 4244c330..1ce2b123 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebView.swift @@ -148,12 +148,11 @@ extension WebView : WKUIDelegate { } } - public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { - // show loading - loadingSpinner.resumeSpinner() - } - public func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { - // hide loading + + public func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { + //actually no error handle page show in webview. We can handle the error display view by our self. + //or stop loading by default + overLayer.isHidden = true loadingSpinner.pause() } From 5098bc911bda89e417c9f3fd0b7e2c7dfec719d9 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Thu, 2 Apr 2020 17:51:19 -0400 Subject: [PATCH 46/61] code review - extra spacing --- MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift index 396de6ea..6b94f63e 100644 --- a/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift +++ b/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift @@ -10,15 +10,15 @@ public extension LabelModel { convenience init(linkAction: [AnyHashable: Any]) { // Concatentate the text. + let title = linkAction.stringForkey(KeyTitle) var titlePrefix = linkAction.stringForkey(KeyTitlePrefix) var titlePostfix = linkAction.stringForkey(KeyTitlePostfix) - if !titlePrefix.isEmpty { + if !titlePrefix.isEmpty && (!title.isEmpty || !titlePostfix.isEmpty) { titlePrefix += " " } - if !titlePostfix.isEmpty { + if !titlePostfix.isEmpty && !title.isEmpty { titlePostfix = " " + titlePostfix } - let title = linkAction.optionalStringForKey(KeyTitle) ?? "" let text = "\(titlePrefix)\(title)\(titlePostfix)" // Initialize with text. From bcffe0bbd207eb8326d0c60c1324dc10473d05a1 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 2 Apr 2020 20:28:47 -0400 Subject: [PATCH 47/61] Percent update --- .../ThreeColumn/ListThreeColumnInternationalDataDivider.swift | 4 ++-- .../ListThreeColumnInternationalDataDividerModel.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift index 42d3d39f..7b6af23d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDivider.swift @@ -20,8 +20,8 @@ import Foundation public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 30, horizontalAlignment: .leading)), - (view: centerLabel, model: StackItemModel(percent: 40, horizontalAlignment: .leading)), - (view: rightLabel, model: StackItemModel(percent: 30, horizontalAlignment: .center))], + (view: centerLabel, model: StackItemModel(percent: 50, horizontalAlignment: .leading)), + (view: rightLabel, model: StackItemModel(percent: 20, horizontalAlignment: .leading))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift index 51786004..a5f3bcf6 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift @@ -8,13 +8,13 @@ import Foundation -public class ListThreeColumnInternationalDataDividerModel : ListItemModel, MoleculeModelProtocol { +public class ListThreeColumnInternationalDataDividerModel: ListItemModel, MoleculeModelProtocol { public static var identifier: String = "list3CIntDataDiv" public var leftLabel: LabelModel public var centerLabel: LabelModel public var rightLabel: LabelModel - 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 From e0395bea0d2ceaa81abec9a699c384583e2aa109 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 3 Apr 2020 13:34:42 -0400 Subject: [PATCH 48/61] removed requested colors --- MVMCoreUI/Categories/UIColor+Extension.swift | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/MVMCoreUI/Categories/UIColor+Extension.swift b/MVMCoreUI/Categories/UIColor+Extension.swift index 81fe6743..76d5041e 100644 --- a/MVMCoreUI/Categories/UIColor+Extension.swift +++ b/MVMCoreUI/Categories/UIColor+Extension.swift @@ -33,7 +33,6 @@ extension UIColor { "green": (.mvmGreen, "#008330"), "green33": (.mvmGreen33, "#ABE4BF"), "green66": (.mvmGreen66, "#57C880"), - "greenShade1": (.mvmGreenShade1, "#178437"), "greenShade2": (.mvmGreenShade2, "#0F5B25"), "orange": (.mvmOrange, "#ED7000"), "orange66": (.mvmOrange66, "#F3A157"), @@ -47,10 +46,6 @@ extension UIColor { "blueShade1": (.mvmBlueShade1, "#136598"), "blueShade2": (.mvmBlueShade2, "#0B4467"), "yellow": (.mvmYellow, "#FFBC3D"), - "yellow33": (.mvmYellow33, "#FFE9BF"), - "yellow66": (.mvmYellow66, "#FFD37F"), - "yellowShade1": (.mvmYellowShade1, "#CC9630"), - "yellowShade2": (.mvmYellowShade2, "#997126"), "coolGray1": (.mvmCoolGray1, "#F6F6F6"), "coolGray3": (.mvmCoolGray3, "#D8DADA"), "coolGray6": (.mvmCoolGray6, "#747676"), @@ -149,9 +144,6 @@ extension UIColor { /// HEX: #57C880 public static let mvmGreen66 = UIColor.color8Bits(red: 87, green: 200, blue: 128) - /// HEX: #178437 - public static let mvmGreenShade1 = UIColor.color8Bits(red: 23, green: 132, blue: 55) - /// HEX: #0F5B25 public static let mvmGreenShade2 = UIColor.color8Bits(red: 15, green: 91, blue: 37) @@ -181,18 +173,6 @@ extension UIColor { /// HEX: #FFBC3D public static let mvmYellow = UIColor.color8Bits(red: 255, green: 188, blue: 61) - /// HEX: #FFE9BF - public static let mvmYellow33 = UIColor.color8Bits(red: 255, green: 233, blue: 191) - - /// HEX: #FFD37F - public static let mvmYellow66 = UIColor.color8Bits(red: 255, green: 211, blue: 127) - - /// HEX: #CC9630 - public static let mvmYellowShade1 = UIColor.color8Bits(red: 204, green: 150, blue: 48) - - /// HEX: #997126 - public static let mvmYellowShade2 = UIColor.color8Bits(red: 153, green: 113, blue: 38) - //-------------------------------------------------- // MARK: - Gray //-------------------------------------------------- From 3d85f826dcb6765cd3de9ca391a9b94be7922719 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 3 Apr 2020 13:48:59 -0400 Subject: [PATCH 49/61] updated blue hex --- MVMCoreUI/Categories/UIColor+Extension.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Categories/UIColor+Extension.swift b/MVMCoreUI/Categories/UIColor+Extension.swift index 76d5041e..1ef2e217 100644 --- a/MVMCoreUI/Categories/UIColor+Extension.swift +++ b/MVMCoreUI/Categories/UIColor+Extension.swift @@ -41,7 +41,7 @@ extension UIColor { "orangeShade2": (.mvmOrangeShade2, "#984700"), "orangeAA": (.mvmOrangeAA, "#CC4D0F"), "blue": (.mvmBlue, "#0077B4"), - "blue33": (.mvmBlue33, "#B1D8EF"), + "blue33": (.mvmBlue33, "#ABD8EF"), "blue66": (.mvmBlue66, "#57B1DF"), "blueShade1": (.mvmBlueShade1, "#136598"), "blueShade2": (.mvmBlueShade2, "#0B4467"), @@ -154,8 +154,8 @@ extension UIColor { /// HEX: #0077B4 public static let mvmBlue = UIColor.color8Bits(red: 0, green: 119, blue: 180) - /// HEX: #B1D8EF - public static let mvmBlue33 = UIColor.color8Bits(red: 87, green: 177, blue: 223) + /// HEX: #ABD8EF + public static let mvmBlue33 = UIColor.color8Bits(red: 171, green: 216, blue: 239) /// HEX: #57B1DF public static let mvmBlue66 = UIColor.color8Bits(red: 87, green: 177, blue: 223) From 39b76823237f7a726bd5c04bcbe5270f1cbae76f Mon Sep 17 00:00:00 2001 From: "Khan, Arshad" Date: Sat, 4 Apr 2020 00:17:29 +0530 Subject: [PATCH 50/61] BGImageHeadlineBodyButton molecule for 3.0 Addons banner --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + .../BGImageHeadlineBodyButton.swift | 90 +++++++++++++++++++ .../BGImageHeadlineBodyButtonModel.swift | 75 ++++++++++++++++ 4 files changed, 174 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButton.swift create mode 100644 MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButtonModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 49ac139e..3b64a728 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -407,6 +407,8 @@ DBC4391B224421A0001AB423 /* CaretLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391A224421A0001AB423 /* CaretLink.swift */; }; DBC4392122491730001AB423 /* LabelWithInternalButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */; }; DBEFFA04225A829700230692 /* Label.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB891E822253FA8500022516 /* Label.swift */; }; + EA5124FD243601600051A3A4 /* BGImageHeadlineBodyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5124FC243601600051A3A4 /* BGImageHeadlineBodyButton.swift */; }; + EA5124FF2436018E0051A3A4 /* BGImageHeadlineBodyButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5124FE2436018E0051A3A4 /* BGImageHeadlineBodyButtonModel.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -813,6 +815,8 @@ DBC4391722442197001AB423 /* DashLine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DashLine.swift; sourceTree = ""; }; DBC4391A224421A0001AB423 /* CaretLink.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaretLink.swift; sourceTree = ""; }; DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelWithInternalButton.swift; sourceTree = ""; }; + EA5124FC243601600051A3A4 /* BGImageHeadlineBodyButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BGImageHeadlineBodyButton.swift; sourceTree = ""; }; + EA5124FE2436018E0051A3A4 /* BGImageHeadlineBodyButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BGImageHeadlineBodyButtonModel.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1157,6 +1161,8 @@ C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */, D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */, 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */, + EA5124FE2436018E0051A3A4 /* BGImageHeadlineBodyButtonModel.swift */, + EA5124FC243601600051A3A4 /* BGImageHeadlineBodyButton.swift */, ); path = VerticalCombinationViews; sourceTree = ""; @@ -2032,6 +2038,7 @@ D29E28D823D21AB800ACEA85 /* StringAndMoleculeView.swift in Sources */, 01EB369023609801006832FA /* MoleculeListItemModel.swift in Sources */, D28A838323CCBD3F00DFE4FC /* CircleProgressModel.swift in Sources */, + EA5124FF2436018E0051A3A4 /* BGImageHeadlineBodyButtonModel.swift in Sources */, D268C70C2386DFFD007F2C1C /* MoleculeStackItemModel.swift in Sources */, DBEFFA04225A829700230692 /* Label.swift in Sources */, D2D6CD4022E78C1A00D701B8 /* Scroller.swift in Sources */, @@ -2224,6 +2231,7 @@ C6FA7D5223C77A4A00A3614A /* UnOrderedList.swift in Sources */, 01509D8F2327EC6F00EF99AA /* MoleculeTableViewCell.swift in Sources */, 0A6682A22434DB4F00AD3CA1 /* ListLeftVariableRadioButtonBodyText.swift in Sources */, + EA5124FD243601600051A3A4 /* BGImageHeadlineBodyButton.swift in Sources */, 0105618D224BBE7700E1557D /* FormValidator.swift in Sources */, 01509D912327ECE600EF99AA /* CornerLabels.swift in Sources */, D22D1F1B220341F60077CEC0 /* MVMCoreUICheckBox.m in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 438f652b..53f8fbcf 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -92,6 +92,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: EyebrowHeadlineBodyLink.self, viewModelClass: EyebrowHeadlineBodyLinkModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyLink.self, viewModelClass: HeadlineBodyLinkModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: BGImageHeadlineBodyButton.self, viewModelClass: BGImageHeadlineBodyButtonModel.self) // Left Right Molecules MoleculeObjectMapping.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButton.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButton.swift new file mode 100644 index 00000000..8a62409b --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButton.swift @@ -0,0 +1,90 @@ +// +// BGImageHeadlineBodyButton.swift +// MVMCoreUI +// +// Created by Khan, Arshad on 02/04/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers public class BGImageHeadlineBodyButton: Container { + let headlineBody = HeadlineBody(frame: .zero) + let button = PillButton(frame: .zero) + let backgroundImageView = MFLoadImageView(pinnedEdges: .all) + let maxWidth: CGFloat = 350.0 + static let heightConstant: CGFloat = 320.0 + var heightConstraint: NSLayoutConstraint? + + // MARK: - MVMCoreViewProtocol + open override func updateView(_ size: CGFloat) { + super.updateView(size) + headlineBody.updateView(size) + button.updateView(size) + backgroundImageView.updateView(size) + backgroundImageView.alignFillHorizontal() + backgroundImageView.alignFillVertical() + } + + open override func setupView() { + super.setupView() + heightConstraint = heightAnchor.constraint(equalToConstant: Self.heightConstant) + heightConstraint?.isActive = true + + backgroundImageView.addSizeConstraintsForAspectRatio = true + + let container = MVMCoreUICommonViewsUtility.commonView() + addAndContain(container) + + container.addSubview(headlineBody) + container.addSubview(button) + + //Headline view + headlineBody.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: 0).isActive = true + headlineBody.topAnchor.constraint(equalTo: container.topAnchor, constant: 0).isActive = true + + headlineBody.widthAnchor.constraint(equalTo: container.widthAnchor, multiplier: 0.67).isActive = true + let headLineBodyWidth = headlineBody.widthAnchor.constraint(lessThanOrEqualToConstant: maxWidth) + headLineBodyWidth.priority = UILayoutPriority(250) + headLineBodyWidth.isActive = true + + //Caret view + button.translatesAutoresizingMaskIntoConstraints = false + button.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: 0).isActive = true + container.bottomAnchor.constraint(greaterThanOrEqualTo: button.bottomAnchor, constant: 0).isActive = true + + button.topAnchor.constraint(equalTo: headlineBody.bottomAnchor, constant: PaddingDefault).isActive = true + + //Background image view + backgroundImageView.translatesAutoresizingMaskIntoConstraints = false + backgroundImageView.imageView.contentMode = .scaleAspectFill + backgroundImageView.alignFillHorizontal() + backgroundImageView.alignFillVertical() + addSubview(backgroundImageView) + NSLayoutConstraint.constraintPinSubview(toSuperview: backgroundImageView) + sendSubviewToBack(backgroundImageView) + } + + // MARK: - MoleculeViewProtocol + open override func reset() { + super.reset() + headlineBody.reset() + backgroundImageView.reset() + } + + // MARK:- MoleculeViewProtocol + public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 320 + } + + public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? BGImageHeadlineBodyButtonModel else { return } + headlineBody.set(with: model.headlineBody, delegateObject, additionalData) + button.setOptional(with: model.button, delegateObject, additionalData) + button.isHidden = model.button == nil + backgroundImageView.set(with: model.image, delegateObject, additionalData) + backgroundImageView.alignFillHorizontal() + backgroundImageView.alignFillVertical() + } +} diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButtonModel.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButtonModel.swift new file mode 100644 index 00000000..650e4875 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButtonModel.swift @@ -0,0 +1,75 @@ +// +// BGImageHeadlineBodyButtonModel.swift +// MVMCoreUI +// +// Created by Khan, Arshad on 02/04/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +import UIKit + +public class BGImageHeadlineBodyButtonModel: ContainerModel, MoleculeModelProtocol { + public static var identifier: String = "bgImageHeadlineBodyButton" + public var backgroundColor: Color? + public var button: ButtonModel? + public var headlineBody: HeadlineBodyModel + public var image: ImageViewModel + + init(headlineBody: HeadlineBodyModel, image: ImageViewModel) { + self.headlineBody = headlineBody + self.image = image + super.init() + setDefaults() + } + + /// Defaults to set + func setDefaults() { + if useHorizontalMargins == nil { + useHorizontalMargins = true + } + if useVerticalMargins == nil { + useVerticalMargins = true + } + if topMarginPadding == nil { + topMarginPadding = PaddingDefault + } + if bottomMarginPadding == nil { + bottomMarginPadding = PaddingDefault + } + if image.height == nil { + image.height = BGImageHeadlineBodyButton.heightConstant + } + button?.size = .tiny + button?.style = .secondary + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case backgroundColor + case headlineBody + case image + case button + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) + image = try typeContainer.decode(ImageViewModel.self, forKey: .image) + button = try typeContainer.decodeIfPresent(ButtonModel.self, forKey: .button) + try super.init(from: decoder) + setDefaults() + } + + 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.encodeIfPresent(backgroundColor, forKey: .backgroundColor) + try container.encode(headlineBody, forKey: .headlineBody) + try container.encode(image, forKey: .image) + try container.encodeIfPresent(button, forKey: .button) + } +} + From 74258f642d6ed027b196daa44b76c1b03972c782 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 3 Apr 2020 15:13:07 -0400 Subject: [PATCH 51/61] move Footer and Label adapters to MF --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ---- .../Legacy/Adapters/FooterModelAdapter.swift | 40 ------------------- .../Legacy/Adapters/LabelModelAdapter.swift | 33 --------------- 3 files changed, 81 deletions(-) delete mode 100644 MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift delete mode 100644 MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 72c1db81..a63b50e6 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -106,9 +106,7 @@ 0AE98BB323FF0934004C5109 /* ExternalLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */; }; 0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB423FF18D2004C5109 /* Arrow.swift */; }; 0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */; }; - 279B1567242BBBF200921D6C /* LabelModelAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279B1566242BBBF200921D6C /* LabelModelAdapter.swift */; }; 279B1569242BBC2F00921D6C /* ActionModelAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */; }; - 279B156D242BBFF100921D6C /* FooterModelAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279B156C242BBFF100921D6C /* FooterModelAdapter.swift */; }; 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */; }; 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; }; 522679C123FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */; }; @@ -503,9 +501,7 @@ 0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalLinkModel.swift; sourceTree = ""; }; 0AE98BB423FF18D2004C5109 /* Arrow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Arrow.swift; sourceTree = ""; }; 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrowModel.swift; sourceTree = ""; }; - 279B1566242BBBF200921D6C /* LabelModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelModelAdapter.swift; sourceTree = ""; }; 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionModelAdapter.swift; sourceTree = ""; }; - 279B156C242BBFF100921D6C /* FooterModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterModelAdapter.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 = ""; }; 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = ""; }; @@ -923,9 +919,7 @@ 279B1565242BBB8500921D6C /* Adapters */ = { isa = PBXGroup; children = ( - 279B1566242BBBF200921D6C /* LabelModelAdapter.swift */, 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */, - 279B156C242BBFF100921D6C /* FooterModelAdapter.swift */, ); path = Adapters; sourceTree = ""; @@ -2162,7 +2156,6 @@ D29DF28C21E7AC2B003B2FB9 /* ViewConstrainingView.m in Sources */, 0AE14F64238315D2005417F8 /* TextField.swift in Sources */, D29DF17B21E69E1F003B2FB9 /* PrimaryButton.m in Sources */, - 279B1567242BBBF200921D6C /* LabelModelAdapter.swift in Sources */, D2C78CD224228BBD00B69FDE /* ActionOpenPanelModel.swift in Sources */, C695A68123C9830D00BFB94E /* NumberedListModel.swift in Sources */, 01EB3684236097C0006832FA /* MoleculeModelProtocol.swift in Sources */, @@ -2254,7 +2247,6 @@ 01509D932327ECFB00EF99AA /* ProgressBar.swift in Sources */, D260106523D0CEA700764D80 /* StackModel.swift in Sources */, D29770F521F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.m in Sources */, - 279B156D242BBFF100921D6C /* FooterModelAdapter.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift deleted file mode 100644 index 3672a21f..00000000 --- a/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// FooterModelAdapter.swift -// MVMCoreUI -// -// Created by Kyle on 3/25/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -public extension FooterModel { - - convenience init(withPrimaryAction primaryMap: [AnyHashable: Any]? = nil, secondaryAction secondaryMap: [AnyHashable: Any]? = nil, bottomLinkAction linkMap: [AnyHashable: Any]? = nil) { - - var primaryButtonModel: ButtonModel? - var secondaryButtonModel: ButtonModel? - if let primaryActionModel = try? primaryMap?.asActionModel(), let title = primaryActionModel.title { - primaryButtonModel = ButtonModel(primaryButtonWith: title, action: primaryActionModel) - } - if let secondaryActionModel = try? secondaryMap?.asActionModel(), let title = secondaryActionModel.title { - secondaryButtonModel = ButtonModel(secondaryButtonWith: title, action: secondaryActionModel) - } - let twoButtonModel = TwoButtonViewModel(primaryButtonModel, secondaryButtonModel) - - let footerContentModel: MoleculeModelProtocol - if let linkActionJSON = linkMap { - let labelModel = LabelModel(linkAction: linkActionJSON) - if primaryButtonModel != nil || secondaryButtonModel != nil { - let moleculeStack = MoleculeStackModel(molecules: [MoleculeStackItemModel(with: twoButtonModel), MoleculeStackItemModel(with: labelModel)]) - moleculeStack.spacing = MFStyler.defaultVerticalPaddingForApplicationWidth() - footerContentModel = moleculeStack - } else { - footerContentModel = labelModel - } - } else { - footerContentModel = twoButtonModel - } - - self.init(with: footerContentModel) - } - -} diff --git a/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift deleted file mode 100644 index 6b94f63e..00000000 --- a/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// LabelModelAdapter.swift -// MVMCoreUI -// -// Created by Kyle on 3/25/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -public extension LabelModel { - - convenience init(linkAction: [AnyHashable: Any]) { - // Concatentate the text. - let title = linkAction.stringForkey(KeyTitle) - var titlePrefix = linkAction.stringForkey(KeyTitlePrefix) - var titlePostfix = linkAction.stringForkey(KeyTitlePostfix) - if !titlePrefix.isEmpty && (!title.isEmpty || !titlePostfix.isEmpty) { - titlePrefix += " " - } - if !titlePostfix.isEmpty && !title.isEmpty { - titlePostfix = " " + titlePostfix - } - let text = "\(titlePrefix)\(title)\(titlePostfix)" - - // Initialize with text. - self.init(text: text) - - // Add action attribute. - if let linkActionModel = try? linkAction.asActionModel() { - attributes = [LabelAttributeActionModel(titlePrefix.isEmpty ? 0 : titlePrefix.count, title.count, action: linkActionModel)] - } - } - -} From bebc0e11bde3fd5174f6abbf6cba559ddb1f0c98 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Sun, 5 Apr 2020 10:51:13 -0400 Subject: [PATCH 52/61] align with anroid changes --- .../LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift index 359beafd..8f2ab081 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift @@ -46,6 +46,7 @@ open class ListLeftVariableRadioButtonBodyTextModel: ListItemModel, MoleculeMode let typeContainer = try decoder.container(keyedBy: CodingKeys.self) radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton) headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) + headlineBody.headline?.fontStyle = LabelModel.FontStyle.BoldMicro try super.init(from: decoder) } From 3ec2150afe5f5a0b0abe31b6ebaf40c5d5bb2abb Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Mon, 6 Apr 2020 17:15:43 +0530 Subject: [PATCH 53/61] List Three Column International Data - List Item - Added files --- MVMCoreUI.xcodeproj/project.pbxproj | 30 +++++--- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 2 +- .../ListThreeColumnInternationalData.swift | 68 +++++++++++++++++++ ...istThreeColumnInternationalDataModel.swift | 59 ++++++++++++++++ 4 files changed, 150 insertions(+), 9 deletions(-) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 5fa8c961..b5a06ab1 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -135,8 +135,10 @@ 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; 8D4687E2242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D4687E1242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift */; }; 8D4687E4242E2DF300802879 /* ListFourColumnDataUsageListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D4687E3242E2DF300802879 /* ListFourColumnDataUsageListItem.swift */; }; - 8DFB6D8B242A137600A3F715 /* ListThreeColumnInternationalDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFB6D8A242A137600A3F715 /* ListThreeColumnInternationalDataModel.swift */; }; - 8DFB6D8D242A138000A3F715 /* ListThreeColumnInternationalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFB6D8C242A138000A3F715 /* ListThreeColumnInternationalData.swift */; }; + 8DD1E36E243B3CFB00D8F2DF /* ListThreeColumnInternationalDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DD1E36D243B3CFB00D8F2DF /* ListThreeColumnInternationalDataModel.swift */; }; + 8DD1E370243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DD1E36F243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift */; }; + 8DFB6D8B242A137600A3F715 /* (null) in Sources */ = {isa = PBXBuildFile; }; + 8DFB6D8D242A138000A3F715 /* (null) in Sources */ = {isa = PBXBuildFile; }; 942C372E241149170066E45E /* NHaasGroteskDSStd-75Bd.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */; }; 942C372F241149170066E45E /* NHaasGroteskDSStd-55Rg.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */; }; 942C378C2412F4FA0066E45E /* ModalMoleculeListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 942C378B2412F4FA0066E45E /* ModalMoleculeListTemplate.swift */; }; @@ -532,6 +534,8 @@ 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; 8D4687E1242E2DE400802879 /* ListFourColumnDataUsageListItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageListItemModel.swift; sourceTree = ""; }; 8D4687E3242E2DF300802879 /* ListFourColumnDataUsageListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageListItem.swift; sourceTree = ""; }; + 8DD1E36D243B3CFB00D8F2DF /* ListThreeColumnInternationalDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnInternationalDataModel.swift; sourceTree = ""; }; + 8DD1E36F243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnInternationalData.swift; sourceTree = ""; }; 9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftRightLabelModel.swift; sourceTree = ""; }; 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NHaasGroteskDSStd-75Bd.otf"; sourceTree = ""; }; 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NHaasGroteskDSStd-55Rg.otf"; sourceTree = ""; }; @@ -985,11 +989,18 @@ path = TwoColumn; sourceTree = ""; }; + 8DD1E36C243B3CD900D8F2DF /* ThreeColumn */ = { + isa = PBXGroup; + children = ( + 8DD1E36D243B3CFB00D8F2DF /* ListThreeColumnInternationalDataModel.swift */, + 8DD1E36F243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift */, + ); + path = ThreeColumn; + sourceTree = ""; + }; 8DFB6D89242A134600A3F715 /* ThreeColumn */ = { isa = PBXGroup; children = ( - 8DFB6D8A242A137600A3F715 /* ListThreeColumnInternationalDataModel.swift */, - 8DFB6D8C242A138000A3F715 /* ListThreeColumnInternationalData.swift */, ); name = ThreeColumn; path = ../ThreeColumn; @@ -1261,9 +1272,10 @@ D22B38EA23F4E08B00490EF6 /* List */ = { isa = PBXGroup; children = ( - D20492F12434CB5F00A5EED6 /* FourColumn */, - D22D8396241FDE4700D3DF69 /* TwoColumn */, 52267A0523FFE0A900906CBA /* OneColumn */, + D22D8396241FDE4700D3DF69 /* TwoColumn */, + 8DD1E36C243B3CD900D8F2DF /* ThreeColumn */, + D20492F12434CB5F00A5EED6 /* FourColumn */, AA4FC2A323F4F69600E251DB /* RightVariable */, D22B38EB23F4E0AE00490EF6 /* LeftVariable */, ); @@ -1952,7 +1964,7 @@ D28A838123CCB0D800DFE4FC /* AccordionListItemModel.swift in Sources */, DBC4391822442197001AB423 /* CaretView.swift in Sources */, C07065C42395677300FBF997 /* Link.swift in Sources */, - 8DFB6D8D242A138000A3F715 /* ListThreeColumnInternationalData.swift in Sources */, + 8DFB6D8D242A138000A3F715 /* (null) in Sources */, 0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */, D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */, D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */, @@ -2093,6 +2105,7 @@ D260105D23D0BCD400764D80 /* Stack.swift in Sources */, 0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */, BB54C5212434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */, + 8DD1E370243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift in Sources */, D2D6CD4222E78FAB00D701B8 /* ThreeLayerTemplate.swift in Sources */, 01EB368F23609801006832FA /* LabelModel.swift in Sources */, 942C378E2412F5B60066E45E /* ModalMoleculeStackTemplate.swift in Sources */, @@ -2176,6 +2189,7 @@ D27CD4102339057800C1DC07 /* EyebrowHeadlineBodyLink.swift in Sources */, 8D070BB2241B56AD0099AC56 /* ListRightVariableTotalData.swift in Sources */, D29DF11D21E684A9003B2FB9 /* MVMCoreUISplitViewController.m in Sources */, + 8DD1E36E243B3CFB00D8F2DF /* ListThreeColumnInternationalDataModel.swift in Sources */, D243859923A16B1800332775 /* Container.swift in Sources */, D2C521A923EDE79E00CA2634 /* ViewController.swift in Sources */, D260105B23D0BB7100764D80 /* StackModelProtocol.swift in Sources */, @@ -2233,7 +2247,7 @@ D2B18B922361E65A00A9AEDC /* CoreUIObject.swift in Sources */, D29DF2BE21E7BEA4003B2FB9 /* TopTabbar.m in Sources */, 014AA72E23C5059B006F3E93 /* StackCenteredPageTemplateModel.swift in Sources */, - 8DFB6D8B242A137600A3F715 /* ListThreeColumnInternationalDataModel.swift in Sources */, + 8DFB6D8B242A137600A3F715 /* (null) in Sources */, D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */, 011D959D2404536F000E3791 /* RuleAnyValueChangedModel.swift in Sources */, D260105923D0A92900764D80 /* ContainerProtocol.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 438f652b..30995284 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -141,7 +141,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) - + MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnInternationalData.self, viewModelClass: ListThreeColumnInternationalDataModel.self) // Designed Section Dividers MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift new file mode 100644 index 00000000..1f0be954 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift @@ -0,0 +1,68 @@ +// +// ListThreeColumnInternationalData.swift +// MVMCoreUI +// +// Created by Kruthika KP on 06/04/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers public class ListThreeColumnInternationalData: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + var stack: Stack + let leftLabel = Label.createLabelRegularBodySmall(true) + let centerLabel = Label.createLabelRegularBodySmall(true) + let rightLabel = Label.createLabelRegularBodySmall(true) + let arrow = Arrow(frame: .zero) + + //----------------------------------------------------- + // MARK: - Initializers + //----------------------------------------------------- + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 30, horizontalAlignment: .leading)), + (view: arrow, model: StackItemModel(percent: 4, horizontalAlignment: .trailing)), + (view: centerLabel, model: StackItemModel(percent: 46, horizontalAlignment: .leading)), + (view: rightLabel, model: StackItemModel(percent:20,horizontalAlignment: .leading))], + axis: .horizontal,spacing: 2) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //----------------------------------------------------- + // MARK: - View Lifecycle + //----------------------------------------------------- + override open func setupView() { + super.setupView() + addMolecule(stack) + arrow.pinHeightAndWidth() + } + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListThreeColumnInternationalDataModel else { return } + leftLabel.set(with: model.leftLabel, delegateObject, additionalData) + centerLabel.set(with: model.centerLabel, delegateObject, additionalData) + rightLabel.set(with: model.rightLabel, delegateObject, additionalData) + arrow.set(with: model.arrow, delegateObject, additionalData) + stack.restack() + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } + + open override func reset() { + super.reset() + leftLabel.styleRegularBodySmall(true) + centerLabel.styleRegularBodySmall(true) + rightLabel.styleRegularBodySmall(true) + arrow.reset() + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift new file mode 100644 index 00000000..976a6361 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift @@ -0,0 +1,59 @@ +// +// ListThreeColumnInternationalDataModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 06/04/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListThreeColumnInternationalDataModel: ListItemModel, MoleculeModelProtocol { + + public static var identifier: String = "list3CIntData" + public var leftLabel: LabelModel + public var centerLabel: LabelModel + public var rightLabel: LabelModel + public var arrow: ArrowModel + + public init(leftLabel:LabelModel, centerLabel:LabelModel, rightLabel:LabelModel, arrow:ArrowModel) { + self.leftLabel = leftLabel + self.centerLabel = centerLabel + self.rightLabel = rightLabel + self.arrow = arrow + super.init() + } + + public override func setDefaults() { + super.setDefaults() + arrow.degrees = 50 + arrow.color = Color.init(uiColor: .mvmGreen) + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case leftLabel + case centerLabel + case rightLabel + case arrow + } + + 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) + arrow = try typeContainer.decode(ArrowModel.self, forKey: .arrow) + 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) + try container.encode(arrow, forKey: .arrow) + } +} From 51f6dc417c8db0c43ad1fe481e06ae6b6b5aff53 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 6 Apr 2020 09:35:32 -0400 Subject: [PATCH 54/61] revised to common patteren --- .../ListLeftVariableRadioButtonBodyTextModel.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift index 8f2ab081..710a1ef6 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift @@ -26,6 +26,16 @@ open class ListLeftVariableRadioButtonBodyTextModel: ListItemModel, MoleculeMode self.radioButton = radioButton self.headlineBody = headlineBody super.init() + setDefaults() + } + + //----------------------------------------------------- + // MARK: - Methods + //----------------------------------------------------- + + open override func setDefaults() { + super.setDefaults() + headlineBody.style = .item } //----------------------------------------------------- @@ -46,7 +56,6 @@ open class ListLeftVariableRadioButtonBodyTextModel: ListItemModel, MoleculeMode let typeContainer = try decoder.container(keyedBy: CodingKeys.self) radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton) headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) - headlineBody.headline?.fontStyle = LabelModel.FontStyle.BoldMicro try super.init(from: decoder) } From 47c5343219ae9f42cc417fc3d87bc468ab61d45b Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 6 Apr 2020 09:38:27 -0400 Subject: [PATCH 55/61] removed --- .../LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift | 1 - .../ThreeColumn/ListThreeColumnPlanDataDividerModel.swift | 1 - 2 files changed, 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift index 710a1ef6..bb8e7ded 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift @@ -26,7 +26,6 @@ open class ListLeftVariableRadioButtonBodyTextModel: ListItemModel, MoleculeMode self.radioButton = radioButton self.headlineBody = headlineBody super.init() - setDefaults() } //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift index 8e718a8a..e727a1c6 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift @@ -19,7 +19,6 @@ public class ListThreeColumnPlanDataDividerModel: ListItemModel, MoleculeModelPr self.centerHeadlineBody = centerHeadlineBody self.rightHeadlineBody = rightHeadlineBody super.init() - setDefaults() } /// Defaults to set From 4d03ef2447bd974b5dbf1b4837c14f537e3d151b Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 6 Apr 2020 11:48:55 -0400 Subject: [PATCH 56/61] mild entryfield changes --- MVMCoreUI/Atomic/Atoms/TextFields/EntryField.swift | 6 +++--- MVMCoreUI/Containers/Views/EntryFieldContainer.swift | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/TextFields/EntryField.swift b/MVMCoreUI/Atomic/Atoms/TextFields/EntryField.swift index a02f87ee..7fb3a458 100644 --- a/MVMCoreUI/Atomic/Atoms/TextFields/EntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/TextFields/EntryField.swift @@ -21,7 +21,7 @@ import UIKit public private(set) var titleLabel: Label = { let label = Label() label.font = MFStyler.fontB3() - label.textColor = .mfBattleshipGrey() + label.textColor = .mvmCoolGray6 label.setContentCompressionResistancePriority(.required, for: .vertical) return label }() @@ -32,7 +32,7 @@ import UIKit public private(set) var feedbackLabel: Label = { let label = Label() label.font = MFStyler.fontForTextFieldUnderLabel() - label.textColor = .black + label.textColor = .mvmBlack label.setContentCompressionResistancePriority(.required, for: .vertical) return label }() @@ -178,7 +178,7 @@ import UIKit isAccessibilityElement = false setContentCompressionResistancePriority(.required, for: .vertical) accessibilityElements = [titleLabel, feedbackLabel] - backgroundColor = .clear + backgroundColor = .mvmWhite addSubview(titleLabel) diff --git a/MVMCoreUI/Containers/Views/EntryFieldContainer.swift b/MVMCoreUI/Containers/Views/EntryFieldContainer.swift index c7e5c3a7..cf56fb9d 100644 --- a/MVMCoreUI/Containers/Views/EntryFieldContainer.swift +++ b/MVMCoreUI/Containers/Views/EntryFieldContainer.swift @@ -256,7 +256,7 @@ import UIKit isUserInteractionEnabled = false hideBorders = false borderStrokeColor = .mfSilver() - bottomBar?.backgroundColor = UIColor.mfSilver().cgColor + bottomBar?.backgroundColor = UIColor.mvmCoolGray3.cgColor refreshUI(bottomBarSize: 1) } From a601041c5fdead31f534b8844393982f462df6f6 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 6 Apr 2020 11:54:14 -0400 Subject: [PATCH 57/61] cleanup --- MVMCoreUI.xcodeproj/project.pbxproj | 9 ------- .../ListThreeColumnInternationalData.swift | 27 +++++++++++-------- ...istThreeColumnInternationalDataModel.swift | 9 +------ 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index b5a06ab1..540d8ec0 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -946,7 +946,6 @@ 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */, 8D084ACF2410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift */, 8D084AD12410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift */, - 8DFB6D89242A134600A3F715 /* ThreeColumn */, ); path = OneColumn; sourceTree = ""; @@ -998,14 +997,6 @@ path = ThreeColumn; sourceTree = ""; }; - 8DFB6D89242A134600A3F715 /* ThreeColumn */ = { - isa = PBXGroup; - children = ( - ); - name = ThreeColumn; - path = ../ThreeColumn; - sourceTree = ""; - }; 94C01508242155FE005811A9 /* Actions */ = { isa = PBXGroup; children = ( diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift index 1f0be954..5fc836d1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift @@ -13,21 +13,26 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //----------------------------------------------------- - var stack: Stack - let leftLabel = Label.createLabelRegularBodySmall(true) - let centerLabel = Label.createLabelRegularBodySmall(true) - let rightLabel = Label.createLabelRegularBodySmall(true) - let arrow = Arrow(frame: .zero) - + open var stack: Stack + public let leftLabel = Label.createLabelRegularBodySmall(true) + public let centerLabel = Label.createLabelRegularBodySmall(true) + public let rightLabel = Label.createLabelRegularBodySmall(true) + public let arrow = Arrow(frame: .zero) + public let arrowAndLabel2Stack: Stack + //----------------------------------------------------- // MARK: - Initializers //----------------------------------------------------- public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + arrowAndLabel2Stack = Stack.createStack(with: [(view: arrow, model: StackItemModel(horizontalAlignment: .fill)), + (view: centerLabel, model: StackItemModel(horizontalAlignment: .leading))], + axis: .horizontal, spacing: 4) + centerLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) + centerLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 900), for: .horizontal) stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 30, horizontalAlignment: .leading)), - (view: arrow, model: StackItemModel(percent: 4, horizontalAlignment: .trailing)), - (view: centerLabel, model: StackItemModel(percent: 46, horizontalAlignment: .leading)), + (view: arrowAndLabel2Stack, model: StackItemModel(percent: 50, horizontalAlignment: .fill)), (view: rightLabel, model: StackItemModel(percent:20,horizontalAlignment: .leading))], - axis: .horizontal,spacing: 2) + axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -42,6 +47,8 @@ import Foundation super.setupView() addMolecule(stack) arrow.pinHeightAndWidth() + arrowAndLabel2Stack.restack() + stack.restack() } open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { @@ -51,7 +58,6 @@ import Foundation centerLabel.set(with: model.centerLabel, delegateObject, additionalData) rightLabel.set(with: model.rightLabel, delegateObject, additionalData) arrow.set(with: model.arrow, delegateObject, additionalData) - stack.restack() } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { @@ -63,6 +69,5 @@ import Foundation leftLabel.styleRegularBodySmall(true) centerLabel.styleRegularBodySmall(true) rightLabel.styleRegularBodySmall(true) - arrow.reset() } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift index 976a6361..d0cd3791 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift @@ -9,7 +9,6 @@ import Foundation public class ListThreeColumnInternationalDataModel: ListItemModel, MoleculeModelProtocol { - public static var identifier: String = "list3CIntData" public var leftLabel: LabelModel public var centerLabel: LabelModel @@ -24,12 +23,6 @@ public class ListThreeColumnInternationalDataModel: ListItemModel, MoleculeModel super.init() } - public override func setDefaults() { - super.setDefaults() - arrow.degrees = 50 - arrow.color = Color.init(uiColor: .mvmGreen) - } - private enum CodingKeys: String, CodingKey { case moleculeName case leftLabel @@ -47,7 +40,7 @@ public class ListThreeColumnInternationalDataModel: ListItemModel, MoleculeModel try super.init(from: decoder) } - public override func encode(to encoder: Encoder) throws { + 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) From 79dd73ed4433fe4bd74bf500a5d555f82e2eef33 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 6 Apr 2020 11:57:38 -0400 Subject: [PATCH 58/61] toggle --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 487ad32f..1e072faf 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -25,13 +25,13 @@ public typealias ActionBlockConfirmation = () -> (Bool) //-------------------------------------------------- /// Holds the on and off colors for the container. - public var containerTintColor: (on: UIColor?, off: UIColor?)? = (on: .mfShamrock(), off: .black) + public var containerTintColor: (on: UIColor?, off: UIColor?)? = (on: .mvmGreen, off: .black) /// Holds the on and off colors for the knob. public var knobTintColor: (on: UIColor?, off: UIColor?)? = (on: .white, off: .white) /// Holds the on and off colors for the disabled state.. - public var disabledTintColor: (container: UIColor?, knob: UIColor?)? = (container: .mfSilver(), knob: .white) + public var disabledTintColor: (container: UIColor?, knob: UIColor?)? = (container: .mvmCoolGray3, knob: .white) /// Set this flag to false if you do not want to animate state changes. public var isAnimated = true From d6d1046cd884d73d6597866c4c68829860de9b2e Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 6 Apr 2020 11:57:40 -0400 Subject: [PATCH 59/61] cleanup mistakes --- MVMCoreUI.xcodeproj/project.pbxproj | 4 -- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 3 +- .../ListThreeColumnInternationalData.swift | 70 ------------------- ...istThreeColumnInternationalDataModel.swift | 59 ---------------- 4 files changed, 2 insertions(+), 134 deletions(-) delete mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalData.swift delete mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 540d8ec0..9fde090d 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -137,8 +137,6 @@ 8D4687E4242E2DF300802879 /* ListFourColumnDataUsageListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D4687E3242E2DF300802879 /* ListFourColumnDataUsageListItem.swift */; }; 8DD1E36E243B3CFB00D8F2DF /* ListThreeColumnInternationalDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DD1E36D243B3CFB00D8F2DF /* ListThreeColumnInternationalDataModel.swift */; }; 8DD1E370243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DD1E36F243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift */; }; - 8DFB6D8B242A137600A3F715 /* (null) in Sources */ = {isa = PBXBuildFile; }; - 8DFB6D8D242A138000A3F715 /* (null) in Sources */ = {isa = PBXBuildFile; }; 942C372E241149170066E45E /* NHaasGroteskDSStd-75Bd.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */; }; 942C372F241149170066E45E /* NHaasGroteskDSStd-55Rg.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */; }; 942C378C2412F4FA0066E45E /* ModalMoleculeListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 942C378B2412F4FA0066E45E /* ModalMoleculeListTemplate.swift */; }; @@ -1955,7 +1953,6 @@ D28A838123CCB0D800DFE4FC /* AccordionListItemModel.swift in Sources */, DBC4391822442197001AB423 /* CaretView.swift in Sources */, C07065C42395677300FBF997 /* Link.swift in Sources */, - 8DFB6D8D242A138000A3F715 /* (null) in Sources */, 0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */, D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */, D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */, @@ -2238,7 +2235,6 @@ D2B18B922361E65A00A9AEDC /* CoreUIObject.swift in Sources */, D29DF2BE21E7BEA4003B2FB9 /* TopTabbar.m in Sources */, 014AA72E23C5059B006F3E93 /* StackCenteredPageTemplateModel.swift in Sources */, - 8DFB6D8B242A137600A3F715 /* (null) in Sources */, D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */, 011D959D2404536F000E3791 /* RuleAnyValueChangedModel.swift in Sources */, D260105923D0A92900764D80 /* ContainerProtocol.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 30995284..760a7a6c 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -140,8 +140,9 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnInternationalData.self, viewModelClass: ListThreeColumnInternationalDataModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) + // Designed Section Dividers MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalData.swift deleted file mode 100644 index 948bdb9b..00000000 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalData.swift +++ /dev/null @@ -1,70 +0,0 @@ -// -// ListThreeColumnInternationalData.swift -// MVMCoreUI -// -// Created by Kruthika KP on 24/03/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - - -@objcMembers public class ListThreeColumnInternationalData: TableViewCell { - - //----------------------------------------------------- - // MARK: - Outlets - //----------------------------------------------------- - var stack: Stack - let leftLabel = Label.createLabelRegularBodySmall(true) - let centerLabel = Label.createLabelRegularBodySmall(true) - let rightLabel = Label.createLabelRegularBodySmall(true) - let arrow = Arrow(frame: .zero) - - //----------------------------------------------------- - // MARK: - Initializers - //----------------------------------------------------- - public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 30, horizontalAlignment: .leading)), - (view: arrow, model: StackItemModel(percent: 4, horizontalAlignment: .trailing)), - (view: centerLabel, model: StackItemModel(percent: 46, horizontalAlignment: .leading)), - (view: rightLabel, model: StackItemModel(percent:30,horizontalAlignment: .center))], - axis: .horizontal,spacing: 2) - super.init(style: style, reuseIdentifier: reuseIdentifier) - } - - public required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - //----------------------------------------------------- - // MARK: - View Lifecycle - //----------------------------------------------------- - override open func setupView() { - super.setupView() - addMolecule(stack) - arrow.pinHeightAndWidth() - } - - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ - super.set(with: model, delegateObject, additionalData) - guard let model = model as? ListThreeColumnInternationalDataModel else { return } - leftLabel.set(with: model.leftLabel, delegateObject, additionalData) - centerLabel.set(with: model.centerLabel, delegateObject, additionalData) - rightLabel.set(with: model.rightLabel, delegateObject, additionalData) - arrow.set(with: model.arrow, delegateObject, additionalData) - stack.restack() - } - - open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { - return 90 - } - - open override func reset() { - super.reset() - leftLabel.styleRegularBodySmall(true) - centerLabel.styleRegularBodySmall(true) - rightLabel.styleRegularBodySmall(true) - arrow.reset() - } - -} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataModel.swift deleted file mode 100644 index 5a2ceff2..00000000 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataModel.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// ListThreeColumnInternationalDataModel.swift -// MVMCoreUI -// -// Created by Kruthika KP on 24/03/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -public class ListThreeColumnInternationalDataModel: ListItemModel, MoleculeModelProtocol { - - public static var identifier: String = "list3CIntData" - public var leftLabel: LabelModel - public var centerLabel: LabelModel - public var rightLabel: LabelModel - public var arrow: ArrowModel - - public init(leftLabel:LabelModel, centerLabel:LabelModel, rightLabel:LabelModel,arrow:ArrowModel){ - self.leftLabel = leftLabel - self.centerLabel = centerLabel - self.rightLabel = rightLabel - self.arrow = arrow - super.init() - } - - public override func setDefaults() { - super.setDefaults() - arrow.degrees = 50 - arrow.color = Color.init(uiColor: .mvmGreen) - } - - private enum CodingKeys: String, CodingKey{ - case moleculeName - case leftLabel - case centerLabel - case rightLabel - case arrow - } - - 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) - arrow = try typeContainer.decode(ArrowModel.self, forKey: .arrow) - 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) - try container.encode(arrow, forKey: .arrow) - } -} From 8e0641c547e5342f6de019b80bed279e3167e08c Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 6 Apr 2020 12:00:08 -0400 Subject: [PATCH 60/61] remove bad commit --- .../OtherHandlers/MoleculeObjectMapping.swift | 144 ------------------ 1 file changed, 144 deletions(-) delete mode 100644 MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift deleted file mode 100644 index 666a5c61..00000000 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ /dev/null @@ -1,144 +0,0 @@ -// -// MVMCoreUIMoleculeMappingObject+ModelMapping.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 10/28/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - -@objcMembers public class MoleculeObjectMapping: NSObject { - public static func registerObjects() { - // Stacks - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeStackView.self, viewModelClass: MoleculeStackModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Stack.self, viewModelClass: StackModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: UnOrderedList.self, viewModelClass: UnOrderedListModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: NumberedList.self, viewModelClass: NumberedListModel.self) - - // Label - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Label.self, viewModelClass: LabelModel.self) - // need to move labelattributemodel to different method - try? ModelRegistry.register(LabelAttributeFontModel.self) - try? ModelRegistry.register(LabelAttributeColorModel.self) - try? ModelRegistry.register(LabelAttributeImageModel.self) // We need to separate the registry by types due to collisions... - try? ModelRegistry.register(LabelAttributeUnderlineModel.self) - try? ModelRegistry.register(LabelAttributeStrikeThroughModel.self) - try? ModelRegistry.register(LabelAttributeActionModel.self) - - // Buttons - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: PillButton.self, viewModelClass: ButtonModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: TwoButtonView.self, viewModelClass: TwoButtonViewModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ExternalLink.self, viewModelClass: ExternalLinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Link.self, viewModelClass: LinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CaretLink.self, viewModelClass: CaretLinkModel.self) - - // Entry Field - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: TextEntryField.self, viewModelClass: TextEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MdnEntryField.self, viewModelClass: MdnEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DigitEntryField.self, viewModelClass: DigitEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ItemDropdownEntryField.self, viewModelClass: ItemDropdownEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DateDropdownEntryField.self, viewModelClass: DateDropdownEntryFieldModel.self) - - // Other Atoms - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ProgressBar.self, viewModelClass: ProgressBarModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MultiProgress.self, viewModelClass: MultiProgressBarModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CaretView.self, viewModelClass: CaretViewModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DashLine.self, viewModelClass: DashLineModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MFLoadImageView.self, viewModelClass: ImageViewModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Line.self, viewModelClass: LineModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: GraphView.self, viewModelClass: CircleProgressModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Toggle.self, viewModelClass: ToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CheckboxLabel.self, viewModelClass: CheckboxLabelModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Arrow.self, viewModelClass: ArrowModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RadioButton.self, viewModelClass: RadioButtonModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RadioButtonLabel.self, viewModelClass: RadioButtonLabelModel.self) - - // Horizontal Combination Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self) - - // Vertical Combination Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBody.self, viewModelClass: HeadlineBodyModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadLineBodyCaretLinkImage.self, viewModelClass: HeadlineBodyCaretLinkImageModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: EyebrowHeadlineBodyLink.self, viewModelClass: EyebrowHeadlineBodyLinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLink.self, viewModelClass: HeadlineBodyLinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self) - - // Left Right Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: LeftRightLabelView.self, viewModelClass: LeftRightLabelModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: LabelToggle.self, viewModelClass: LabelToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyToggle.self, viewModelClass: HeadlineBodyToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self) - - // List items - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DropDownFilterTableViewCell.self, viewModelClass: DropDownListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: AccordionMoleculeTableViewCell.self, viewModelClass: AccordionListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: TabsTableViewCell.self, viewModelClass: TabsListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListProgressBarData.self, viewModelClass: ListProgressBarDataModel.self) - - // Other Items - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeStackItem.self, viewModelClass: MoleculeStackItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StackItem.self, viewModelClass: StackItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeCollectionViewCell.self, viewModelClass: CarouselItemModel.self) - - // Other Container Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeHeaderView.self, viewModelClass: MoleculeHeaderModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: FooterView.self, viewModelClass: FooterModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Scroller.self, viewModelClass: ScrollerModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ModuleMolecule.self, viewModelClass: ModuleMoleculeModel.self) - - // Other Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DoughnutChartView.self, viewModelClass: DoughnutChartModel.self) - - // Other Organisms - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Carousel.self, viewModelClass: CarouselModel.self) - - // Designed List Items - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableTotalData.self, viewModelClass: ListRightVariableTotalDataModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextBodyText.self, viewModelClass: ListOneColumnFullWidthTextBodyTextModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnInternationalData.self, viewModelClass: ListThreeColumnInternationalDataModel.self) - - // Designed Section Dividers - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerTall.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerTallModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextDividerSubsection.self, viewModelClass: ListOneColumnFullWidthTextDividerSubsectionModel.self) - - // Designed Headers - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) - - // TODO: Need model - MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(MVMCoreUIPageControl.self, forKey: "barsPager" as NSString) - - // TODO: Need View - try? ModelRegistry.register(TabsModel.self) - - // Helper models - try? ModelRegistry.register(RuleRequiredModel.self) - try? ModelRegistry.register(RuleAnyRequiredModel.self) - try? ModelRegistry.register(RuleAnyValueChangedModel.self) - try? ModelRegistry.register(RuleAllValueChangedModel.self) - try? ModelRegistry.register(RuleEqualsModel.self) - try? ModelRegistry.register(RuleRegexModel.self) - - // Actions - try? ModelRegistry.register(ActionTopAlertModel.self) - try? ModelRegistry.register(ActionCollapseNotificationModel.self) - try? ModelRegistry.register(ActionOpenPanelModel.self) - } -} From 7d740c5cceedb8cf9e992790da6243d4bbbeaa77 Mon Sep 17 00:00:00 2001 From: "Khan, Arshad" Date: Mon, 6 Apr 2020 22:39:19 +0530 Subject: [PATCH 61/61] changing the priority as per feedback. --- .../BGImageHeadlineBodyButton.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButton.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButton.swift index 8a62409b..f1ec076c 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButton.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/BGImageHeadlineBodyButton.swift @@ -43,10 +43,10 @@ import Foundation headlineBody.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: 0).isActive = true headlineBody.topAnchor.constraint(equalTo: container.topAnchor, constant: 0).isActive = true - headlineBody.widthAnchor.constraint(equalTo: container.widthAnchor, multiplier: 0.67).isActive = true - let headLineBodyWidth = headlineBody.widthAnchor.constraint(lessThanOrEqualToConstant: maxWidth) - headLineBodyWidth.priority = UILayoutPriority(250) + let headLineBodyWidth = headlineBody.widthAnchor.constraint(equalTo: container.widthAnchor, multiplier: 0.67) + headLineBodyWidth.priority = UILayoutPriority(rawValue: 999) headLineBodyWidth.isActive = true + headlineBody.widthAnchor.constraint(lessThanOrEqualToConstant: maxWidth).isActive = true //Caret view button.translatesAutoresizingMaskIntoConstraints = false