From 47603e7a599ba67c0bf5640cbcb16a40d926c45f Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Fri, 21 Feb 2020 16:58:16 +0530 Subject: [PATCH 1/6] Added ListOneColumnFullWidthTextAllTextAndLinks molecule class and model files. --- MVMCoreUI.xcodeproj/project.pbxproj | 16 ++++ ...neColumnFullWidthTextAllTextAndLinks.swift | 74 +++++++++++++++++++ ...umnFullWidthTextAllTextAndLinksModel.swift | 57 ++++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 2 + 4 files changed, 149 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 4afd3a24..4f81feab 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -98,6 +98,8 @@ 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; }; 522679C123FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */; }; 522679C223FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679C023FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */; }; + 52267A0723FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */; }; + 52267A0923FFE28200906CBA /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52267A0823FFE28200906CBA /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; 5248BFEC23F12E350059236A /* ListThreeColumnPlanDataDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */; }; 5248BFED23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */; }; 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; @@ -428,6 +430,8 @@ 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 = ""; }; 522679C023FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinksModel.swift; sourceTree = ""; }; + 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinks.swift; sourceTree = ""; }; + 52267A0823FFE28200906CBA /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDivider.swift; sourceTree = ""; }; 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDividerModel.swift; sourceTree = ""; }; 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; @@ -763,6 +767,15 @@ path = Views; sourceTree = ""; }; + 52267A0523FFE0A900906CBA /* OneColumn */ = { + isa = PBXGroup; + children = ( + 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */, + 52267A0823FFE28200906CBA /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */, + ); + path = OneColumn; + sourceTree = ""; + }; 946EE1B5237B663A0036751F /* Extensions */ = { isa = PBXGroup; children = ( @@ -1006,6 +1019,7 @@ D22B38EC23F4E10700490EF6 /* SectionDividers */ = { isa = PBXGroup; children = ( + 52267A0523FFE0A900906CBA /* OneColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); path = SectionDividers; @@ -1672,6 +1686,7 @@ D2E2A98323D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift in Sources */, 012A88AD238C418100FE3DA1 /* TemplateProtocol.swift in Sources */, D29DF2B421E7B76D003B2FB9 /* MFLoadingSpinner.m in Sources */, + 52267A0923FFE28200906CBA /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */, D260106323D0C05000764D80 /* StackItemModel.swift in Sources */, D2E2A99823D8D63C000B42E6 /* ActionDetailWithImageModel.swift in Sources */, D2E2A99D23DA3217000B42E6 /* UIStackViewAlignment+Extension.swift in Sources */, @@ -1847,6 +1862,7 @@ 012A88F123985E0100FE3DA1 /* Color.swift in Sources */, 012A889C23889E8400FE3DA1 /* TemplateModelProtocol.swift in Sources */, D29770FC21F7C77400B2F0D0 /* MVMCoreUITextFieldView.m in Sources */, + 52267A0723FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift in Sources */, C003506123AA94CD00B6AC29 /* Button.swift in Sources */, DBC4391B224421A0001AB423 /* CaretLink.swift in Sources */, 0198F7A82256A80B0066C936 /* MFRadioButton.m in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift new file mode 100644 index 00000000..9827fed4 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -0,0 +1,74 @@ +// +// ListOneColumnFullWidthTextAllTextAndLinks.swift +// MVMCoreUI +// +// Created by Kruthika KP on 14/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers public class ListOneColumnFullWidthTextAllTextAndLinks: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + + let stack = Stack(frame: .zero) + let eyebrow = Label.commonLabelB3(true) + let headline = Label.commonLabelH3(true) + let subHeadline = Label.commonLabelB1(true) + let body = Label.commonLabelB2(true) + let link = Link() + + //----------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + + open override func updateView(_ size: CGFloat) { + super.updateView(size) + stack.updateView(size) + } + + override open func setupView() { + super.setupView() + guard stack.superview == nil else { + return + } + stack.translatesAutoresizingMaskIntoConstraints = false + stack.stackItems = [StackItem(andContain: eyebrow),StackItem(andContain: headline),StackItem(andContain: subHeadline),StackItem(andContain: body),StackItem(andContain: link)] + contentView.addSubview(stack) + containerHelper.constrainView(stack) + } + //---------------------------------------------------- + // MARK: - Molecule + //------------------------------------------------------ + + override open func reset() { + super.reset() + stack.reset() + eyebrow.styleB3(true) + headline.styleH3(true) + subHeadline.styleB1(true) + body.styleB2(true) + } + + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.setWithModel(model, delegateObject, additionalData) + guard let model = model as? ListOneColumnFullWidthTextAllTextAndLinksModel else { return} + eyebrow.setWithModel(model.eyebrow, delegateObject, additionalData) + headline.setWithModel(model.headline, delegateObject, additionalData) + subHeadline.setWithModel(model.subHeadline, delegateObject, additionalData) + body.setWithModel(model.body, delegateObject, additionalData) + link.setWithModel(model.link, delegateObject, additionalData) + + let stackModel = StackModel(molecules: [StackItemModel(gone: !eyebrow.hasText),StackItemModel(gone: !headline.hasText),StackItemModel(gone: !subHeadline.hasText),StackItemModel(gone: !body.hasText),StackItemModel(gone: (link.titleLabel?.text?.count ?? 0) == 0)]) + stack.model = stackModel + stackModel.spacing = 2 + stack.restack() + } + + public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift new file mode 100644 index 00000000..ebc87aa4 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift @@ -0,0 +1,57 @@ +// +// ListOneColumnFullWidthTextAllTextAndLinksModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 14/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListOneColumnFullWidthTextAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "list1CTxt" + public var eyebrow: LabelModel? + public var headline : LabelModel? + public var subHeadline: LabelModel? + public var body: LabelModel? + public var link : LinkModel? + + public init(eyebrow:LabelModel, headline: LabelModel, subHeadline: LabelModel, body: LabelModel, link: LinkModel) { + self.eyebrow = eyebrow + self.headline = headline + self.subHeadline = subHeadline + self.body = body + self.link = link + super.init() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case eyebrow + case headline + case subHeadline + case body + case link + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + eyebrow = try typeContainer.decode(LabelModel.self, forKey: .eyebrow) + headline = try typeContainer.decode(LabelModel.self, forKey: .headline) + subHeadline = try typeContainer.decode(LabelModel.self, forKey: .subHeadline) + body = try typeContainer.decode(LabelModel.self, forKey: .body) + link = try typeContainer.decode(LinkModel.self, forKey: .link) + 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(eyebrow, forKey: .eyebrow) + try container.encode(headline, forKey: .headline) + try container.encode(subHeadline, forKey: .subHeadline) + try container.encode(body, forKey: .body) + try container.encode(link, forKey: .link) + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 7ae80d49..0c82b7fe 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -55,6 +55,8 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) + // Vertical Combination Molecules From 2f94f3435ab3049471f8786e08d1851505331854 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Mon, 24 Feb 2020 22:04:28 +0530 Subject: [PATCH 2/6] Code changes as per condensed code feature branch. --- ...neColumnFullWidthTextAllTextAndLinks.swift | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index 9827fed4..8d588374 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -36,24 +36,15 @@ import Foundation return } stack.translatesAutoresizingMaskIntoConstraints = false - stack.stackItems = [StackItem(andContain: eyebrow),StackItem(andContain: headline),StackItem(andContain: subHeadline),StackItem(andContain: body),StackItem(andContain: link)] + stack.stackItems = [StackItem(andContain: eyebrow), + StackItem(andContain: headline), + StackItem(andContain: body), + StackItem(andContain: link)] contentView.addSubview(stack) - containerHelper.constrainView(stack) - } - //---------------------------------------------------- - // MARK: - Molecule - //------------------------------------------------------ - - override open func reset() { - super.reset() - stack.reset() - eyebrow.styleB3(true) - headline.styleH3(true) - subHeadline.styleB1(true) - body.styleB2(true) + addMolecule(stack) } - public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ super.setWithModel(model, delegateObject, additionalData) guard let model = model as? ListOneColumnFullWidthTextAllTextAndLinksModel else { return} eyebrow.setWithModel(model.eyebrow, delegateObject, additionalData) @@ -61,14 +52,25 @@ import Foundation subHeadline.setWithModel(model.subHeadline, delegateObject, additionalData) body.setWithModel(model.body, delegateObject, additionalData) link.setWithModel(model.link, delegateObject, additionalData) - - let stackModel = StackModel(molecules: [StackItemModel(gone: !eyebrow.hasText),StackItemModel(gone: !headline.hasText),StackItemModel(gone: !subHeadline.hasText),StackItemModel(gone: !body.hasText),StackItemModel(gone: (link.titleLabel?.text?.count ?? 0) == 0)]) + let stackModel = StackModel(molecules: [StackItemModel(gone: !eyebrow.hasText), + StackItemModel(gone: !headline.hasText), + StackItemModel(gone: !body.hasText), + StackItemModel(gone: (link.titleLabel?.text?.count ?? 0) == 0)]) stack.model = stackModel stackModel.spacing = 2 stack.restack() } - public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat?{ return 90 } + + open override func reset() { + super.reset() + stack.reset() + eyebrow.styleB3(true) + headline.styleH3(true) + subHeadline.styleB1(true) + body.styleB2(true) + } } From 9a8c510b7fc0a4c97e5268f6583a0912bc4782a4 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Mon, 24 Feb 2020 22:06:31 +0530 Subject: [PATCH 3/6] minor change --- .../OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index 8d588374..b10a9d65 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -40,7 +40,6 @@ import Foundation StackItem(andContain: headline), StackItem(andContain: body), StackItem(andContain: link)] - contentView.addSubview(stack) addMolecule(stack) } From fea1c2e9972ddbb220d6af95f50bb807638fdfb6 Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Tue, 25 Feb 2020 13:33:40 +0530 Subject: [PATCH 4/6] added subHeadline and changed the files order --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++++---- .../ListOneColumnFullWidthTextAllTextAndLinks.swift | 12 +++--------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 0fb1da3a..95bd45b6 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -99,11 +99,11 @@ 522679C123FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */; }; 522679C223FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679C023FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */; }; 52267A0723FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */; }; - 52267A0923FFE28200906CBA /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52267A0823FFE28200906CBA /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; 5248BFEC23F12E350059236A /* ListThreeColumnPlanDataDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */; }; 5248BFED23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */; }; 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 */; }; 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 */; }; @@ -433,11 +433,11 @@ 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = ""; }; 522679C023FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinksModel.swift; sourceTree = ""; }; 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinks.swift; sourceTree = ""; }; - 52267A0823FFE28200906CBA /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDivider.swift; sourceTree = ""; }; 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDividerModel.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 = ""; }; + 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; 9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftRightLabelModel.swift; sourceTree = ""; }; 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 = ""; }; @@ -775,8 +775,8 @@ 52267A0523FFE0A900906CBA /* OneColumn */ = { isa = PBXGroup; children = ( + 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */, 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */, - 52267A0823FFE28200906CBA /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */, ); path = OneColumn; sourceTree = ""; @@ -1692,7 +1692,6 @@ D2E2A98323D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift in Sources */, 012A88AD238C418100FE3DA1 /* TemplateProtocol.swift in Sources */, D29DF2B421E7B76D003B2FB9 /* MFLoadingSpinner.m in Sources */, - 52267A0923FFE28200906CBA /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */, D260106323D0C05000764D80 /* StackItemModel.swift in Sources */, D2E2A99823D8D63C000B42E6 /* ActionDetailWithImageModel.swift in Sources */, D2E2A99D23DA3217000B42E6 /* UIStackViewAlignment+Extension.swift in Sources */, @@ -1793,6 +1792,7 @@ 014AA72423C501E2006F3E93 /* MoleculeContainerModel.swift in Sources */, D29DF28321E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.m in Sources */, 011B58F223A2AE2C0085F53C /* DropDownListItemModel.swift in Sources */, + 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */, 94C2D9842386F3F80006CF46 /* LabelAttributeModel.swift in Sources */, 944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */, D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index b10a9d65..e13bdd8b 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -32,12 +32,9 @@ import Foundation override open func setupView() { super.setupView() - guard stack.superview == nil else { - return - } - stack.translatesAutoresizingMaskIntoConstraints = false stack.stackItems = [StackItem(andContain: eyebrow), StackItem(andContain: headline), + StackItem(andContain: subHeadline), StackItem(andContain: body), StackItem(andContain: link)] addMolecule(stack) @@ -53,6 +50,7 @@ import Foundation link.setWithModel(model.link, delegateObject, additionalData) let stackModel = StackModel(molecules: [StackItemModel(gone: !eyebrow.hasText), StackItemModel(gone: !headline.hasText), + StackItemModel(gone: !subHeadline.hasText), StackItemModel(gone: !body.hasText), StackItemModel(gone: (link.titleLabel?.text?.count ?? 0) == 0)]) stack.model = stackModel @@ -66,10 +64,6 @@ import Foundation open override func reset() { super.reset() - stack.reset() - eyebrow.styleB3(true) - headline.styleH3(true) - subHeadline.styleB1(true) - body.styleB2(true) + } } From 54782b187132f158fd9d955b1cc36e2168052500 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Tue, 25 Feb 2020 20:11:22 +0530 Subject: [PATCH 5/6] Changes in init method and spacing --- ...neColumnFullWidthTextAllTextAndLinks.swift | 16 +++++++----- ...umnFullWidthTextAllTextAndLinksModel.swift | 26 +++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index e13bdd8b..4b0e2e91 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -48,13 +48,12 @@ import Foundation subHeadline.setWithModel(model.subHeadline, delegateObject, additionalData) body.setWithModel(model.body, delegateObject, additionalData) link.setWithModel(model.link, delegateObject, additionalData) - let stackModel = StackModel(molecules: [StackItemModel(gone: !eyebrow.hasText), - StackItemModel(gone: !headline.hasText), - StackItemModel(gone: !subHeadline.hasText), - StackItemModel(gone: !body.hasText), - StackItemModel(gone: (link.titleLabel?.text?.count ?? 0) == 0)]) + let stackModel = StackModel(molecules: [StackItemModel(spacing: 2, gone: !eyebrow.hasText), + StackItemModel(spacing: 2, gone: !headline.hasText), + StackItemModel(spacing: 2, gone: !subHeadline.hasText), + StackItemModel(spacing: 2, gone: !body.hasText), + StackItemModel(spacing: 2, gone: (link.titleLabel?.text?.count ?? 0) == 0)]) stack.model = stackModel - stackModel.spacing = 2 stack.restack() } @@ -64,6 +63,9 @@ import Foundation open override func reset() { super.reset() - + eyebrow.styleB3(true) + headline.styleH3(true) + subHeadline.styleB1(true) + body.styleB2(true) } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift index ebc87aa4..47e482a0 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift @@ -15,8 +15,8 @@ public class ListOneColumnFullWidthTextAllTextAndLinksModel: ListItemModel, Mole public var subHeadline: LabelModel? public var body: LabelModel? public var link : LinkModel? - - public init(eyebrow:LabelModel, headline: LabelModel, subHeadline: LabelModel, body: LabelModel, link: LinkModel) { + + public init(eyebrow: LabelModel? = nil, headline: LabelModel? = nil, subHeadline: LabelModel? = nil, body: LabelModel? = nil, link: LinkModel? = nil) { self.eyebrow = eyebrow self.headline = headline self.subHeadline = subHeadline @@ -36,22 +36,22 @@ public class ListOneColumnFullWidthTextAllTextAndLinksModel: ListItemModel, Mole required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - eyebrow = try typeContainer.decode(LabelModel.self, forKey: .eyebrow) - headline = try typeContainer.decode(LabelModel.self, forKey: .headline) - subHeadline = try typeContainer.decode(LabelModel.self, forKey: .subHeadline) - body = try typeContainer.decode(LabelModel.self, forKey: .body) - link = try typeContainer.decode(LinkModel.self, forKey: .link) + eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow) + headline = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .headline) + subHeadline = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .subHeadline) + body = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body) + link = try typeContainer.decodeIfPresent(LinkModel.self, forKey: .link) 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(eyebrow, forKey: .eyebrow) - try container.encode(headline, forKey: .headline) - try container.encode(subHeadline, forKey: .subHeadline) - try container.encode(body, forKey: .body) - try container.encode(link, forKey: .link) + try container.encodeIfPresent(moleculeName, forKey: .moleculeName) + try container.encodeIfPresent(eyebrow, forKey: .eyebrow) + try container.encodeIfPresent(headline, forKey: .headline) + try container.encodeIfPresent(subHeadline, forKey: .subHeadline) + try container.encodeIfPresent(body, forKey: .body) + try container.encodeIfPresent(link, forKey: .link) } } From 2ec429974abd978b90adadb838a064154e99ffa0 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Tue, 25 Feb 2020 21:24:04 +0530 Subject: [PATCH 6/6] removing updateView. --- .../ListOneColumnFullWidthTextAllTextAndLinks.swift | 6 ------ 1 file changed, 6 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index 4b0e2e91..9e930396 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -24,12 +24,6 @@ import Foundation //----------------------------------------------------- // MARK: - View Lifecycle //------------------------------------------------------- - - open override func updateView(_ size: CGFloat) { - super.updateView(size) - stack.updateView(size) - } - override open func setupView() { super.setupView() stack.stackItems = [StackItem(andContain: eyebrow),