From a87926a8107d14007be23a5d3ef87f091ee82e23 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Mon, 10 Feb 2020 15:41:12 +0530 Subject: [PATCH 01/32] Story - 19072: List - Right Variable - Payments Initial Commit Added Molecule Class, Model Class --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++ .../RightVariablePaymentsList.swift | 106 ++++++++++++++++++ .../RightVariablePaymentsListModel.swift | 73 ++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 4 files changed, 188 insertions(+) create mode 100644 MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsList.swift create mode 100644 MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsListModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index f97e81aa..aacab776 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -123,6 +123,8 @@ 94F217B723E0BF6100A47C06 /* PrimaryButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */; }; 94FB966223D797DA003D482B /* MFTextButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 94FB966023D797DA003D482B /* MFTextButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; }; + AA11A41F23F15D3100D7962F /* RightVariablePaymentsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* RightVariablePaymentsList.swift */; }; + AA11A42123F15D7000D7962F /* RightVariablePaymentsListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* RightVariablePaymentsListModel.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 */; }; @@ -439,6 +441,8 @@ 94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PrimaryButtonView.m; sourceTree = ""; }; 94FB966023D797DA003D482B /* MFTextButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFTextButton.h; sourceTree = ""; }; 94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = ""; }; + AA11A41E23F15D3100D7962F /* RightVariablePaymentsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RightVariablePaymentsList.swift; sourceTree = ""; }; + AA11A42023F15D7000D7962F /* RightVariablePaymentsListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RightVariablePaymentsListModel.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 = ""; }; @@ -897,6 +901,8 @@ D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */, 01509D902327ECE600EF99AA /* CornerLabels.swift */, D224798823142BF2003FCCF9 /* ToggleMolecules */, + AA11A41E23F15D3100D7962F /* RightVariablePaymentsList.swift */, + AA11A42023F15D7000D7962F /* RightVariablePaymentsListModel.swift */, ); path = LeftRightViews; sourceTree = ""; @@ -1556,6 +1562,7 @@ DBC4391922442197001AB423 /* DashLine.swift in Sources */, 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */, D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */, + AA11A41F23F15D3100D7962F /* RightVariablePaymentsList.swift in Sources */, D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */, 0116A4E5228B19640094F3ED /* RadioButtonModel.swift in Sources */, 017BEB48236230DB0024EF95 /* MoleculeViewProtocol.swift in Sources */, @@ -1617,6 +1624,7 @@ D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */, 0A21DB85235E06EF00C160A2 /* MFTextField.m in Sources */, 014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */, + AA11A42123F15D7000D7962F /* RightVariablePaymentsListModel.swift in Sources */, 01EB369223609801006832FA /* MoleculeStackModel.swift in Sources */, 012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */, D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */, diff --git a/MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsList.swift b/MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsList.swift new file mode 100644 index 00000000..fe387ca2 --- /dev/null +++ b/MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsList.swift @@ -0,0 +1,106 @@ +// +// RightVariablePaymentsList.swift +// MVMCoreUI +// +// Created by Lekshmi S on 10/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers public class RightVariablePaymentsList : TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //------------------------------------------------------- + + let leftLabel = Label.commonLabelB2(true) + let rightImage = MFLoadImageView() + let containerView = ViewConstrainingView() + + //------------------------------------------------------ + // MARK: - Properties + //------------------------------------------------------ + + let cellHeight: CGFloat = 65.0 + let leftPadding: CGFloat = 35.0 + let rightPadding: CGFloat = 54.0 + let spaceBetweenLabelAndImage: CGFloat = 40.0 + let imageWidth: CGFloat = 56.0 + let imageHeight: CGFloat = 16.0 + + //------------------------------------------------------ + // MARK: - Initialization + //-------------------------------------------------------- + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + setupView() + } + + required public init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + setupView() + } + + //----------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + + open override func updateView(_ size: CGFloat) { + super.updateView(size) + containerView.updateView(size) + leftLabel.updateView(size) + rightImage.updateView(size) + } + + override open func setupView() { + super.setupView() + guard leftLabel.superview == nil else { + return + } + + containerView.translatesAutoresizingMaskIntoConstraints = false + contentView.heightAnchor.constraint(equalToConstant: cellHeight).isActive = true + contentView.addSubview(containerView) + containerView.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true + containerView.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true + containerView.topAnchor.constraint(equalTo: topAnchor).isActive = true + containerView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true + + containerView.addSubview(leftLabel) + containerView.addSubview(rightImage) + + leftLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor,constant: leftPadding).isActive = true + leftLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true + leftLabel.bottomAnchor.constraint(equalTo: containerView.bottomAnchor).isActive = true + + rightImage.leadingAnchor.constraint(equalTo: leftLabel.leadingAnchor,constant: spaceBetweenLabelAndImage).isActive = true + rightImage.centerYAnchor.constraint(equalTo: leftLabel.centerYAnchor).isActive = true + rightImage.widthAnchor.constraint(equalToConstant: imageWidth).isActive = true + rightImage.heightAnchor.constraint(equalToConstant: imageHeight).isActive = true + containerView.trailingAnchor.constraint(equalTo: rightImage.trailingAnchor,constant: rightPadding).isActive = true + } + + //---------------------------------------------------- + // MARK: - Molecule + //------------------------------------------------------ + + override open func reset() { + super.reset() + + leftLabel.reset() + rightImage.reset() + } + + open func setAsMolecule() { + setupView() + } + + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.setWithModel(model, delegateObject, additionalData) + guard let model = model as? RightVariablePaymentsListModel else { return} + leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData) + rightImage.setWithModel(model.image, delegateObject, additionalData) + } +} diff --git a/MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsListModel.swift b/MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsListModel.swift new file mode 100644 index 00000000..e3c9e889 --- /dev/null +++ b/MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsListModel.swift @@ -0,0 +1,73 @@ +// +// RightVariablePaymentsListModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 10/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class RightVariablePaymentsListModel: ContainerModel, ListItemModelProtocol { + + public var line: LineModel? + public var hideArrow: Bool? + public var backgroundColor: Color? + public var action: ActionModelProtocol? + + public static var identifier: String = "listRVImg" + public var image: ImageViewModel + public var leftLabel: LabelModel + + func setDefaults() { + if useHorizontalMargins == nil { + useHorizontalMargins = true + } + if useVerticalMargins == nil { + useVerticalMargins = true + } + if topMarginPadding == nil { + topMarginPadding = 24 + } + if bottomMarginPadding == nil { + bottomMarginPadding = 0 + } + } + + public init(image: ImageViewModel, leftLabel: LabelModel) { + self.image = image + self.leftLabel = leftLabel + super.init() + setDefaults() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case leftLabel + case image + case action + case hideArrow + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) + image = try typeContainer.decode(ImageViewModel.self, forKey: .image) + action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) + hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow) + 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(RightVariablePaymentsListModel.identifier, forKey: .moleculeName) + try container.encode(leftLabel, forKey: .leftLabel) + try container.encode(image, forKey: .image) + try container.encodeModelIfPresent(action, forKey: .action) + try container.encodeIfPresent(hideArrow, forKey: .hideArrow) + } + +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 8c1a36e3..4c384930 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -70,6 +70,7 @@ import Foundation 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) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RightVariablePaymentsList.self, viewModelClass: RightVariablePaymentsListModel.self) // List items MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: ListItemModel.self) From d683d420c8ee7eb19a37403340c36cbb22b5271f Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 11 Feb 2020 12:22:50 +0530 Subject: [PATCH 02/32] Code changes based on review: Modified class name according to Confluence Removed Initializers Removed extra spaces. --- MVMCoreUI.xcodeproj/project.pbxproj | 16 ++++----- ....swift => ListRightVariablePayments.swift} | 36 ++++++------------- ...t => ListRightVariablePaymentsModel.swift} | 13 ++----- .../OtherHandlers/MoleculeObjectMapping.swift | 2 +- 4 files changed, 22 insertions(+), 45 deletions(-) rename MVMCoreUI/Molecules/LeftRightViews/{RightVariablePaymentsList.swift => ListRightVariablePayments.swift} (78%) rename MVMCoreUI/Molecules/LeftRightViews/{RightVariablePaymentsListModel.swift => ListRightVariablePaymentsModel.swift} (83%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index aacab776..aa416225 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -123,8 +123,8 @@ 94F217B723E0BF6100A47C06 /* PrimaryButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */; }; 94FB966223D797DA003D482B /* MFTextButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 94FB966023D797DA003D482B /* MFTextButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; }; - AA11A41F23F15D3100D7962F /* RightVariablePaymentsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* RightVariablePaymentsList.swift */; }; - AA11A42123F15D7000D7962F /* RightVariablePaymentsListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* RightVariablePaymentsListModel.swift */; }; + AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */; }; + AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.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 */; }; @@ -441,8 +441,8 @@ 94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PrimaryButtonView.m; sourceTree = ""; }; 94FB966023D797DA003D482B /* MFTextButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFTextButton.h; sourceTree = ""; }; 94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = ""; }; - AA11A41E23F15D3100D7962F /* RightVariablePaymentsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RightVariablePaymentsList.swift; sourceTree = ""; }; - AA11A42023F15D7000D7962F /* RightVariablePaymentsListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RightVariablePaymentsListModel.swift; 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 = ""; }; 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 = ""; }; @@ -901,8 +901,8 @@ D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */, 01509D902327ECE600EF99AA /* CornerLabels.swift */, D224798823142BF2003FCCF9 /* ToggleMolecules */, - AA11A41E23F15D3100D7962F /* RightVariablePaymentsList.swift */, - AA11A42023F15D7000D7962F /* RightVariablePaymentsListModel.swift */, + AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */, + AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */, ); path = LeftRightViews; sourceTree = ""; @@ -1562,7 +1562,7 @@ DBC4391922442197001AB423 /* DashLine.swift in Sources */, 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */, D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */, - AA11A41F23F15D3100D7962F /* RightVariablePaymentsList.swift in Sources */, + AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */, D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */, 0116A4E5228B19640094F3ED /* RadioButtonModel.swift in Sources */, 017BEB48236230DB0024EF95 /* MoleculeViewProtocol.swift in Sources */, @@ -1624,7 +1624,7 @@ D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */, 0A21DB85235E06EF00C160A2 /* MFTextField.m in Sources */, 014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */, - AA11A42123F15D7000D7962F /* RightVariablePaymentsListModel.swift in Sources */, + AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */, 01EB369223609801006832FA /* MoleculeStackModel.swift in Sources */, 012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */, D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */, diff --git a/MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsList.swift b/MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePayments.swift similarity index 78% rename from MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsList.swift rename to MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePayments.swift index fe387ca2..5eebb1e1 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsList.swift +++ b/MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePayments.swift @@ -1,5 +1,5 @@ // -// RightVariablePaymentsList.swift +// ListRightVariablePayments.swift // MVMCoreUI // // Created by Lekshmi S on 10/02/20. @@ -8,7 +8,7 @@ import Foundation -@objcMembers public class RightVariablePaymentsList : TableViewCell { +@objcMembers public class ListRightVariablePayments: TableViewCell { //----------------------------------------------------- // MARK: - Outlets @@ -16,7 +16,7 @@ import Foundation let leftLabel = Label.commonLabelB2(true) let rightImage = MFLoadImageView() - let containerView = ViewConstrainingView() + let containerView = Container() //------------------------------------------------------ // MARK: - Properties @@ -24,25 +24,11 @@ import Foundation let cellHeight: CGFloat = 65.0 let leftPadding: CGFloat = 35.0 - let rightPadding: CGFloat = 54.0 + let rightPadding: CGFloat = PaddingNine let spaceBetweenLabelAndImage: CGFloat = 40.0 let imageWidth: CGFloat = 56.0 let imageHeight: CGFloat = 16.0 - //------------------------------------------------------ - // MARK: - Initialization - //-------------------------------------------------------- - - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - setupView() - } - - required public init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - setupView() - } - //----------------------------------------------------- // MARK: - View Lifecycle //------------------------------------------------------- @@ -59,10 +45,11 @@ import Foundation guard leftLabel.superview == nil else { return } - containerView.translatesAutoresizingMaskIntoConstraints = false contentView.heightAnchor.constraint(equalToConstant: cellHeight).isActive = true contentView.addSubview(containerView) + + //containerView constraints containerView.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true containerView.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true containerView.topAnchor.constraint(equalTo: topAnchor).isActive = true @@ -71,11 +58,13 @@ import Foundation containerView.addSubview(leftLabel) containerView.addSubview(rightImage) + //leftLabel constraints leftLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor,constant: leftPadding).isActive = true leftLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true leftLabel.bottomAnchor.constraint(equalTo: containerView.bottomAnchor).isActive = true - rightImage.leadingAnchor.constraint(equalTo: leftLabel.leadingAnchor,constant: spaceBetweenLabelAndImage).isActive = true + //rightImage constraints + rightImage.leadingAnchor.constraint(greaterThanOrEqualTo: leftLabel.trailingAnchor,constant: spaceBetweenLabelAndImage).isActive = true rightImage.centerYAnchor.constraint(equalTo: leftLabel.centerYAnchor).isActive = true rightImage.widthAnchor.constraint(equalToConstant: imageWidth).isActive = true rightImage.heightAnchor.constraint(equalToConstant: imageHeight).isActive = true @@ -88,18 +77,13 @@ import Foundation override open func reset() { super.reset() - leftLabel.reset() rightImage.reset() } - open func setAsMolecule() { - setupView() - } - public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.setWithModel(model, delegateObject, additionalData) - guard let model = model as? RightVariablePaymentsListModel else { return} + guard let model = model as? ListRightVariablePaymentsModel else { return} leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData) rightImage.setWithModel(model.image, delegateObject, additionalData) } diff --git a/MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsListModel.swift b/MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePaymentsModel.swift similarity index 83% rename from MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsListModel.swift rename to MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePaymentsModel.swift index e3c9e889..db4dabc4 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/RightVariablePaymentsListModel.swift +++ b/MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePaymentsModel.swift @@ -1,5 +1,5 @@ // -// RightVariablePaymentsListModel.swift +// ListRightVariablePaymentsModel.swift // MVMCoreUI // // Created by Lekshmi S on 10/02/20. @@ -8,13 +8,12 @@ import Foundation -public class RightVariablePaymentsListModel: ContainerModel, ListItemModelProtocol { +public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtocol { public var line: LineModel? public var hideArrow: Bool? public var backgroundColor: Color? public var action: ActionModelProtocol? - public static var identifier: String = "listRVImg" public var image: ImageViewModel public var leftLabel: LabelModel @@ -38,7 +37,6 @@ public class RightVariablePaymentsListModel: ContainerModel, ListItemModelProtoc self.image = image self.leftLabel = leftLabel super.init() - setDefaults() } private enum CodingKeys: String, CodingKey { @@ -46,7 +44,6 @@ public class RightVariablePaymentsListModel: ContainerModel, ListItemModelProtoc case leftLabel case image case action - case hideArrow } required public init(from decoder: Decoder) throws { @@ -54,20 +51,16 @@ public class RightVariablePaymentsListModel: ContainerModel, ListItemModelProtoc leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) image = try typeContainer.decode(ImageViewModel.self, forKey: .image) action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) - hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow) 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(RightVariablePaymentsListModel.identifier, forKey: .moleculeName) + try container.encode(ListRightVariablePaymentsModel.identifier, forKey: .moleculeName) try container.encode(leftLabel, forKey: .leftLabel) try container.encode(image, forKey: .image) try container.encodeModelIfPresent(action, forKey: .action) - try container.encodeIfPresent(hideArrow, forKey: .hideArrow) } - } diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 4c384930..c3cf76be 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -70,7 +70,7 @@ import Foundation 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) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RightVariablePaymentsList.self, viewModelClass: RightVariablePaymentsListModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) // List items MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: ListItemModel.self) From c9539814060ce0b2c17dff24c24f540b449e5bbc Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 13 Feb 2020 09:00:37 +0530 Subject: [PATCH 03/32] Removed container and added stackmodel --- MVMCoreUI.xcodeproj/project.pbxproj | 12 ++++- .../ListRightVariablePayments.swift | 49 +++++++------------ .../ListRightVariablePaymentsModel.swift | 13 +++-- 3 files changed, 35 insertions(+), 39 deletions(-) rename MVMCoreUI/Molecules/{LeftRightViews => DesignedComponents/List/RightVariable}/ListRightVariablePayments.swift (52%) rename MVMCoreUI/Molecules/{LeftRightViews => DesignedComponents/List/RightVariable}/ListRightVariablePaymentsModel.swift (86%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 79fb28b4..b209d013 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -781,6 +781,15 @@ name = "Recovered References"; sourceTree = ""; }; + AA4FC2A323F4F69600E251DB /* RightVariable */ = { + isa = PBXGroup; + children = ( + AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */, + AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */, + ); + path = RightVariable; + sourceTree = ""; + }; D213347423842FE3008E41B3 /* Controllers */ = { isa = PBXGroup; children = ( @@ -909,8 +918,6 @@ D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */, 01509D902327ECE600EF99AA /* CornerLabels.swift */, D224798823142BF2003FCCF9 /* ToggleMolecules */, - AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */, - AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */, ); path = LeftRightViews; sourceTree = ""; @@ -964,6 +971,7 @@ D22B38EA23F4E08B00490EF6 /* List */ = { isa = PBXGroup; children = ( + AA4FC2A323F4F69600E251DB /* RightVariable */, D22B38EB23F4E0AE00490EF6 /* LeftVariable */, ); path = List; diff --git a/MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift similarity index 52% rename from MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePayments.swift rename to MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 5eebb1e1..851a2137 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -16,7 +16,7 @@ import Foundation let leftLabel = Label.commonLabelB2(true) let rightImage = MFLoadImageView() - let containerView = Container() + let stack = Stack(frame: .zero) //------------------------------------------------------ // MARK: - Properties @@ -35,9 +35,7 @@ import Foundation open override func updateView(_ size: CGFloat) { super.updateView(size) - containerView.updateView(size) - leftLabel.updateView(size) - rightImage.updateView(size) + stack.updateView(size) } override open func setupView() { @@ -45,30 +43,12 @@ import Foundation guard leftLabel.superview == nil else { return } - containerView.translatesAutoresizingMaskIntoConstraints = false - contentView.heightAnchor.constraint(equalToConstant: cellHeight).isActive = true - contentView.addSubview(containerView) - - //containerView constraints - containerView.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true - containerView.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true - containerView.topAnchor.constraint(equalTo: topAnchor).isActive = true - containerView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true - - containerView.addSubview(leftLabel) - containerView.addSubview(rightImage) - - //leftLabel constraints - leftLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor,constant: leftPadding).isActive = true - leftLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true - leftLabel.bottomAnchor.constraint(equalTo: containerView.bottomAnchor).isActive = true - - //rightImage constraints - rightImage.leadingAnchor.constraint(greaterThanOrEqualTo: leftLabel.trailingAnchor,constant: spaceBetweenLabelAndImage).isActive = true - rightImage.centerYAnchor.constraint(equalTo: leftLabel.centerYAnchor).isActive = true - rightImage.widthAnchor.constraint(equalToConstant: imageWidth).isActive = true - rightImage.heightAnchor.constraint(equalToConstant: imageHeight).isActive = true - containerView.trailingAnchor.constraint(equalTo: rightImage.trailingAnchor,constant: rightPadding).isActive = true + stack.translatesAutoresizingMaskIntoConstraints = false + stack.stackItems = [StackItem(andContain: leftLabel),StackItem(andContain: rightImage)] + contentView.addSubview(stack) + containerHelper.constrainView(stack) + leftLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal) + rightImage.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal) } //---------------------------------------------------- @@ -77,8 +57,7 @@ import Foundation override open func reset() { super.reset() - leftLabel.reset() - rightImage.reset() + stack.reset() } public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { @@ -86,5 +65,15 @@ import Foundation guard let model = model as? ListRightVariablePaymentsModel else { return} leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData) rightImage.setWithModel(model.image, delegateObject, additionalData) + + // Create a stack model to use for the internal stack and set the alignment of label and image + let leftLabel = StackItemModel() + leftLabel.horizontalAlignment = .fill + let rightImage = StackItemModel() + rightImage.horizontalAlignment = .trailing + let stackModel = StackModel(molecules: [leftLabel,rightLabel]) + stackModel.axis = .horizontal + stack.model = stackModel + stack.restack() } } diff --git a/MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift similarity index 86% rename from MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePaymentsModel.swift rename to MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index db4dabc4..ef0693d0 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -11,7 +11,8 @@ import Foundation public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtocol { public var line: LineModel? - public var hideArrow: Bool? + public var style: String? = "standard" + public var hideArrow: Bool? = false public var backgroundColor: Color? public var action: ActionModelProtocol? public static var identifier: String = "listRVImg" @@ -25,11 +26,8 @@ public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtoc if useVerticalMargins == nil { useVerticalMargins = true } - if topMarginPadding == nil { - topMarginPadding = 24 - } - if bottomMarginPadding == nil { - bottomMarginPadding = 0 + if image.height == nil { + image.height = 16.0 } } @@ -37,6 +35,7 @@ public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtoc self.image = image self.leftLabel = leftLabel super.init() + setDefaults() } private enum CodingKeys: String, CodingKey { @@ -58,7 +57,7 @@ public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtoc public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(ListRightVariablePaymentsModel.identifier, forKey: .moleculeName) + try container.encode(moleculeName, forKey: .moleculeName) try container.encode(leftLabel, forKey: .leftLabel) try container.encode(image, forKey: .image) try container.encodeModelIfPresent(action, forKey: .action) From d0d8fa54cad223846be705ced3d055a13f4b1959 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 13 Feb 2020 12:12:12 +0530 Subject: [PATCH 04/32] Code fixes and removed unwanted code. --- .../ListRightVariablePayments.swift | 19 ++++++------------- .../ListRightVariablePaymentsModel.swift | 3 +++ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 851a2137..2fd75a66 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -15,20 +15,9 @@ import Foundation //------------------------------------------------------- let leftLabel = Label.commonLabelB2(true) - let rightImage = MFLoadImageView() + let rightImage = MFLoadImageView(pinnedEdges: .all) let stack = Stack(frame: .zero) - //------------------------------------------------------ - // MARK: - Properties - //------------------------------------------------------ - - let cellHeight: CGFloat = 65.0 - let leftPadding: CGFloat = 35.0 - let rightPadding: CGFloat = PaddingNine - let spaceBetweenLabelAndImage: CGFloat = 40.0 - let imageWidth: CGFloat = 56.0 - let imageHeight: CGFloat = 16.0 - //----------------------------------------------------- // MARK: - View Lifecycle //------------------------------------------------------- @@ -71,9 +60,13 @@ import Foundation leftLabel.horizontalAlignment = .fill let rightImage = StackItemModel() rightImage.horizontalAlignment = .trailing - let stackModel = StackModel(molecules: [leftLabel,rightLabel]) + let stackModel = StackModel(molecules: [leftLabel,rightImage]) stackModel.axis = .horizontal stack.model = stackModel stack.restack() } + + public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 65 + } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index ef0693d0..08a6f3cb 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -29,6 +29,9 @@ public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtoc if image.height == nil { image.height = 16.0 } + if image.width == nil { + image.height = 56.0 + } } public init(image: ImageViewModel, leftLabel: LabelModel) { From 5b3e213ed61335b1ad2641d85a7da670faa44139 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 13 Feb 2020 12:59:11 +0530 Subject: [PATCH 05/32] Removed constraints and prioritylevel as per review comments. --- .../List/RightVariable/ListRightVariablePayments.swift | 4 +--- .../List/RightVariable/ListRightVariablePaymentsModel.swift | 6 ------ 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 2fd75a66..34928e24 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -36,8 +36,6 @@ import Foundation stack.stackItems = [StackItem(andContain: leftLabel),StackItem(andContain: rightImage)] contentView.addSubview(stack) containerHelper.constrainView(stack) - leftLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal) - rightImage.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal) } //---------------------------------------------------- @@ -57,7 +55,7 @@ import Foundation // Create a stack model to use for the internal stack and set the alignment of label and image let leftLabel = StackItemModel() - leftLabel.horizontalAlignment = .fill + leftLabel.horizontalAlignment = .leading let rightImage = StackItemModel() rightImage.horizontalAlignment = .trailing let stackModel = StackModel(molecules: [leftLabel,rightImage]) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index 08a6f3cb..3478cda1 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -26,12 +26,6 @@ public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtoc if useVerticalMargins == nil { useVerticalMargins = true } - if image.height == nil { - image.height = 16.0 - } - if image.width == nil { - image.height = 56.0 - } } public init(image: ImageViewModel, leftLabel: LabelModel) { From ca39be5643dfee4331c417ac7f5a7d8d66af519e Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Thu, 13 Feb 2020 19:41:11 +0530 Subject: [PATCH 06/32] Code Fixes after comments. --- .../List/RightVariable/ListRightVariablePayments.swift | 2 +- .../List/RightVariable/ListRightVariablePaymentsModel.swift | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 34928e24..626e8d42 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -14,7 +14,7 @@ import Foundation // MARK: - Outlets //------------------------------------------------------- - let leftLabel = Label.commonLabelB2(true) + let leftLabel = Label.commonLabelB1(true) let rightImage = MFLoadImageView(pinnedEdges: .all) let stack = Stack(frame: .zero) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index 3478cda1..97f8e1d2 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -40,6 +40,7 @@ public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtoc case leftLabel case image case action + case backgroundColor } required public init(from decoder: Decoder) throws { @@ -47,6 +48,7 @@ public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtoc leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) image = try typeContainer.decode(ImageViewModel.self, forKey: .image) action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) try super.init(from: decoder) setDefaults() } @@ -58,5 +60,7 @@ public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtoc try container.encode(leftLabel, forKey: .leftLabel) try container.encode(image, forKey: .image) try container.encodeModelIfPresent(action, forKey: .action) + try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) + } } From 23b2df3c825640d943ad9c1f6c3647a201152787 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Fri, 14 Feb 2020 12:35:43 +0530 Subject: [PATCH 07/32] Code commit - Conforming to ListItemModel and MoleculeModelProtocol based on review comments. --- .../ListRightVariablePayments.swift | 4 +-- .../ListRightVariablePaymentsModel.swift | 25 +------------------ 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 626e8d42..5f2870ec 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -54,9 +54,9 @@ import Foundation rightImage.setWithModel(model.image, delegateObject, additionalData) // Create a stack model to use for the internal stack and set the alignment of label and image - let leftLabel = StackItemModel() + let leftLabel = StackItemModel(percent: 60) leftLabel.horizontalAlignment = .leading - let rightImage = StackItemModel() + let rightImage = StackItemModel(percent: 40) rightImage.horizontalAlignment = .trailing let stackModel = StackModel(molecules: [leftLabel,rightImage]) stackModel.axis = .horizontal diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index 97f8e1d2..23545142 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -8,49 +8,29 @@ import Foundation -public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtocol { +public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtocol { - public var line: LineModel? - public var style: String? = "standard" - public var hideArrow: Bool? = false - public var backgroundColor: Color? - public var action: ActionModelProtocol? public static var identifier: String = "listRVImg" public var image: ImageViewModel public var leftLabel: LabelModel - func setDefaults() { - if useHorizontalMargins == nil { - useHorizontalMargins = true - } - if useVerticalMargins == nil { - useVerticalMargins = true - } - } - public init(image: ImageViewModel, leftLabel: LabelModel) { self.image = image self.leftLabel = leftLabel super.init() - setDefaults() } private enum CodingKeys: String, CodingKey { case moleculeName case leftLabel case image - case action - case backgroundColor } required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) image = try typeContainer.decode(ImageViewModel.self, forKey: .image) - action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) try super.init(from: decoder) - setDefaults() } public override func encode(to encoder: Encoder) throws { @@ -59,8 +39,5 @@ public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtoc try container.encode(moleculeName, forKey: .moleculeName) try container.encode(leftLabel, forKey: .leftLabel) try container.encode(image, forKey: .image) - try container.encodeModelIfPresent(action, forKey: .action) - try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) - } } From 0d6322b69312171dac883de1baed58ea8d2dccae Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Fri, 14 Feb 2020 16:02:05 +0530 Subject: [PATCH 08/32] Removed percent for stackitems. --- .../List/RightVariable/ListRightVariablePayments.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 5f2870ec..626e8d42 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -54,9 +54,9 @@ import Foundation rightImage.setWithModel(model.image, delegateObject, additionalData) // Create a stack model to use for the internal stack and set the alignment of label and image - let leftLabel = StackItemModel(percent: 60) + let leftLabel = StackItemModel() leftLabel.horizontalAlignment = .leading - let rightImage = StackItemModel(percent: 40) + let rightImage = StackItemModel() rightImage.horizontalAlignment = .trailing let stackModel = StackModel(molecules: [leftLabel,rightImage]) stackModel.axis = .horizontal From 21fc9c1802385206368ec37e9768d77403524e69 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Fri, 14 Feb 2020 17:46:56 +0530 Subject: [PATCH 09/32] Adding up the percentages for stacks. --- .../List/RightVariable/ListRightVariablePayments.swift | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 626e8d42..e46cc469 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -37,16 +37,14 @@ import Foundation contentView.addSubview(stack) containerHelper.constrainView(stack) } - //---------------------------------------------------- // MARK: - Molecule //------------------------------------------------------ - override open func reset() { super.reset() stack.reset() } - +   public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.setWithModel(model, delegateObject, additionalData) guard let model = model as? ListRightVariablePaymentsModel else { return} @@ -54,9 +52,9 @@ import Foundation rightImage.setWithModel(model.image, delegateObject, additionalData) // Create a stack model to use for the internal stack and set the alignment of label and image - let leftLabel = StackItemModel() + let leftLabel = StackItemModel(percent: 70) leftLabel.horizontalAlignment = .leading - let rightImage = StackItemModel() + let rightImage = StackItemModel(percent: 30) rightImage.horizontalAlignment = .trailing let stackModel = StackModel(molecules: [leftLabel,rightImage]) stackModel.axis = .horizontal From 273b1317145fc83d7dcdf6c1890bc5e861b906a8 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Mon, 17 Feb 2020 22:50:43 +0530 Subject: [PATCH 10/32] Code commit - changes has to be done to model. --- MVMCoreUI/Atoms/Views/ImageViewModel.swift | 4 ++++ .../List/RightVariable/ListRightVariablePayments.swift | 5 +++-- .../RightVariable/ListRightVariablePaymentsModel.swift | 10 ++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ImageViewModel.swift b/MVMCoreUI/Atoms/Views/ImageViewModel.swift index ce46a930..c6eb9668 100644 --- a/MVMCoreUI/Atoms/Views/ImageViewModel.swift +++ b/MVMCoreUI/Atoms/Views/ImageViewModel.swift @@ -18,4 +18,8 @@ import Foundation public var imageFormat: String? public var width: CGFloat? public var height: CGFloat? + + public init(image: String) { + self.image = image + } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index e46cc469..91703fd7 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -36,6 +36,7 @@ import Foundation stack.stackItems = [StackItem(andContain: leftLabel),StackItem(andContain: rightImage)] contentView.addSubview(stack) containerHelper.constrainView(stack) + } //---------------------------------------------------- // MARK: - Molecule @@ -52,9 +53,9 @@ import Foundation rightImage.setWithModel(model.image, delegateObject, additionalData) // Create a stack model to use for the internal stack and set the alignment of label and image - let leftLabel = StackItemModel(percent: 70) + let leftLabel = StackItemModel() leftLabel.horizontalAlignment = .leading - let rightImage = StackItemModel(percent: 30) + let rightImage = StackItemModel() rightImage.horizontalAlignment = .trailing let stackModel = StackModel(molecules: [leftLabel,rightImage]) stackModel.axis = .horizontal diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index 23545142..422cd193 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -15,11 +15,17 @@ public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtoco public var leftLabel: LabelModel public init(image: ImageViewModel, leftLabel: LabelModel) { - self.image = image self.leftLabel = leftLabel + self.image = image super.init() } + func createPayPalImage() -> ImageViewModel { + let image = ImageViewModel(image: "imagename_paypal") + image.width = 30.0 + return image + } + private enum CodingKeys: String, CodingKey { case moleculeName case leftLabel @@ -29,7 +35,7 @@ public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtoco required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) - image = try typeContainer.decode(ImageViewModel.self, forKey: .image) + image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) ?? createPayPalImage() try super.init(from: decoder) } From d8acbec04615cb80f00d8215420f44630336e09f Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Mon, 17 Feb 2020 19:07:23 -0500 Subject: [PATCH 11/32] fixes --- .../MFViewController+Model.swift | 4 - MVMCoreUI/BaseControllers/MFViewController.h | 1 + MVMCoreUI/BaseControllers/MFViewController.m | 4 + .../TwoButtonViewModel.swift | 4 +- .../OtherHandlers/IsaacLandingTemplate.swift | 212 ++++++++++++++++++ .../Templates/IsaacLandingTemplate.swift | 192 ++++++++++++++++ .../Templates/MoleculeListTemplate.swift | 4 +- .../Templates/MoleculeStackTemplate.swift | 4 +- MVMCoreUI/Templates/ThreeLayerTemplate.swift | 5 +- 9 files changed, 418 insertions(+), 12 deletions(-) create mode 100644 MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift create mode 100644 MVMCoreUI/Templates/IsaacLandingTemplate.swift diff --git a/MVMCoreUI/BaseControllers/MFViewController+Model.swift b/MVMCoreUI/BaseControllers/MFViewController+Model.swift index 1ddbd4ab..e70e68f6 100644 --- a/MVMCoreUI/BaseControllers/MFViewController+Model.swift +++ b/MVMCoreUI/BaseControllers/MFViewController+Model.swift @@ -37,7 +37,3 @@ extension MFViewController: MoleculeDelegateProtocol { @objc public func removeMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) { } } - -public extension MFViewController { - @objc func parsePageJSON() throws { } -} diff --git a/MVMCoreUI/BaseControllers/MFViewController.h b/MVMCoreUI/BaseControllers/MFViewController.h index cd96a07f..ee38cf2b 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.h +++ b/MVMCoreUI/BaseControllers/MFViewController.h @@ -277,6 +277,7 @@ // subclass to set up intro animations - (void)setupIntroAnimations; +- (void)parsePageJSONAndReturnError:(NSError * _Nullable * _Nullable)error; @end diff --git a/MVMCoreUI/BaseControllers/MFViewController.m b/MVMCoreUI/BaseControllers/MFViewController.m index 09700268..af2db33c 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.m +++ b/MVMCoreUI/BaseControllers/MFViewController.m @@ -112,6 +112,10 @@ return [MFViewController verifyRequiredModulesLoadedForLoadObject:loadObject error:error]; } +- (void)parsePageJSONAndReturnError:(NSError * _Nullable * _Nullable)error { + +} + // Sets the screen to use the screen heading. // it is required in device flow, where we are showing greeting name as screen heading, // device details screen heading needs to be updated/refreshed again, if user has changed device nick name diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift b/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift index 057203e9..d4cba24c 100644 --- a/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift +++ b/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift @@ -22,8 +22,8 @@ public class TwoButtonViewModel: MoleculeModelProtocol { } public init(_ primaryButton: ButtonModel?, _ secondaryButton: ButtonModel?) { - self.primaryButton = primaryButton - self.secondaryButton = secondaryButton + self.primaryButton = primaryButton + self.secondaryButton = secondaryButton } required public init(from decoder: Decoder) throws { diff --git a/MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift b/MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift new file mode 100644 index 00000000..154cfdfd --- /dev/null +++ b/MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift @@ -0,0 +1,212 @@ +// +// IsaacLandingTemplate.swift +// MVMCoreUI +// +// Created by Suresh, Kamlesh on 2/13/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +import MVMCoreUI +import MVMCore + +open class IsaacLandingTemplate: MoleculeListTemplate { + + open override func parsePageJSONAndReturnError(_ error: NSErrorPointer) { + guard let pageJSON = self.loadObject?.pageJSON else { return } + + var listItems: [MoleculeListItemModel] = [] + (pageJSON.arrayForKey("items") as? [[AnyHashable: Any]])?.forEach { (itemJson) in + if let item = getListItem(itemJson) { + listItems.append(item) + } + } + + let template = ListPageTemplateModel(pageType: pageJSON.stringForkey(KeyPageType), + screenHeading: pageJSON.stringForkey(KeyScreenHeading), + molecules: listItems) + + let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" + template.footer = setFooter(pageJSON, template) + self.templateModel = template + + DispatchQueue.main.async { [weak self] in + self?.view.backgroundColor = UIColor.mfGet(forHex: backgroudColorString) + } + } +// public func parseTemplateJSON() throws { +// guard let pageJSON = self.loadObject?.pageJSON else { return } +// +// var listItems: [MoleculeListItemModel] = [] +// (pageJSON.arrayForKey("items") as? [[AnyHashable: Any]])?.forEach { (itemJson) in +// if let item = getListItem(itemJson) { +// listItems.append(item) +// } +// } +// +// let template = ListPageTemplateModel(pageType: pageJSON.stringForkey(KeyPageType), +// screenHeading: pageJSON.stringForkey(KeyScreenHeading), +// molecules: listItems) +// +// let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" +// template.footer = setFooter(pageJSON, template) +// self.templateModel = template +// +// DispatchQueue.main.async { [weak self] in +// self?.view.backgroundColor = UIColor.mfGet(forHex: backgroudColorString) +// } +// } + + func setFooter(_ pageJSON: [AnyHashable: Any], _ template: ListPageTemplateModel) -> FooterModel? { + + let primaryButtonBGColor = pageJSON.optionalStringForKey("primaryButtonBGColor") ?? "#FFFFFF" + let primaryButtonTextColor = pageJSON.optionalStringForKey("primaryButtonTextColor") ?? "#000000" + + let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" + if let buttonMap = pageJSON.optionalDictionaryForKey("ButtonMap") { + let twoButtonModel = TwoButtonViewModel(nil, nil) + + if let primarybutton = buttonMap.optionalDictionaryForKey(KeyPrimaryButton) { + let buttonDict: [String : Any] = ["title": primarybutton.stringForkey(KeyTitle), + "action": primarybutton, + "moleculeName": "button"] + if let data = try? JSONSerialization.data(withJSONObject: buttonDict) { + let decoder = JSONDecoder() + twoButtonModel.primaryButton = try? decoder.decode(ButtonModel.self, from: data) + twoButtonModel.primaryButton?.fillColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonBGColor)) + twoButtonModel.primaryButton?.textColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonTextColor)) + } + } + if let secondaryButton = buttonMap.optionalDictionaryForKey(KeySecondaryButton) { + let buttonDict: [String : Any] = ["title": secondaryButton.stringForkey(KeyTitle), + "action": secondaryButton, + "moleculeName": "button"] + if let data = try? JSONSerialization.data(withJSONObject: buttonDict) { + let decoder = JSONDecoder() + twoButtonModel.secondaryButton = try? decoder.decode(ButtonModel.self, from: data) + twoButtonModel.secondaryButton?.fillColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonTextColor)) + twoButtonModel.secondaryButton?.textColor = Color(uiColor: UIColor.mfGet(forHex:primaryButtonBGColor)) + } + } + + let footerStack = MoleculeStackModel(molecules: [MoleculeStackItemModel(with:LineModel(type: .standard)), + MoleculeStackItemModel(with: twoButtonModel)]) + footerStack.useHorizontalMargins = false + footerStack.spacing = PaddingFour + + let footer = FooterModel(with: footerStack) + footer.useHorizontalMargins = false + footer.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) + return footer + } + return nil + } + + func getListItem(_ moleculeJson: [AnyHashable: Any]) -> MoleculeListItemModel? { + guard let type = moleculeJson.optionalStringForKey("type") else { + return nil + } + + if type == "rewards" { + return getRewardListItem(moleculeJson) + } else { + return getTitleImageListItem(moleculeJson, type) + } + } + + func getTitleImageListItem(_ moleculeJson: [AnyHashable: Any], _ type: String) -> MoleculeListItemModel? { + let textcolor = moleculeJson.optionalStringForKey("textColor") + var stackItems: [MoleculeStackItemModel] = [] + + let titleLabel = LabelModel(text: moleculeJson.stringForkey(KeyTitle)) + titleLabel.fontName = "NHaasGroteskDSStd-75Bd" + titleLabel.textColor = textcolor + titleLabel.fontSize = (type == "topHeader") ? 70.0 : 25.0 + + let messageLabel = LabelModel(text: moleculeJson.stringForkey("message")) + messageLabel.fontStyle = "B2" + messageLabel.textColor = textcolor + + let headlineBodyModel = HeadlineBodyModel(headline: titleLabel) + headlineBodyModel.body = messageLabel + + if let linkMap = moleculeJson.optionalDictionaryForKey("link") { + do { + let linkDict: [String : Any] = ["title": linkMap.stringForkey(KeyTitle), + "action": linkMap] + let data = try JSONSerialization.data(withJSONObject: linkDict) + let decoder = JSONDecoder() + let linkModel = try decoder.decode(LinkModel.self, from: data) + linkModel.textColor = Color(uiColor: UIColor.mfGet(forHex: textcolor ?? "#FFFFFF")) + let headlineBodyLinkModel = HeadlineBodyLinkModel(headlineBody: headlineBodyModel, + link: linkModel) + stackItems.append(MoleculeStackItemModel(with: headlineBodyLinkModel)) + } catch { + stackItems.append(MoleculeStackItemModel(with: headlineBodyModel)) + } + } else { + stackItems.append(MoleculeStackItemModel(with: headlineBodyModel)) + } + + if let imageurl = moleculeJson.optionalStringForKey("imageUrl") { + let imageModel = ImageViewModel(image: imageurl) + imageModel.height = moleculeJson.optionalCGFloatForKey("imageHeight") ?? 300 + imageModel.imageFormat = "jpeg" + imageModel.contentMode = .scaleAspectFit + stackItems.append(MoleculeStackItemModel(with: imageModel)) + } + + let stack = MoleculeStackModel(molecules: stackItems) + let listItem = MoleculeListItemModel(with: stack) + + let backgroudColorString = moleculeJson.optionalStringForKey("backgroundColor") ?? "#000000" + listItem.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) + listItem.line = LineModel(type: .none) + return listItem + } + + func getRewardListItem(_ moleculeJson: [AnyHashable: Any]) -> MoleculeListItemModel? { + + var stackItems: [MoleculeStackItemModel] = [] + + (moleculeJson.arrayForKey("rewards") as? [[AnyHashable: Any]])?.forEach { (rewardItem) in + let textcolor = rewardItem.optionalStringForKey("textColor") + + let titleLabel = LabelModel(text: rewardItem.stringForkey(KeyTitle)) + titleLabel.fontName = "NHaasGroteskDSStd-75Bd" + titleLabel.textColor = textcolor + titleLabel.fontSize = 48 + + let messageLabel = LabelModel(text: rewardItem.stringForkey("message")) + messageLabel.fontName = "NHaasGroteskDSStd-75Bd" + messageLabel.textColor = textcolor + messageLabel.fontSize = 14 + + let titleStackItem = MoleculeStackItemModel(with: titleLabel) + let messageStackItem = MoleculeStackItemModel(with: messageLabel) + + let itemStack = MoleculeStackModel(molecules: [titleStackItem, messageStackItem]) + itemStack.verticalAlignment = .top + itemStack.spacing = 0 + + let horizontalStack = MoleculeStackItemModel(with: itemStack) + horizontalStack.verticalAlignment = .top + stackItems.append(horizontalStack) + } + + stackItems.first?.percent = 35 + stackItems.last?.percent = 65 + let stack = MoleculeStackModel(molecules: stackItems) + stack.axis = .horizontal + stack.horizontalAlignment = .leading + stack.verticalAlignment = .leading + + let listItem = MoleculeListItemModel(with: stack) + let backgroudColorString = moleculeJson.optionalStringForKey("backgroundColor") ?? "#000000" + listItem.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) + listItem.line = LineModel(type: .none) + + return listItem + } +} + diff --git a/MVMCoreUI/Templates/IsaacLandingTemplate.swift b/MVMCoreUI/Templates/IsaacLandingTemplate.swift new file mode 100644 index 00000000..909c9600 --- /dev/null +++ b/MVMCoreUI/Templates/IsaacLandingTemplate.swift @@ -0,0 +1,192 @@ + +// IsaacLandingTemplate.swift +// MVMCoreUI +// +// Created by Suresh, Kamlesh on 2/13/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +import MVMCoreUI +import MVMCore + +open class IsaacLandingTemplate: MoleculeListTemplate { + + open override func parsePageJSONAndReturnError(_ error: NSErrorPointer) { + guard let pageJSON = self.loadObject?.pageJSON else { return } + + var listItems: [MoleculeListItemModel] = [] + (pageJSON.arrayForKey("items") as? [[AnyHashable: Any]])?.forEach { (itemJson) in + if let item = getListItem(itemJson) { + listItems.append(item) + } + } + + let template = ListPageTemplateModel(pageType: pageJSON.stringForkey(KeyPageType), + screenHeading: pageJSON.stringForkey(KeyScreenHeading), + molecules: listItems) + + let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" + template.footer = setFooter(pageJSON, template) + self.templateModel = template + + DispatchQueue.main.async { [weak self] in + self?.view.backgroundColor = UIColor.mfGet(forHex: backgroudColorString) + } + } + + + func setFooter(_ pageJSON: [AnyHashable: Any], _ template: ListPageTemplateModel) -> FooterModel? { + + let primaryButtonBGColor = pageJSON.optionalStringForKey("primaryButtonBGColor") ?? "#FFFFFF" + let primaryButtonTextColor = pageJSON.optionalStringForKey("primaryButtonTextColor") ?? "#000000" + + let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" + if let buttonMap = pageJSON.optionalDictionaryForKey("ButtonMap") { + let twoButtonModel = TwoButtonViewModel(nil, nil) + + if let primarybutton = buttonMap.optionalDictionaryForKey(KeyPrimaryButton) { + let buttonDict: [String : Any] = ["title": primarybutton.stringForkey(KeyTitle), + "action": primarybutton, + "moleculeName": "button"] + if let data = try? JSONSerialization.data(withJSONObject: buttonDict) { + let decoder = JSONDecoder() + twoButtonModel.primaryButton = try? decoder.decode(ButtonModel.self, from: data) + twoButtonModel.primaryButton?.fillColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonBGColor)) + twoButtonModel.primaryButton?.textColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonTextColor)) + } + } + if let secondaryButton = buttonMap.optionalDictionaryForKey(KeySecondaryButton) { + let buttonDict: [String : Any] = ["title": secondaryButton.stringForkey(KeyTitle), + "action": secondaryButton, + "moleculeName": "button"] + if let data = try? JSONSerialization.data(withJSONObject: buttonDict) { + let decoder = JSONDecoder() + twoButtonModel.secondaryButton = try? decoder.decode(ButtonModel.self, from: data) + twoButtonModel.secondaryButton?.fillColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonTextColor)) + twoButtonModel.secondaryButton?.textColor = Color(uiColor: UIColor.mfGet(forHex:primaryButtonBGColor)) + } + } + + let footerStack = MoleculeStackModel(molecules: [MoleculeStackItemModel(with:LineModel(type: .standard)), + MoleculeStackItemModel(with: twoButtonModel)]) + footerStack.useHorizontalMargins = false + footerStack.spacing = PaddingFour + + let footer = FooterModel(with: footerStack) + footer.useHorizontalMargins = false + footer.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) + return footer + } + return nil + } + + func getListItem(_ moleculeJson: [AnyHashable: Any]) -> MoleculeListItemModel? { + guard let type = moleculeJson.optionalStringForKey("type") else { + return nil + } + + if type == "rewards" { + return getRewardListItem(moleculeJson) + } else { + return getTitleImageListItem(moleculeJson, type) + } + } + + func getTitleImageListItem(_ moleculeJson: [AnyHashable: Any], _ type: String) -> MoleculeListItemModel? { + let textcolor = moleculeJson.optionalStringForKey("textColor") + var stackItems: [MoleculeStackItemModel] = [] + + let titleLabel = LabelModel(text: moleculeJson.stringForkey(KeyTitle)) + titleLabel.fontName = "NHaasGroteskDSStd-75Bd" + titleLabel.textColor = textcolor + titleLabel.fontSize = (type == "topHeader") ? 70.0 : 25.0 + + let messageLabel = LabelModel(text: moleculeJson.stringForkey("message")) + messageLabel.fontStyle = "B2" + messageLabel.textColor = textcolor + + let headlineBodyModel = HeadlineBodyModel(headline: titleLabel) + headlineBodyModel.body = messageLabel + + if let linkMap = moleculeJson.optionalDictionaryForKey("link") { + do { + let linkDict: [String : Any] = ["title": linkMap.stringForkey(KeyTitle), + "action": linkMap] + let data = try JSONSerialization.data(withJSONObject: linkDict) + let decoder = JSONDecoder() + let linkModel = try decoder.decode(LinkModel.self, from: data) + linkModel.textColor = Color(uiColor: UIColor.mfGet(forHex: textcolor ?? "#FFFFFF")) + let headlineBodyLinkModel = HeadlineBodyLinkModel(headlineBody: headlineBodyModel, + link: linkModel) + stackItems.append(MoleculeStackItemModel(with: headlineBodyLinkModel)) + } catch { + stackItems.append(MoleculeStackItemModel(with: headlineBodyModel)) + } + } else { + stackItems.append(MoleculeStackItemModel(with: headlineBodyModel)) + } + + if let imageurl = moleculeJson.optionalStringForKey("imageUrl") { + let imageModel = ImageViewModel(image: imageurl) + imageModel.height = moleculeJson.optionalCGFloatForKey("imageHeight") ?? 300 + imageModel.imageFormat = "jpeg" + imageModel.contentMode = .scaleAspectFit + stackItems.append(MoleculeStackItemModel(with: imageModel)) + } + + let stack = MoleculeStackModel(molecules: stackItems) + let listItem = MoleculeListItemModel(with: stack) + + let backgroudColorString = moleculeJson.optionalStringForKey("backgroundColor") ?? "#000000" + listItem.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) + listItem.line = LineModel(type: .none) + return listItem + } + + func getRewardListItem(_ moleculeJson: [AnyHashable: Any]) -> MoleculeListItemModel? { + + var stackItems: [MoleculeStackItemModel] = [] + + (moleculeJson.arrayForKey("rewards") as? [[AnyHashable: Any]])?.forEach { (rewardItem) in + let textcolor = rewardItem.optionalStringForKey("textColor") + + let titleLabel = LabelModel(text: rewardItem.stringForkey(KeyTitle)) + titleLabel.fontName = "NHaasGroteskDSStd-75Bd" + titleLabel.textColor = textcolor + titleLabel.fontSize = 48 + + let messageLabel = LabelModel(text: rewardItem.stringForkey("message")) + messageLabel.fontName = "NHaasGroteskDSStd-75Bd" + messageLabel.textColor = textcolor + messageLabel.fontSize = 14 + + let titleStackItem = MoleculeStackItemModel(with: titleLabel) + let messageStackItem = MoleculeStackItemModel(with: messageLabel) + + let itemStack = MoleculeStackModel(molecules: [titleStackItem, messageStackItem]) + itemStack.verticalAlignment = .top + itemStack.spacing = 0 + + let horizontalStack = MoleculeStackItemModel(with: itemStack) + horizontalStack.verticalAlignment = .top + stackItems.append(horizontalStack) + } + + stackItems.first?.percent = 35 + stackItems.last?.percent = 65 + let stack = MoleculeStackModel(molecules: stackItems) + stack.axis = .horizontal + stack.horizontalAlignment = .leading + stack.verticalAlignment = .leading + + let listItem = MoleculeListItemModel(with: stack) + let backgroudColorString = moleculeJson.optionalStringForKey("backgroundColor") ?? "#000000" + listItem.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) + listItem.line = LineModel(type: .none) + + return listItem + } +} + + diff --git a/MVMCoreUI/Templates/MoleculeListTemplate.swift b/MVMCoreUI/Templates/MoleculeListTemplate.swift index 01d0a5e6..291a6a27 100644 --- a/MVMCoreUI/Templates/MoleculeListTemplate.swift +++ b/MVMCoreUI/Templates/MoleculeListTemplate.swift @@ -23,8 +23,8 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol // MARK: - Computed Properties //-------------------------------------------------- - @objc public override func parsePageJSON() throws { - try parseTemplateJSON() + open override func parsePageJSONAndReturnError(_ error: NSErrorPointer) { + try? parseTemplateJSON() } open override var loadObject: MVMCoreLoadObject? { diff --git a/MVMCoreUI/Templates/MoleculeStackTemplate.swift b/MVMCoreUI/Templates/MoleculeStackTemplate.swift index 03d21c6b..b3fb4c3a 100644 --- a/MVMCoreUI/Templates/MoleculeStackTemplate.swift +++ b/MVMCoreUI/Templates/MoleculeStackTemplate.swift @@ -12,8 +12,8 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol { var observer: NSKeyValueObservation? public var templateModel: StackPageTemplateModel? - public override func parsePageJSON() throws { - try parseTemplateJSON() + open override func parsePageJSONAndReturnError(_ error: NSErrorPointer) { + try? parseTemplateJSON() } open override var loadObject: MVMCoreLoadObject? { diff --git a/MVMCoreUI/Templates/ThreeLayerTemplate.swift b/MVMCoreUI/Templates/ThreeLayerTemplate.swift index 785d1055..8d4f7169 100644 --- a/MVMCoreUI/Templates/ThreeLayerTemplate.swift +++ b/MVMCoreUI/Templates/ThreeLayerTemplate.swift @@ -11,8 +11,9 @@ import UIKit @objcMembers open class ThreeLayerTemplate: ThreeLayerViewController, TemplateProtocol { public var templateModel: ThreeLayerPageTemplateModel? - @objc public override func parsePageJSON() throws { - try parseTemplateJSON() + + open override func parsePageJSONAndReturnError(_ error: NSErrorPointer) { + try? parseTemplateJSON() } override open func viewDidLoad() { From a2700e81b4e612d0c5012ad6fb1c5d33d5788147 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Mon, 17 Feb 2020 21:54:47 -0500 Subject: [PATCH 12/32] remove file --- .../OtherHandlers/IsaacLandingTemplate.swift | 52 ++--- .../Templates/IsaacLandingTemplate.swift | 192 ------------------ 2 files changed, 15 insertions(+), 229 deletions(-) delete mode 100644 MVMCoreUI/Templates/IsaacLandingTemplate.swift diff --git a/MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift b/MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift index 154cfdfd..8068cdc4 100644 --- a/MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift +++ b/MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift @@ -15,47 +15,25 @@ open class IsaacLandingTemplate: MoleculeListTemplate { open override func parsePageJSONAndReturnError(_ error: NSErrorPointer) { guard let pageJSON = self.loadObject?.pageJSON else { return } - var listItems: [MoleculeListItemModel] = [] - (pageJSON.arrayForKey("items") as? [[AnyHashable: Any]])?.forEach { (itemJson) in - if let item = getListItem(itemJson) { - listItems.append(item) - } - } + var listItems: [MoleculeListItemModel] = [] + (pageJSON.arrayForKey("items") as? [[AnyHashable: Any]])?.forEach { (itemJson) in + if let item = getListItem(itemJson) { + listItems.append(item) + } + } - let template = ListPageTemplateModel(pageType: pageJSON.stringForkey(KeyPageType), - screenHeading: pageJSON.stringForkey(KeyScreenHeading), - molecules: listItems) + let template = ListPageTemplateModel(pageType: pageJSON.stringForkey(KeyPageType), + screenHeading: pageJSON.stringForkey(KeyScreenHeading), + molecules: listItems) - let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" - template.footer = setFooter(pageJSON, template) - self.templateModel = template + let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" + template.footer = setFooter(pageJSON, template) + self.templateModel = template - DispatchQueue.main.async { [weak self] in - self?.view.backgroundColor = UIColor.mfGet(forHex: backgroudColorString) - } + DispatchQueue.main.async { [weak self] in + self?.view.backgroundColor = UIColor.mfGet(forHex: backgroudColorString) + } } -// public func parseTemplateJSON() throws { -// guard let pageJSON = self.loadObject?.pageJSON else { return } -// -// var listItems: [MoleculeListItemModel] = [] -// (pageJSON.arrayForKey("items") as? [[AnyHashable: Any]])?.forEach { (itemJson) in -// if let item = getListItem(itemJson) { -// listItems.append(item) -// } -// } -// -// let template = ListPageTemplateModel(pageType: pageJSON.stringForkey(KeyPageType), -// screenHeading: pageJSON.stringForkey(KeyScreenHeading), -// molecules: listItems) -// -// let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" -// template.footer = setFooter(pageJSON, template) -// self.templateModel = template -// -// DispatchQueue.main.async { [weak self] in -// self?.view.backgroundColor = UIColor.mfGet(forHex: backgroudColorString) -// } -// } func setFooter(_ pageJSON: [AnyHashable: Any], _ template: ListPageTemplateModel) -> FooterModel? { diff --git a/MVMCoreUI/Templates/IsaacLandingTemplate.swift b/MVMCoreUI/Templates/IsaacLandingTemplate.swift deleted file mode 100644 index 909c9600..00000000 --- a/MVMCoreUI/Templates/IsaacLandingTemplate.swift +++ /dev/null @@ -1,192 +0,0 @@ - -// IsaacLandingTemplate.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 2/13/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation -import MVMCoreUI -import MVMCore - -open class IsaacLandingTemplate: MoleculeListTemplate { - - open override func parsePageJSONAndReturnError(_ error: NSErrorPointer) { - guard let pageJSON = self.loadObject?.pageJSON else { return } - - var listItems: [MoleculeListItemModel] = [] - (pageJSON.arrayForKey("items") as? [[AnyHashable: Any]])?.forEach { (itemJson) in - if let item = getListItem(itemJson) { - listItems.append(item) - } - } - - let template = ListPageTemplateModel(pageType: pageJSON.stringForkey(KeyPageType), - screenHeading: pageJSON.stringForkey(KeyScreenHeading), - molecules: listItems) - - let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" - template.footer = setFooter(pageJSON, template) - self.templateModel = template - - DispatchQueue.main.async { [weak self] in - self?.view.backgroundColor = UIColor.mfGet(forHex: backgroudColorString) - } - } - - - func setFooter(_ pageJSON: [AnyHashable: Any], _ template: ListPageTemplateModel) -> FooterModel? { - - let primaryButtonBGColor = pageJSON.optionalStringForKey("primaryButtonBGColor") ?? "#FFFFFF" - let primaryButtonTextColor = pageJSON.optionalStringForKey("primaryButtonTextColor") ?? "#000000" - - let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" - if let buttonMap = pageJSON.optionalDictionaryForKey("ButtonMap") { - let twoButtonModel = TwoButtonViewModel(nil, nil) - - if let primarybutton = buttonMap.optionalDictionaryForKey(KeyPrimaryButton) { - let buttonDict: [String : Any] = ["title": primarybutton.stringForkey(KeyTitle), - "action": primarybutton, - "moleculeName": "button"] - if let data = try? JSONSerialization.data(withJSONObject: buttonDict) { - let decoder = JSONDecoder() - twoButtonModel.primaryButton = try? decoder.decode(ButtonModel.self, from: data) - twoButtonModel.primaryButton?.fillColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonBGColor)) - twoButtonModel.primaryButton?.textColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonTextColor)) - } - } - if let secondaryButton = buttonMap.optionalDictionaryForKey(KeySecondaryButton) { - let buttonDict: [String : Any] = ["title": secondaryButton.stringForkey(KeyTitle), - "action": secondaryButton, - "moleculeName": "button"] - if let data = try? JSONSerialization.data(withJSONObject: buttonDict) { - let decoder = JSONDecoder() - twoButtonModel.secondaryButton = try? decoder.decode(ButtonModel.self, from: data) - twoButtonModel.secondaryButton?.fillColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonTextColor)) - twoButtonModel.secondaryButton?.textColor = Color(uiColor: UIColor.mfGet(forHex:primaryButtonBGColor)) - } - } - - let footerStack = MoleculeStackModel(molecules: [MoleculeStackItemModel(with:LineModel(type: .standard)), - MoleculeStackItemModel(with: twoButtonModel)]) - footerStack.useHorizontalMargins = false - footerStack.spacing = PaddingFour - - let footer = FooterModel(with: footerStack) - footer.useHorizontalMargins = false - footer.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) - return footer - } - return nil - } - - func getListItem(_ moleculeJson: [AnyHashable: Any]) -> MoleculeListItemModel? { - guard let type = moleculeJson.optionalStringForKey("type") else { - return nil - } - - if type == "rewards" { - return getRewardListItem(moleculeJson) - } else { - return getTitleImageListItem(moleculeJson, type) - } - } - - func getTitleImageListItem(_ moleculeJson: [AnyHashable: Any], _ type: String) -> MoleculeListItemModel? { - let textcolor = moleculeJson.optionalStringForKey("textColor") - var stackItems: [MoleculeStackItemModel] = [] - - let titleLabel = LabelModel(text: moleculeJson.stringForkey(KeyTitle)) - titleLabel.fontName = "NHaasGroteskDSStd-75Bd" - titleLabel.textColor = textcolor - titleLabel.fontSize = (type == "topHeader") ? 70.0 : 25.0 - - let messageLabel = LabelModel(text: moleculeJson.stringForkey("message")) - messageLabel.fontStyle = "B2" - messageLabel.textColor = textcolor - - let headlineBodyModel = HeadlineBodyModel(headline: titleLabel) - headlineBodyModel.body = messageLabel - - if let linkMap = moleculeJson.optionalDictionaryForKey("link") { - do { - let linkDict: [String : Any] = ["title": linkMap.stringForkey(KeyTitle), - "action": linkMap] - let data = try JSONSerialization.data(withJSONObject: linkDict) - let decoder = JSONDecoder() - let linkModel = try decoder.decode(LinkModel.self, from: data) - linkModel.textColor = Color(uiColor: UIColor.mfGet(forHex: textcolor ?? "#FFFFFF")) - let headlineBodyLinkModel = HeadlineBodyLinkModel(headlineBody: headlineBodyModel, - link: linkModel) - stackItems.append(MoleculeStackItemModel(with: headlineBodyLinkModel)) - } catch { - stackItems.append(MoleculeStackItemModel(with: headlineBodyModel)) - } - } else { - stackItems.append(MoleculeStackItemModel(with: headlineBodyModel)) - } - - if let imageurl = moleculeJson.optionalStringForKey("imageUrl") { - let imageModel = ImageViewModel(image: imageurl) - imageModel.height = moleculeJson.optionalCGFloatForKey("imageHeight") ?? 300 - imageModel.imageFormat = "jpeg" - imageModel.contentMode = .scaleAspectFit - stackItems.append(MoleculeStackItemModel(with: imageModel)) - } - - let stack = MoleculeStackModel(molecules: stackItems) - let listItem = MoleculeListItemModel(with: stack) - - let backgroudColorString = moleculeJson.optionalStringForKey("backgroundColor") ?? "#000000" - listItem.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) - listItem.line = LineModel(type: .none) - return listItem - } - - func getRewardListItem(_ moleculeJson: [AnyHashable: Any]) -> MoleculeListItemModel? { - - var stackItems: [MoleculeStackItemModel] = [] - - (moleculeJson.arrayForKey("rewards") as? [[AnyHashable: Any]])?.forEach { (rewardItem) in - let textcolor = rewardItem.optionalStringForKey("textColor") - - let titleLabel = LabelModel(text: rewardItem.stringForkey(KeyTitle)) - titleLabel.fontName = "NHaasGroteskDSStd-75Bd" - titleLabel.textColor = textcolor - titleLabel.fontSize = 48 - - let messageLabel = LabelModel(text: rewardItem.stringForkey("message")) - messageLabel.fontName = "NHaasGroteskDSStd-75Bd" - messageLabel.textColor = textcolor - messageLabel.fontSize = 14 - - let titleStackItem = MoleculeStackItemModel(with: titleLabel) - let messageStackItem = MoleculeStackItemModel(with: messageLabel) - - let itemStack = MoleculeStackModel(molecules: [titleStackItem, messageStackItem]) - itemStack.verticalAlignment = .top - itemStack.spacing = 0 - - let horizontalStack = MoleculeStackItemModel(with: itemStack) - horizontalStack.verticalAlignment = .top - stackItems.append(horizontalStack) - } - - stackItems.first?.percent = 35 - stackItems.last?.percent = 65 - let stack = MoleculeStackModel(molecules: stackItems) - stack.axis = .horizontal - stack.horizontalAlignment = .leading - stack.verticalAlignment = .leading - - let listItem = MoleculeListItemModel(with: stack) - let backgroudColorString = moleculeJson.optionalStringForKey("backgroundColor") ?? "#000000" - listItem.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) - listItem.line = LineModel(type: .none) - - return listItem - } -} - - From e2860efaf6d6ab41789bbd209f4f24bccdb44eb4 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Mon, 17 Feb 2020 22:28:09 -0500 Subject: [PATCH 13/32] fixes --- MVMCoreUI/BaseControllers/MFViewController.h | 2 +- MVMCoreUI/BaseControllers/MFViewController.m | 6 +++--- MVMCoreUI/Templates/MoleculeListTemplate.swift | 2 +- MVMCoreUI/Templates/MoleculeStackTemplate.swift | 2 +- MVMCoreUI/Templates/ThreeLayerTemplate.swift | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/BaseControllers/MFViewController.h b/MVMCoreUI/BaseControllers/MFViewController.h index ee38cf2b..11afe915 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.h +++ b/MVMCoreUI/BaseControllers/MFViewController.h @@ -277,7 +277,7 @@ // subclass to set up intro animations - (void)setupIntroAnimations; -- (void)parsePageJSONAndReturnError:(NSError * _Nullable * _Nullable)error; +- (void)parsePageJSON:(NSError * _Nullable * _Nullable)error; @end diff --git a/MVMCoreUI/BaseControllers/MFViewController.m b/MVMCoreUI/BaseControllers/MFViewController.m index af2db33c..f663193f 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.m +++ b/MVMCoreUI/BaseControllers/MFViewController.m @@ -98,7 +98,7 @@ self.loadObject = loadObject; NSError *parseError = nil; - [self parsePageJSONAndReturnError:&parseError]; + [self parsePageJSON:&parseError]; if (parseError) { if (error) { MVMCoreErrorObject *errorObject = [MVMCoreErrorObject createErrorObjectForNSError:parseError location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]]; @@ -112,7 +112,7 @@ return [MFViewController verifyRequiredModulesLoadedForLoadObject:loadObject error:error]; } -- (void)parsePageJSONAndReturnError:(NSError * _Nullable * _Nullable)error { +- (void)parsePageJSON:(NSError * _Nullable * _Nullable)error { } @@ -265,7 +265,7 @@ - (BOOL)newPageLoaded:(nonnull NSDictionary *)page { self.loadObject.pageJSON = page; NSError *parseError = nil; - [self parsePageJSONAndReturnError:&parseError]; + [self parsePageJSON:&parseError]; return YES; } diff --git a/MVMCoreUI/Templates/MoleculeListTemplate.swift b/MVMCoreUI/Templates/MoleculeListTemplate.swift index 291a6a27..cbe0458c 100644 --- a/MVMCoreUI/Templates/MoleculeListTemplate.swift +++ b/MVMCoreUI/Templates/MoleculeListTemplate.swift @@ -23,7 +23,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol // MARK: - Computed Properties //-------------------------------------------------- - open override func parsePageJSONAndReturnError(_ error: NSErrorPointer) { + open override func parsePageJSON(_ error: NSErrorPointer) { try? parseTemplateJSON() } diff --git a/MVMCoreUI/Templates/MoleculeStackTemplate.swift b/MVMCoreUI/Templates/MoleculeStackTemplate.swift index b3fb4c3a..8bf0b4cd 100644 --- a/MVMCoreUI/Templates/MoleculeStackTemplate.swift +++ b/MVMCoreUI/Templates/MoleculeStackTemplate.swift @@ -12,7 +12,7 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol { var observer: NSKeyValueObservation? public var templateModel: StackPageTemplateModel? - open override func parsePageJSONAndReturnError(_ error: NSErrorPointer) { + open override func parsePageJSON(_ error: NSErrorPointer) { try? parseTemplateJSON() } diff --git a/MVMCoreUI/Templates/ThreeLayerTemplate.swift b/MVMCoreUI/Templates/ThreeLayerTemplate.swift index 8d4f7169..72498289 100644 --- a/MVMCoreUI/Templates/ThreeLayerTemplate.swift +++ b/MVMCoreUI/Templates/ThreeLayerTemplate.swift @@ -12,7 +12,7 @@ import UIKit public var templateModel: ThreeLayerPageTemplateModel? - open override func parsePageJSONAndReturnError(_ error: NSErrorPointer) { + open override func parsePageJSON(_ error: NSErrorPointer) { try? parseTemplateJSON() } From c43a3da712da4eeeed48e77f4c2547f722b6a459 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Tue, 18 Feb 2020 16:06:30 +0530 Subject: [PATCH 14/32] Code commit after adding a createPayPal function. --- .../List/RightVariable/ListRightVariablePayments.swift | 3 +-- .../List/RightVariable/ListRightVariablePaymentsModel.swift | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 91703fd7..046bc331 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -36,7 +36,6 @@ import Foundation stack.stackItems = [StackItem(andContain: leftLabel),StackItem(andContain: rightImage)] contentView.addSubview(stack) containerHelper.constrainView(stack) - } //---------------------------------------------------- // MARK: - Molecule @@ -45,7 +44,7 @@ import Foundation super.reset() stack.reset() } -   + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.setWithModel(model, delegateObject, additionalData) guard let model = model as? ListRightVariablePaymentsModel else { return} diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index 422cd193..681f2078 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -20,7 +20,7 @@ public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtoco super.init() } - func createPayPalImage() -> ImageViewModel { + static func createPayPalImage() -> ImageViewModel { let image = ImageViewModel(image: "imagename_paypal") image.width = 30.0 return image @@ -35,7 +35,7 @@ public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtoco required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) - image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) ?? createPayPalImage() + image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) ?? ListRightVariablePaymentsModel.createPayPalImage() try super.init(from: decoder) } From 72d0a24061f02ee27403f852d883c867823ba35e Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 18 Feb 2020 16:50:03 +0530 Subject: [PATCH 15/32] Modified code as image is optional. --- .../List/RightVariable/ListRightVariablePaymentsModel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index 681f2078..63719ec1 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -11,7 +11,7 @@ import Foundation public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtocol { public static var identifier: String = "listRVImg" - public var image: ImageViewModel + public var image: ImageViewModel? public var leftLabel: LabelModel public init(image: ImageViewModel, leftLabel: LabelModel) { @@ -44,6 +44,6 @@ public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtoco var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) try container.encode(leftLabel, forKey: .leftLabel) - try container.encode(image, forKey: .image) + try container.encodeIfPresent(image, forKey: .image) } } From a29b4b17a0d6b2769fd0238a21e679a084b36007 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Tue, 18 Feb 2020 09:48:58 -0500 Subject: [PATCH 16/32] add toggle for server s7 params --- MVMCoreUI/Atoms/Views/MFLoadImageView.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift index 5e8cedc8..fa7d369e 100644 --- a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift +++ b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift @@ -273,7 +273,9 @@ import UIKit } // MARK: - load functions - public func loadImage(withName imageName: String?, format: String?, width: NSNumber?, height: NSNumber?, customFallbackImage: String?, completionHandler: @escaping MVMCoreGetImageBlock) { + public func loadImage(withName imageName: String?, format: String? = nil, width: NSNumber? = nil, height: NSNumber? = nil, customFallbackImage: String? = nil, allowServerParameters: Bool = false, completionHandler: MVMCoreGetImageBlock? = nil) { + + let completionBlock = completionHandler ?? defaultCompletionBlock() MVMCoreDispatchUtility.performBlock(onMainThread: { [unowned self] in self.currentImageName = imageName self.currentImageWidth = width?.cgfloat() @@ -295,15 +297,15 @@ import UIKit if layoutWillChange { self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self!) } - completionHandler(image,data,isFallbackImage) + completionBlock(image,data,isFallbackImage) })} let fallbackImageName = customFallbackImage ?? MVMCoreUIUtility.localizedImageName("fallback") if let format = format, format.lowercased().contains("gif") { // Gifs aren't supported by default and need special handling - MVMCoreCache.shared()?.getGif(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, completionHandler: finishedLoadingBlock) + MVMCoreCache.shared()?.getGif(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, allowServerQueryParameters: allowServerParameters, completionHandler: finishedLoadingBlock) } else { - MVMCoreCache.shared()?.getImage(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, completionHandler: finishedLoadingBlock) + MVMCoreCache.shared()?.getImage(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, allowServerQueryParameters: allowServerParameters, completionHandler: finishedLoadingBlock) } }) } @@ -333,6 +335,8 @@ import UIKit }) } + // Note: Exposed for objective-c interfaces. + public func loadImage(withName imageName: String?) { loadImage(withName: imageName, format: nil, width: nil, height: nil, customFallbackImage: nil, completionHandler: defaultCompletionBlock()) } @@ -368,4 +372,8 @@ import UIKit public func loadImage(withName imageName: String?, format: String?, width: NSNumber?, height: NSNumber?, customFallbackImage: String?) { loadImage(withName: imageName, format: format, width: width, height: height, customFallbackImage: customFallbackImage, completionHandler: defaultCompletionBlock()) } + + public func loadImage(withName imageName: String?, format: String?, width: NSNumber?, height: NSNumber?, customFallbackImage: String?, completionHandler: @escaping MVMCoreGetImageBlock) { + loadImage(withName: imageName, format: format, width: width, height: height, customFallbackImage: customFallbackImage, allowServerParameters: false, completionHandler: completionHandler) + } } From ff0758106ef6cde410c7f5d104acd5e2331e9d95 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Tue, 18 Feb 2020 12:31:55 -0500 Subject: [PATCH 17/32] init --- .../Atoms/Views/Label/LabelAttributeActionModel.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift b/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift index 2ebcb4b4..135fee45 100644 --- a/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift +++ b/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift @@ -8,12 +8,17 @@ import UIKit -class LabelAttributeActionModel: LabelAttributeModel { +open class LabelAttributeActionModel: LabelAttributeModel { override public class var identifier: String { return "action" } var action: ActionModelProtocol + public init(_ location: Int, _ length: Int, action: ActionModelProtocol) { + self.action = action + super.init(Self.identifier, location, length) + } + required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) From db8a27ec2fc44bffa209d66bf699d5c31d1b1d6a Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 18 Feb 2020 14:29:35 -0500 Subject: [PATCH 18/32] update to label attributes --- .../Atoms/Views/Label/LabelAttributeActionModel.swift | 10 +++++----- MVMCoreUI/Atoms/Views/Label/LabelAttributeModel.swift | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift b/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift index 135fee45..503f00d8 100644 --- a/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift +++ b/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift @@ -16,7 +16,11 @@ open class LabelAttributeActionModel: LabelAttributeModel { public init(_ location: Int, _ length: Int, action: ActionModelProtocol) { self.action = action - super.init(Self.identifier, location, length) + super.init(location, length) + } + + private enum CodingKeys: String, CodingKey { + case action } required public init(from decoder: Decoder) throws { @@ -30,8 +34,4 @@ open class LabelAttributeActionModel: LabelAttributeModel { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeModel(action, forKey: .action) } - - private enum CodingKeys: String, CodingKey { - case action - } } diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeModel.swift b/MVMCoreUI/Atoms/Views/Label/LabelAttributeModel.swift index 3c073b2f..437ec0cc 100644 --- a/MVMCoreUI/Atoms/Views/Label/LabelAttributeModel.swift +++ b/MVMCoreUI/Atoms/Views/Label/LabelAttributeModel.swift @@ -25,12 +25,14 @@ import Foundation return "" } - var type: String + var type: String { + get { return Self.identifier } + } + var location: Int var length: Int - init(_ type: String, _ location: Int, _ length: Int) { - self.type = type + init(_ location: Int, _ length: Int) { self.location = location self.length = length } @@ -51,7 +53,6 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - type = try typeContainer.decode(String.self, forKey: .type) location = try typeContainer.decode(Int.self, forKey: .location) length = try typeContainer.decode(Int.self, forKey: .length) } From a620dd2401d3e03cabf646271972ec71cf44f6f0 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 18 Feb 2020 14:59:17 -0500 Subject: [PATCH 19/32] some fixes for catching and remove file --- MVMCoreUI/BaseControllers/MFViewController.h | 4 +- .../TwoButtonViewModel.swift | 4 +- .../OtherHandlers/IsaacLandingTemplate.swift | 190 ------------------ .../Templates/MoleculeListTemplate.swift | 6 +- .../Templates/MoleculeStackTemplate.swift | 6 +- MVMCoreUI/Templates/ThreeLayerTemplate.swift | 6 +- 6 files changed, 20 insertions(+), 196 deletions(-) delete mode 100644 MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift diff --git a/MVMCoreUI/BaseControllers/MFViewController.h b/MVMCoreUI/BaseControllers/MFViewController.h index 11afe915..38ced354 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.h +++ b/MVMCoreUI/BaseControllers/MFViewController.h @@ -96,6 +96,9 @@ // This view controller should subclass this function and check the load to make sure it has all the needed data. Fills the error object if there are any errors. Returns if we should finish the load or not. - (BOOL)shouldFinishProcessingLoad:(nonnull MVMCoreLoadObject *)loadObject error:(MVMCoreErrorObject *_Nonnull *_Nonnull)error; +/// Called in newDataBuildScreen. Can override to parse the json into a model object. +- (void)parsePageJSON:(NSError * _Nullable * _Nullable)error; + // Sets the screen to use the screen heading. // it is required in device flow, where we are showing greeting name as screen heading, // device details screen heading needs to be updated/refreshed again, if user has changed device nick name @@ -277,7 +280,6 @@ // subclass to set up intro animations - (void)setupIntroAnimations; -- (void)parsePageJSON:(NSError * _Nullable * _Nullable)error; @end diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift b/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift index d4cba24c..057203e9 100644 --- a/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift +++ b/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift @@ -22,8 +22,8 @@ public class TwoButtonViewModel: MoleculeModelProtocol { } public init(_ primaryButton: ButtonModel?, _ secondaryButton: ButtonModel?) { - self.primaryButton = primaryButton - self.secondaryButton = secondaryButton + self.primaryButton = primaryButton + self.secondaryButton = secondaryButton } required public init(from decoder: Decoder) throws { diff --git a/MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift b/MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift deleted file mode 100644 index 8068cdc4..00000000 --- a/MVMCoreUI/OtherHandlers/IsaacLandingTemplate.swift +++ /dev/null @@ -1,190 +0,0 @@ -// -// IsaacLandingTemplate.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 2/13/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation -import MVMCoreUI -import MVMCore - -open class IsaacLandingTemplate: MoleculeListTemplate { - - open override func parsePageJSONAndReturnError(_ error: NSErrorPointer) { - guard let pageJSON = self.loadObject?.pageJSON else { return } - - var listItems: [MoleculeListItemModel] = [] - (pageJSON.arrayForKey("items") as? [[AnyHashable: Any]])?.forEach { (itemJson) in - if let item = getListItem(itemJson) { - listItems.append(item) - } - } - - let template = ListPageTemplateModel(pageType: pageJSON.stringForkey(KeyPageType), - screenHeading: pageJSON.stringForkey(KeyScreenHeading), - molecules: listItems) - - let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" - template.footer = setFooter(pageJSON, template) - self.templateModel = template - - DispatchQueue.main.async { [weak self] in - self?.view.backgroundColor = UIColor.mfGet(forHex: backgroudColorString) - } - } - - func setFooter(_ pageJSON: [AnyHashable: Any], _ template: ListPageTemplateModel) -> FooterModel? { - - let primaryButtonBGColor = pageJSON.optionalStringForKey("primaryButtonBGColor") ?? "#FFFFFF" - let primaryButtonTextColor = pageJSON.optionalStringForKey("primaryButtonTextColor") ?? "#000000" - - let backgroudColorString = pageJSON.optionalStringForKey("backgroundColor") ?? "#000000" - if let buttonMap = pageJSON.optionalDictionaryForKey("ButtonMap") { - let twoButtonModel = TwoButtonViewModel(nil, nil) - - if let primarybutton = buttonMap.optionalDictionaryForKey(KeyPrimaryButton) { - let buttonDict: [String : Any] = ["title": primarybutton.stringForkey(KeyTitle), - "action": primarybutton, - "moleculeName": "button"] - if let data = try? JSONSerialization.data(withJSONObject: buttonDict) { - let decoder = JSONDecoder() - twoButtonModel.primaryButton = try? decoder.decode(ButtonModel.self, from: data) - twoButtonModel.primaryButton?.fillColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonBGColor)) - twoButtonModel.primaryButton?.textColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonTextColor)) - } - } - if let secondaryButton = buttonMap.optionalDictionaryForKey(KeySecondaryButton) { - let buttonDict: [String : Any] = ["title": secondaryButton.stringForkey(KeyTitle), - "action": secondaryButton, - "moleculeName": "button"] - if let data = try? JSONSerialization.data(withJSONObject: buttonDict) { - let decoder = JSONDecoder() - twoButtonModel.secondaryButton = try? decoder.decode(ButtonModel.self, from: data) - twoButtonModel.secondaryButton?.fillColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonTextColor)) - twoButtonModel.secondaryButton?.textColor = Color(uiColor: UIColor.mfGet(forHex:primaryButtonBGColor)) - } - } - - let footerStack = MoleculeStackModel(molecules: [MoleculeStackItemModel(with:LineModel(type: .standard)), - MoleculeStackItemModel(with: twoButtonModel)]) - footerStack.useHorizontalMargins = false - footerStack.spacing = PaddingFour - - let footer = FooterModel(with: footerStack) - footer.useHorizontalMargins = false - footer.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) - return footer - } - return nil - } - - func getListItem(_ moleculeJson: [AnyHashable: Any]) -> MoleculeListItemModel? { - guard let type = moleculeJson.optionalStringForKey("type") else { - return nil - } - - if type == "rewards" { - return getRewardListItem(moleculeJson) - } else { - return getTitleImageListItem(moleculeJson, type) - } - } - - func getTitleImageListItem(_ moleculeJson: [AnyHashable: Any], _ type: String) -> MoleculeListItemModel? { - let textcolor = moleculeJson.optionalStringForKey("textColor") - var stackItems: [MoleculeStackItemModel] = [] - - let titleLabel = LabelModel(text: moleculeJson.stringForkey(KeyTitle)) - titleLabel.fontName = "NHaasGroteskDSStd-75Bd" - titleLabel.textColor = textcolor - titleLabel.fontSize = (type == "topHeader") ? 70.0 : 25.0 - - let messageLabel = LabelModel(text: moleculeJson.stringForkey("message")) - messageLabel.fontStyle = "B2" - messageLabel.textColor = textcolor - - let headlineBodyModel = HeadlineBodyModel(headline: titleLabel) - headlineBodyModel.body = messageLabel - - if let linkMap = moleculeJson.optionalDictionaryForKey("link") { - do { - let linkDict: [String : Any] = ["title": linkMap.stringForkey(KeyTitle), - "action": linkMap] - let data = try JSONSerialization.data(withJSONObject: linkDict) - let decoder = JSONDecoder() - let linkModel = try decoder.decode(LinkModel.self, from: data) - linkModel.textColor = Color(uiColor: UIColor.mfGet(forHex: textcolor ?? "#FFFFFF")) - let headlineBodyLinkModel = HeadlineBodyLinkModel(headlineBody: headlineBodyModel, - link: linkModel) - stackItems.append(MoleculeStackItemModel(with: headlineBodyLinkModel)) - } catch { - stackItems.append(MoleculeStackItemModel(with: headlineBodyModel)) - } - } else { - stackItems.append(MoleculeStackItemModel(with: headlineBodyModel)) - } - - if let imageurl = moleculeJson.optionalStringForKey("imageUrl") { - let imageModel = ImageViewModel(image: imageurl) - imageModel.height = moleculeJson.optionalCGFloatForKey("imageHeight") ?? 300 - imageModel.imageFormat = "jpeg" - imageModel.contentMode = .scaleAspectFit - stackItems.append(MoleculeStackItemModel(with: imageModel)) - } - - let stack = MoleculeStackModel(molecules: stackItems) - let listItem = MoleculeListItemModel(with: stack) - - let backgroudColorString = moleculeJson.optionalStringForKey("backgroundColor") ?? "#000000" - listItem.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) - listItem.line = LineModel(type: .none) - return listItem - } - - func getRewardListItem(_ moleculeJson: [AnyHashable: Any]) -> MoleculeListItemModel? { - - var stackItems: [MoleculeStackItemModel] = [] - - (moleculeJson.arrayForKey("rewards") as? [[AnyHashable: Any]])?.forEach { (rewardItem) in - let textcolor = rewardItem.optionalStringForKey("textColor") - - let titleLabel = LabelModel(text: rewardItem.stringForkey(KeyTitle)) - titleLabel.fontName = "NHaasGroteskDSStd-75Bd" - titleLabel.textColor = textcolor - titleLabel.fontSize = 48 - - let messageLabel = LabelModel(text: rewardItem.stringForkey("message")) - messageLabel.fontName = "NHaasGroteskDSStd-75Bd" - messageLabel.textColor = textcolor - messageLabel.fontSize = 14 - - let titleStackItem = MoleculeStackItemModel(with: titleLabel) - let messageStackItem = MoleculeStackItemModel(with: messageLabel) - - let itemStack = MoleculeStackModel(molecules: [titleStackItem, messageStackItem]) - itemStack.verticalAlignment = .top - itemStack.spacing = 0 - - let horizontalStack = MoleculeStackItemModel(with: itemStack) - horizontalStack.verticalAlignment = .top - stackItems.append(horizontalStack) - } - - stackItems.first?.percent = 35 - stackItems.last?.percent = 65 - let stack = MoleculeStackModel(molecules: stackItems) - stack.axis = .horizontal - stack.horizontalAlignment = .leading - stack.verticalAlignment = .leading - - let listItem = MoleculeListItemModel(with: stack) - let backgroudColorString = moleculeJson.optionalStringForKey("backgroundColor") ?? "#000000" - listItem.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: backgroudColorString)) - listItem.line = LineModel(type: .none) - - return listItem - } -} - diff --git a/MVMCoreUI/Templates/MoleculeListTemplate.swift b/MVMCoreUI/Templates/MoleculeListTemplate.swift index cbe0458c..9741f110 100644 --- a/MVMCoreUI/Templates/MoleculeListTemplate.swift +++ b/MVMCoreUI/Templates/MoleculeListTemplate.swift @@ -24,7 +24,11 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol //-------------------------------------------------- open override func parsePageJSON(_ error: NSErrorPointer) { - try? parseTemplateJSON() + do { + try parseTemplateJSON() + } catch let parseError { + error?.pointee = parseError as NSError + } } open override var loadObject: MVMCoreLoadObject? { diff --git a/MVMCoreUI/Templates/MoleculeStackTemplate.swift b/MVMCoreUI/Templates/MoleculeStackTemplate.swift index 8bf0b4cd..ef7a470d 100644 --- a/MVMCoreUI/Templates/MoleculeStackTemplate.swift +++ b/MVMCoreUI/Templates/MoleculeStackTemplate.swift @@ -13,7 +13,11 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol { var observer: NSKeyValueObservation? public var templateModel: StackPageTemplateModel? open override func parsePageJSON(_ error: NSErrorPointer) { - try? parseTemplateJSON() + do { + try parseTemplateJSON() + } catch let parseError { + error?.pointee = parseError as NSError + } } open override var loadObject: MVMCoreLoadObject? { diff --git a/MVMCoreUI/Templates/ThreeLayerTemplate.swift b/MVMCoreUI/Templates/ThreeLayerTemplate.swift index 72498289..eb822279 100644 --- a/MVMCoreUI/Templates/ThreeLayerTemplate.swift +++ b/MVMCoreUI/Templates/ThreeLayerTemplate.swift @@ -13,7 +13,11 @@ import UIKit public var templateModel: ThreeLayerPageTemplateModel? open override func parsePageJSON(_ error: NSErrorPointer) { - try? parseTemplateJSON() + do { + try parseTemplateJSON() + } catch let parseError { + error?.pointee = parseError as NSError + } } override open func viewDidLoad() { From 633eb4ec21d7c29352640a9f3f86ec310f83aefa Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 18 Feb 2020 15:19:28 -0500 Subject: [PATCH 20/32] adding a new action type. updated action map flow. --- MVMCoreUI/Atoms/Buttons/Link.swift | 4 +++ MVMCoreUI/Atoms/Buttons/LinkModel.swift | 26 ++++++++++++++++++- MVMCoreUI/Atoms/Views/MFLoadImageView.swift | 2 +- MVMCoreUI/BaseClasses/Button.swift | 9 +++++-- .../MoleculeModelProtocol.swift | 2 +- 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atoms/Buttons/Link.swift b/MVMCoreUI/Atoms/Buttons/Link.swift index b4c00c94..5dbbed16 100644 --- a/MVMCoreUI/Atoms/Buttons/Link.swift +++ b/MVMCoreUI/Atoms/Buttons/Link.swift @@ -36,6 +36,10 @@ import UIKit context?.strokePath() } + //-------------------------------------------------- + // MARK: - ModelMoleculeViewProtocol + //-------------------------------------------------- + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.setWithModel(model, delegateObject, additionalData) guard let model = model as? LinkModel else { return } diff --git a/MVMCoreUI/Atoms/Buttons/LinkModel.swift b/MVMCoreUI/Atoms/Buttons/LinkModel.swift index f4fab34c..a3dc940c 100644 --- a/MVMCoreUI/Atoms/Buttons/LinkModel.swift +++ b/MVMCoreUI/Atoms/Buttons/LinkModel.swift @@ -9,20 +9,37 @@ import UIKit public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { - public static var identifier: String = "link" + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public class var identifier: String { + return "link" + } + public var backgroundColor: Color? public var title: String public var action: ActionModelProtocol public var enabled = true public var textColor = Color(uiColor: .mvmBlack) public var disabledColor = Color(uiColor: .mvmCoolGray6) + public var moleculeName: String? + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- public init(title: String, action: ActionModelProtocol) { self.title = title self.action = action } + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { + case moleculeName case backgroundColor case title case action @@ -31,11 +48,17 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { case disabledColor } + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) title = try typeContainer.decode(String.self, forKey: .title) action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) + if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { self.enabled = enabled } @@ -54,6 +77,7 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeModel(action, forKey: .action) try container.encode(enabled, forKey: .enabled) + try container.encode(moleculeName, forKey: .moleculeName) try container.encode(textColor, forKey: .textColor) try container.encode(disabledColor, forKey: .disabledColor) } diff --git a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift index 5e8cedc8..0f2f65d0 100644 --- a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift +++ b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift @@ -301,7 +301,7 @@ import UIKit let fallbackImageName = customFallbackImage ?? MVMCoreUIUtility.localizedImageName("fallback") if let format = format, format.lowercased().contains("gif") { // Gifs aren't supported by default and need special handling - MVMCoreCache.shared()?.getGif(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, completionHandler: finishedLoadingBlock) + MVMCoreCache.shared()?.getGif(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, allowServerQueryParameters: false, completionHandler: finishedLoadingBlock) } else { MVMCoreCache.shared()?.getImage(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, completionHandler: finishedLoadingBlock) } diff --git a/MVMCoreUI/BaseClasses/Button.swift b/MVMCoreUI/BaseClasses/Button.swift index 60e0ab1a..c0ff0e81 100644 --- a/MVMCoreUI/BaseClasses/Button.swift +++ b/MVMCoreUI/BaseClasses/Button.swift @@ -12,6 +12,7 @@ public typealias ButtonAction = (Button) -> () //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- + open var model: MoleculeModelProtocol? open var actionModel: ActionModelProtocol? @@ -67,7 +68,7 @@ public typealias ButtonAction = (Button) -> () addTarget(self, action: #selector(callActionBlock(_:)), for: event) } - @objc private func callActionBlock(_ sender: Button) { + @objc func callActionBlock(_ sender: Button) { buttonAction?(self) } @@ -88,11 +89,13 @@ public typealias ButtonAction = (Button) -> () // MARK:- ModelMoleculeViewProtocol open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { self.model = model + if let backgroundColor = model?.backgroundColor { self.backgroundColor = backgroundColor.uiColor } guard let model = model as? ButtonModelProtocol else { return } + isEnabled = model.enabled set(with: model.action, delegateObject: delegateObject, additionalData: additionalData) } @@ -113,7 +116,7 @@ public typealias ButtonAction = (Button) -> () // MARK: - MVMCoreViewProtocol extension Button: MVMCoreViewProtocol { - open func updateView(_ size: CGFloat) {} + open func updateView(_ size: CGFloat) { } /// Will be called only once. open func setupView() { @@ -126,6 +129,7 @@ extension Button: MVMCoreViewProtocol { // MARK: - MVMCoreUIMoleculeViewProtocol extension Button: MVMCoreUIMoleculeViewProtocol { + open func reset() { backgroundColor = .clear } @@ -133,6 +137,7 @@ extension Button: MVMCoreUIMoleculeViewProtocol { // MARK: AppleGuidelinesProtocol extension Button: AppleGuidelinesProtocol { + override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool { return Self.acceptablyOutsideBounds(point: point, bounds: bounds) } diff --git a/MVMCoreUI/Models/ModelProtocols/MoleculeModelProtocol.swift b/MVMCoreUI/Models/ModelProtocols/MoleculeModelProtocol.swift index 1ec0d13c..cec7b90a 100644 --- a/MVMCoreUI/Models/ModelProtocols/MoleculeModelProtocol.swift +++ b/MVMCoreUI/Models/ModelProtocols/MoleculeModelProtocol.swift @@ -3,7 +3,7 @@ import Foundation public protocol MoleculeModelProtocol: Model { var moleculeName: String? { get } - var backgroundColor: Color? { get set} + var backgroundColor: Color? { get set } } public extension MoleculeModelProtocol { From 29f89154f89c68db06d11144366d46ad0013366b Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 18 Feb 2020 16:55:56 -0500 Subject: [PATCH 21/32] small model fix for images --- MVMCoreUI/Atoms/Views/MFLoadImageView.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift index fa7d369e..156e187d 100644 --- a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift +++ b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift @@ -210,6 +210,9 @@ import UIKit } public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + self.delegateObject = delegateObject + // TODO: Temporary, should be moved to init once we have type erasure ready. + setAsMolecule() guard let imageModel = model as? ImageViewModel else { return } From fa0ec8ab4527a19774815df03911abe4b9150f2d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 19 Feb 2020 09:40:17 -0500 Subject: [PATCH 22/32] minor fixes --- MVMCoreUI.xcodeproj/project.pbxproj | 2 +- .../List/RightVariable/ListRightVariablePayments.swift | 3 ++- .../List/RightVariable/ListRightVariablePaymentsModel.swift | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 698242f9..281a0672 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -789,8 +789,8 @@ AA4FC2A323F4F69600E251DB /* RightVariable */ = { isa = PBXGroup; children = ( - AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */, AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */, + AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */, ); path = RightVariable; sourceTree = ""; diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 046bc331..42f0b7da 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -37,6 +37,7 @@ import Foundation contentView.addSubview(stack) containerHelper.constrainView(stack) } + //---------------------------------------------------- // MARK: - Molecule //------------------------------------------------------ @@ -47,7 +48,7 @@ import Foundation public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.setWithModel(model, delegateObject, additionalData) - guard let model = model as? ListRightVariablePaymentsModel else { return} + guard let model = model as? ListRightVariablePaymentsModel else { return } leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData) rightImage.setWithModel(model.image, delegateObject, additionalData) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index 63719ec1..681f2078 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -11,7 +11,7 @@ import Foundation public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtocol { public static var identifier: String = "listRVImg" - public var image: ImageViewModel? + public var image: ImageViewModel public var leftLabel: LabelModel public init(image: ImageViewModel, leftLabel: LabelModel) { @@ -44,6 +44,6 @@ public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtoco var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) try container.encode(leftLabel, forKey: .leftLabel) - try container.encodeIfPresent(image, forKey: .image) + try container.encode(image, forKey: .image) } } From cbe01463d9a50905de0b618f3246c29f547f7b66 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Wed, 19 Feb 2020 11:26:24 -0500 Subject: [PATCH 23/32] moleculeName --- .../Atoms/TextFields/BaseDropdownEntryFieldModel.swift | 2 +- MVMCoreUI/Atoms/TextFields/TextFieldModel.swift | 2 +- MVMCoreUI/Atoms/Views/CaretViewModel.swift | 2 ++ MVMCoreUI/Atoms/Views/CheckboxModel.swift | 2 ++ MVMCoreUI/Atoms/Views/DashLineModel.swift | 2 ++ MVMCoreUI/Atoms/Views/ImageViewModel.swift | 1 + MVMCoreUI/Atoms/Views/LeftRightLabelModel.swift | 5 +++++ MVMCoreUI/Atoms/Views/MultiProgressModel.swift | 2 ++ MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift | 2 ++ .../HorizontalCombinationViews/ImageHeadlineBodyModel.swift | 1 + MVMCoreUI/Molecules/Items/StackItemModel.swift | 1 + .../LeftRightViews/ActionDetailWithImageModel.swift | 1 + .../ToggleMolecules/HeadlineBodyLinkToggleModel.swift | 1 + .../ToggleMolecules/HeadlineBodyToggleModel.swift | 1 + .../LeftRightViews/ToggleMolecules/LabelToggleModel.swift | 6 ++++++ MVMCoreUI/Molecules/ScrollerModel.swift | 1 + .../EyebrowHeadlineBodyLinkModel.swift | 2 +- .../VerticalCombinationViews/HeadlineBodyButtonModel.swift | 1 + .../VerticalCombinationViews/HeadlineBodyLinkModel.swift | 1 + .../VerticalCombinationViews/HeadlineBodyModel.swift | 1 + 20 files changed, 34 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atoms/TextFields/BaseDropdownEntryFieldModel.swift b/MVMCoreUI/Atoms/TextFields/BaseDropdownEntryFieldModel.swift index e6e7cb24..496625dc 100644 --- a/MVMCoreUI/Atoms/TextFields/BaseDropdownEntryFieldModel.swift +++ b/MVMCoreUI/Atoms/TextFields/BaseDropdownEntryFieldModel.swift @@ -37,9 +37,9 @@ } public override func encode(to encoder: Encoder) throws { - try super.encode(to: encoder) try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) try container.encode(caretView, forKey: .caretView) } } diff --git a/MVMCoreUI/Atoms/TextFields/TextFieldModel.swift b/MVMCoreUI/Atoms/TextFields/TextFieldModel.swift index 6caa70b0..e26995d6 100644 --- a/MVMCoreUI/Atoms/TextFields/TextFieldModel.swift +++ b/MVMCoreUI/Atoms/TextFields/TextFieldModel.swift @@ -12,7 +12,7 @@ import UIKit public static var identifier: String = "textField" public var backgroundColor: Color? - public var moleculeName: String + public var moleculeName: String? = TextFieldModel.identifier public var editable: Bool? public var disabled: Bool? public var errorMsg: String? diff --git a/MVMCoreUI/Atoms/Views/CaretViewModel.swift b/MVMCoreUI/Atoms/Views/CaretViewModel.swift index 58291984..cf90496f 100644 --- a/MVMCoreUI/Atoms/Views/CaretViewModel.swift +++ b/MVMCoreUI/Atoms/Views/CaretViewModel.swift @@ -18,6 +18,7 @@ import Foundation public var lineWidth: CGFloat? private enum CodingKeys: String, CodingKey { + case moleculeName case backgroundColor case strokeColor case isHidden @@ -38,6 +39,7 @@ import Foundation public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) try container.encode(strokeColor, forKey: .strokeColor) try container.encodeIfPresent(isHidden, forKey: .isHidden) try container.encodeIfPresent(isOpaque, forKey: .isOpaque) diff --git a/MVMCoreUI/Atoms/Views/CheckboxModel.swift b/MVMCoreUI/Atoms/Views/CheckboxModel.swift index aa5dedb4..de79c6c6 100644 --- a/MVMCoreUI/Atoms/Views/CheckboxModel.swift +++ b/MVMCoreUI/Atoms/Views/CheckboxModel.swift @@ -39,6 +39,7 @@ import Foundation //-------------------------------------------------- private enum CodingKeys: String, CodingKey { + case moleculeName case groupName case value case fieldKey @@ -85,6 +86,7 @@ import Foundation public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) try container.encodeIfPresent(groupName, forKey: .groupName) try container.encodeIfPresent(value, forKey: .value) try container.encodeIfPresent(fieldKey, forKey: .fieldKey) diff --git a/MVMCoreUI/Atoms/Views/DashLineModel.swift b/MVMCoreUI/Atoms/Views/DashLineModel.swift index 1346b5c2..7f5ac992 100644 --- a/MVMCoreUI/Atoms/Views/DashLineModel.swift +++ b/MVMCoreUI/Atoms/Views/DashLineModel.swift @@ -20,6 +20,7 @@ import Foundation } private enum CodingKeys: String, CodingKey { + case moleculeName case backgroundColor case dashColor case isHidden @@ -36,6 +37,7 @@ import Foundation public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) try container.encode(dashColor, forKey: .dashColor) try container.encodeIfPresent(isHidden, forKey: .isHidden) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) diff --git a/MVMCoreUI/Atoms/Views/ImageViewModel.swift b/MVMCoreUI/Atoms/Views/ImageViewModel.swift index 97f31ad2..d23289bf 100644 --- a/MVMCoreUI/Atoms/Views/ImageViewModel.swift +++ b/MVMCoreUI/Atoms/Views/ImageViewModel.swift @@ -11,6 +11,7 @@ import Foundation @objcMembers public class ImageViewModel: MoleculeModelProtocol { public static var identifier: String = "image" public var backgroundColor: Color? + public var moleculeName: String? = ImageViewModel.identifier public var image: String public var accessibilityText: String? public var fallbackImage: String? diff --git a/MVMCoreUI/Atoms/Views/LeftRightLabelModel.swift b/MVMCoreUI/Atoms/Views/LeftRightLabelModel.swift index 325611ec..d7ee1553 100644 --- a/MVMCoreUI/Atoms/Views/LeftRightLabelModel.swift +++ b/MVMCoreUI/Atoms/Views/LeftRightLabelModel.swift @@ -10,7 +10,12 @@ import UIKit @objcMembers public class LeftRightLabelModel: MoleculeModelProtocol { public static var identifier: String = "leftRightLabelView" + public var moleculeName: String? = LeftRightLabelModel.identifier public var backgroundColor: Color? public var leftText: LabelModel public var rightText: LabelModel? + + init(_ leftText: LabelModel) { + self.leftText = leftText + } } diff --git a/MVMCoreUI/Atoms/Views/MultiProgressModel.swift b/MVMCoreUI/Atoms/Views/MultiProgressModel.swift index 6dd05b0b..4033fd28 100644 --- a/MVMCoreUI/Atoms/Views/MultiProgressModel.swift +++ b/MVMCoreUI/Atoms/Views/MultiProgressModel.swift @@ -26,6 +26,7 @@ import Foundation public var roundedRect: Bool? private enum CodingKeys: String, CodingKey { + case moleculeName case progressList case thickness case roundedRect @@ -46,6 +47,7 @@ import Foundation public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) try container.encode(progressList, forKey: .progressList) try container.encodeIfPresent(thickness, forKey: .thickness) try container.encodeIfPresent(roundedRect, forKey: .roundedRect) diff --git a/MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift b/MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift index 42acd2f0..af6100ac 100644 --- a/MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift +++ b/MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift @@ -11,6 +11,7 @@ import Foundation @objcMembers public class DoughnutChartModel: MoleculeModelProtocol { public var backgroundColor: Color? public static var identifier: String = "doughnutChart" + public var moleculeName: String? = DoughnutChartModel.identifier public var title: LabelModel? public var subtitle: LabelModel? public var sections: [DoughnutChartItemModel] @@ -24,6 +25,7 @@ import Foundation @objcMembers public class DoughnutChartItemModel: MoleculeModelProtocol { public var backgroundColor: Color? public static var identifier: String = "doughnutChartItem" + public var moleculeName: String? = DoughnutChartItemModel.identifier public var label: LabelModel @Percent public var percent: CGFloat public var color: Color diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/ImageHeadlineBodyModel.swift b/MVMCoreUI/Molecules/HorizontalCombinationViews/ImageHeadlineBodyModel.swift index 4966ce58..7f3d52dc 100644 --- a/MVMCoreUI/Molecules/HorizontalCombinationViews/ImageHeadlineBodyModel.swift +++ b/MVMCoreUI/Molecules/HorizontalCombinationViews/ImageHeadlineBodyModel.swift @@ -10,6 +10,7 @@ import Foundation public struct ImageHeadlineBodyModel: MoleculeModelProtocol { public static var identifier: String = "imageHeadlineBody" + public var moleculeName: String? = ImageHeadlineBodyModel.identifier public var backgroundColor: Color? public var image: ImageViewModel public var headlineBody: HeadlineBodyModel diff --git a/MVMCoreUI/Molecules/Items/StackItemModel.swift b/MVMCoreUI/Molecules/Items/StackItemModel.swift index 2058353c..b7d1a269 100644 --- a/MVMCoreUI/Molecules/Items/StackItemModel.swift +++ b/MVMCoreUI/Molecules/Items/StackItemModel.swift @@ -10,6 +10,7 @@ import Foundation @objcMembers public class StackItemModel: ContainerModel, StackItemModelProtocol, MoleculeModelProtocol { public static var identifier: String = "simpleStackItem" + public var moleculeName: String? = StackItemModel.identifier public var backgroundColor: Color? public var spacing: CGFloat? public var percent: Int? diff --git a/MVMCoreUI/Molecules/LeftRightViews/ActionDetailWithImageModel.swift b/MVMCoreUI/Molecules/LeftRightViews/ActionDetailWithImageModel.swift index a397c1a1..9dbf53c0 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/ActionDetailWithImageModel.swift +++ b/MVMCoreUI/Molecules/LeftRightViews/ActionDetailWithImageModel.swift @@ -10,6 +10,7 @@ import Foundation public struct ActionDetailWithImageModel: MoleculeModelProtocol { public static var identifier: String = "actionDetailWithImage" + public var moleculeName: String? = ActionDetailWithImageModel.identifier public var backgroundColor: Color? public var headlineBodyButton: HeadlineBodyButtonModel public var image: ImageViewModel diff --git a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggleModel.swift b/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggleModel.swift index 5ce04f9c..aad8ec06 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggleModel.swift +++ b/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggleModel.swift @@ -9,6 +9,7 @@ import Foundation public struct HeadlineBodyLinkToggleModel: MoleculeModelProtocol { public static var identifier: String = "headlineBodyLinkToggle" + public var moleculeName: String? = HeadlineBodyLinkToggleModel.identifier public var backgroundColor: Color? public var headlineBodyLink: HeadlineBodyLinkModel public var toggle: ToggleModel diff --git a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggleModel.swift b/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggleModel.swift index dd7c2b1c..bb3391a6 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggleModel.swift +++ b/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggleModel.swift @@ -11,6 +11,7 @@ import Foundation open class HeadlineBodyToggleModel: MoleculeModelProtocol { public static var identifier: String = "headlineBodyToggle" + public var moleculeName: String? = HeadlineBodyToggleModel.identifier open var backgroundColor: Color? open var headlineBody: HeadlineBodyModel open var toggle: ToggleModel diff --git a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/LabelToggleModel.swift b/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/LabelToggleModel.swift index 7ed5857e..526ac6b9 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/LabelToggleModel.swift +++ b/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/LabelToggleModel.swift @@ -10,7 +10,13 @@ import Foundation public class LabelToggleModel: MoleculeModelProtocol { public static var identifier: String = "labelToggle" + public var moleculeName: String? = LabelToggleModel.identifier public var backgroundColor: Color? public var label: LabelModel public var toggle: ToggleModel + + init(_ label: LabelModel, _ toggle: ToggleModel) { + self.label = label + self.toggle = toggle + } } diff --git a/MVMCoreUI/Molecules/ScrollerModel.swift b/MVMCoreUI/Molecules/ScrollerModel.swift index f92fe13b..91dc2e1c 100644 --- a/MVMCoreUI/Molecules/ScrollerModel.swift +++ b/MVMCoreUI/Molecules/ScrollerModel.swift @@ -10,5 +10,6 @@ import UIKit public class ScrollerModel: MoleculeContainerModel, MoleculeModelProtocol { public static var identifier: String = "scroller" + public var moleculeName: String? = ScrollerModel.identifier public var backgroundColor: Color? } diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift index e9341535..81a38111 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift @@ -11,7 +11,7 @@ import Foundation struct EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol { static var identifier: String = "eyebrowHeadlineBodyLink" var backgroundColor: Color? - + var moleculeName: String? = EyebrowHeadlineBodyLinkModel.identifier public var eyeBrow: LabelModel? public var headline: LabelModel? public var body: LabelModel? diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift index 74e85ea9..ec97fda0 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift @@ -10,6 +10,7 @@ import Foundation public struct HeadlineBodyButtonModel: MoleculeModelProtocol { public static var identifier: String = "headlineBodyButton" + public var moleculeName: String? = HeadlineBodyButtonModel.identifier public var backgroundColor: Color? public var headlineBody: HeadlineBodyModel diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyLinkModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyLinkModel.swift index 9eae8e03..27f0d670 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyLinkModel.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyLinkModel.swift @@ -10,6 +10,7 @@ import Foundation public struct HeadlineBodyLinkModel: MoleculeModelProtocol { public static var identifier: String = "headlineBodyLink" + public var moleculeName: String? = HeadlineBodyLinkModel.identifier public var headlineBody: HeadlineBodyModel public var link: LinkModel public var backgroundColor: Color? diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift index fd5be23a..d7a08091 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift @@ -10,6 +10,7 @@ import Foundation @objcMembers public class HeadlineBodyModel: MoleculeModelProtocol { public static var identifier: String = "headlineBody" + public var moleculeName: String? = HeadlineBodyModel.identifier public var headline: LabelModel? public var body: LabelModel? public var style: String? From 23fa0c5badf8f03228ee0ab034d19045f2595d89 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 19 Feb 2020 12:36:28 -0500 Subject: [PATCH 24/32] reverting --- MVMCoreUI/Atoms/Buttons/LinkModel.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/MVMCoreUI/Atoms/Buttons/LinkModel.swift b/MVMCoreUI/Atoms/Buttons/LinkModel.swift index a3dc940c..28fc8596 100644 --- a/MVMCoreUI/Atoms/Buttons/LinkModel.swift +++ b/MVMCoreUI/Atoms/Buttons/LinkModel.swift @@ -13,9 +13,7 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { // MARK: - Properties //-------------------------------------------------- - public class var identifier: String { - return "link" - } + public static var identifier: String = "link" public var backgroundColor: Color? public var title: String @@ -23,7 +21,6 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { public var enabled = true public var textColor = Color(uiColor: .mvmBlack) public var disabledColor = Color(uiColor: .mvmCoolGray6) - public var moleculeName: String? //-------------------------------------------------- // MARK: - Initializer @@ -54,7 +51,6 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) title = try typeContainer.decode(String.self, forKey: .title) action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) From 08cf275ba4d0c0a8b1b82708ef6fd0ea2f1dcbf5 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Wed, 19 Feb 2020 13:59:28 -0500 Subject: [PATCH 25/32] space --- MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift b/MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift index af6100ac..1e5c7dce 100644 --- a/MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift +++ b/MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift @@ -11,7 +11,7 @@ import Foundation @objcMembers public class DoughnutChartModel: MoleculeModelProtocol { public var backgroundColor: Color? public static var identifier: String = "doughnutChart" - public var moleculeName: String? = DoughnutChartModel.identifier + public var moleculeName: String? = DoughnutChartModel.identifier public var title: LabelModel? public var subtitle: LabelModel? public var sections: [DoughnutChartItemModel] From b5ac3b0b763efe79c0053616bf37b10a7bfa5769 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Wed, 19 Feb 2020 14:09:34 -0500 Subject: [PATCH 26/32] fixes --- MVMCoreUI/Molecules/Items/CarouselItemModel.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/MVMCoreUI/Molecules/Items/CarouselItemModel.swift b/MVMCoreUI/Molecules/Items/CarouselItemModel.swift index f2c88e9b..9fc218a7 100644 --- a/MVMCoreUI/Molecules/Items/CarouselItemModel.swift +++ b/MVMCoreUI/Molecules/Items/CarouselItemModel.swift @@ -14,7 +14,6 @@ import Foundation public var backgroundColor: Color? public var peakingUI: Bool? public var peakingArrowColor: Color? - public var moleculeName: String? private enum CodingKeys: String, CodingKey { case moleculeName @@ -25,7 +24,6 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) peakingUI = try typeContainer.decodeIfPresent(Bool.self, forKey: .peakingUI) peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor) From f38b577321743965583ab9cfeb8d48047f4c996d Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Wed, 19 Feb 2020 14:26:52 -0500 Subject: [PATCH 27/32] add missing moleculeName --- MVMCoreUI/Atoms/Buttons/CaretLinkModel.swift | 2 ++ MVMCoreUI/Atoms/Buttons/LinkModel.swift | 2 ++ MVMCoreUI/Atoms/TextFields/EntryFieldModel.swift | 2 -- MVMCoreUI/Atoms/Views/CircleProgressModel.swift | 2 ++ MVMCoreUI/Atoms/Views/ToggleModel.swift | 1 - MVMCoreUI/Molecules/HorizontalCombinationViews/TabsModel.swift | 2 ++ MVMCoreUI/Molecules/LeftRightViews/CornerLabelsModel.swift | 2 ++ .../Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift | 1 + MVMCoreUI/Organisms/CarouselModel.swift | 2 +- MVMCoreUI/Organisms/StackModel.swift | 1 + 10 files changed, 13 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atoms/Buttons/CaretLinkModel.swift b/MVMCoreUI/Atoms/Buttons/CaretLinkModel.swift index defe6816..4b28fc8c 100644 --- a/MVMCoreUI/Atoms/Buttons/CaretLinkModel.swift +++ b/MVMCoreUI/Atoms/Buttons/CaretLinkModel.swift @@ -30,6 +30,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol { case enabledColor case disabledColor case enabled + case moleculeName } required public init(from decoder: Decoder) throws { @@ -50,6 +51,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol { public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) try container.encode(title, forKey: .title) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeModel(action, forKey: .action) diff --git a/MVMCoreUI/Atoms/Buttons/LinkModel.swift b/MVMCoreUI/Atoms/Buttons/LinkModel.swift index f4fab34c..1092289f 100644 --- a/MVMCoreUI/Atoms/Buttons/LinkModel.swift +++ b/MVMCoreUI/Atoms/Buttons/LinkModel.swift @@ -29,6 +29,7 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { case enabled case textColor case disabledColor + case moleculeName } required public init(from decoder: Decoder) throws { @@ -56,5 +57,6 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { try container.encode(enabled, forKey: .enabled) try container.encode(textColor, forKey: .textColor) try container.encode(disabledColor, forKey: .disabledColor) + try container.encode(moleculeName, forKey: .moleculeName) } } diff --git a/MVMCoreUI/Atoms/TextFields/EntryFieldModel.swift b/MVMCoreUI/Atoms/TextFields/EntryFieldModel.swift index 1030fb8c..e4a794bc 100644 --- a/MVMCoreUI/Atoms/TextFields/EntryFieldModel.swift +++ b/MVMCoreUI/Atoms/TextFields/EntryFieldModel.swift @@ -19,7 +19,6 @@ import Foundation } public var backgroundColor: Color? - public var moleculeName: String? public var title: String? public var feedback: String? public var errorMessage: String = "" @@ -54,7 +53,6 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) title = try typeContainer.decodeIfPresent(String.self, forKey: .title) feedback = try typeContainer.decodeIfPresent(String.self, forKey: .feedback) diff --git a/MVMCoreUI/Atoms/Views/CircleProgressModel.swift b/MVMCoreUI/Atoms/Views/CircleProgressModel.swift index c4f55bef..9a1908f8 100644 --- a/MVMCoreUI/Atoms/Views/CircleProgressModel.swift +++ b/MVMCoreUI/Atoms/Views/CircleProgressModel.swift @@ -48,6 +48,7 @@ public class CircleProgressModel: MoleculeModelProtocol { case duration case colors case backgroundColor + case moleculeName } required public init(from decoder: Decoder) throws { @@ -78,6 +79,7 @@ public class CircleProgressModel: MoleculeModelProtocol { public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) try container.encode(style, forKey: .style) try container.encode(size, forKey: .size) try container.encode(diameter, forKey: .diameter) diff --git a/MVMCoreUI/Atoms/Views/ToggleModel.swift b/MVMCoreUI/Atoms/Views/ToggleModel.swift index 9cd96f45..aafacec8 100644 --- a/MVMCoreUI/Atoms/Views/ToggleModel.swift +++ b/MVMCoreUI/Atoms/Views/ToggleModel.swift @@ -10,7 +10,6 @@ import UIKit public class ToggleModel: MoleculeModelProtocol { public static var identifier: String = "toggle" - public var moleculeName: String? public var backgroundColor: Color? public var state: Bool = true public var action: ActionModelProtocol? diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/TabsModel.swift b/MVMCoreUI/Molecules/HorizontalCombinationViews/TabsModel.swift index f45c771d..8b69c590 100644 --- a/MVMCoreUI/Molecules/HorizontalCombinationViews/TabsModel.swift +++ b/MVMCoreUI/Molecules/HorizontalCombinationViews/TabsModel.swift @@ -22,6 +22,7 @@ public class TabsModel: MoleculeModelProtocol { case backgroundColor case selectedColor case selectedIndex + case moleculeName } public init(with tabs: [LabelModel]) { @@ -42,6 +43,7 @@ public class TabsModel: MoleculeModelProtocol { public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) try container.encode(tabs, forKey: .tabs) try container.encode(backgroundColor, forKey: .backgroundColor) try container.encode(selectedColor, forKey: .selectedColor) diff --git a/MVMCoreUI/Molecules/LeftRightViews/CornerLabelsModel.swift b/MVMCoreUI/Molecules/LeftRightViews/CornerLabelsModel.swift index f4b67216..bb3e6f17 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/CornerLabelsModel.swift +++ b/MVMCoreUI/Molecules/LeftRightViews/CornerLabelsModel.swift @@ -28,6 +28,7 @@ public class CornerLabelsModel: MoleculeModelProtocol { case bottomLeftLabel case bottomRightLabel case molecule + case moleculeName } required public init(from decoder: Decoder) throws { @@ -48,5 +49,6 @@ public class CornerLabelsModel: MoleculeModelProtocol { try container.encodeIfPresent(topRightLabel, forKey: .topRightLabel) try container.encodeIfPresent(bottomLeftLabel, forKey: .bottomLeftLabel) try container.encodeIfPresent(bottomRightLabel, forKey: .bottomRightLabel) + try container.encode(moleculeName, forKey: .moleculeName) } } diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift index caa00021..c66f27b8 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift @@ -38,5 +38,6 @@ public class StringAndMoleculeModel: MoleculeModelProtocol { try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encode(string, forKey: .string) try container.encodeModel(molecule, forKey: .molecule) + try container.encode(moleculeName, forKey: .moleculeName) } } diff --git a/MVMCoreUI/Organisms/CarouselModel.swift b/MVMCoreUI/Organisms/CarouselModel.swift index e43e6caa..79693135 100644 --- a/MVMCoreUI/Organisms/CarouselModel.swift +++ b/MVMCoreUI/Organisms/CarouselModel.swift @@ -53,7 +53,7 @@ import UIKit public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(moleculeName, forKey: .moleculeName) + try container.encode(moleculeName, forKey: .moleculeName) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encode(molecules, forKey: .molecules) try container.encode(spacing, forKey: .spacing) diff --git a/MVMCoreUI/Organisms/StackModel.swift b/MVMCoreUI/Organisms/StackModel.swift index 741946c5..8d670efb 100644 --- a/MVMCoreUI/Organisms/StackModel.swift +++ b/MVMCoreUI/Organisms/StackModel.swift @@ -45,5 +45,6 @@ import Foundation try container.encodeIfPresent(molecules, forKey: .molecules) try container.encodeIfPresent(axis.rawValueString, forKey: .axis) try container.encodeIfPresent(spacing, forKey: .spacing) + try container.encode(moleculeName, forKey: .moleculeName) } } From 5c42c4bf28d5206aa52848b183b48fe7e90be470 Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Wed, 19 Feb 2020 14:45:51 -0500 Subject: [PATCH 28/32] remove typo --- MVMCoreUI/Atoms/Buttons/LinkModel.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/MVMCoreUI/Atoms/Buttons/LinkModel.swift b/MVMCoreUI/Atoms/Buttons/LinkModel.swift index 590cdbf7..a4fe6cf2 100644 --- a/MVMCoreUI/Atoms/Buttons/LinkModel.swift +++ b/MVMCoreUI/Atoms/Buttons/LinkModel.swift @@ -43,7 +43,6 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { case enabled case textColor case disabledColor - case moleculeName } //-------------------------------------------------- @@ -74,9 +73,7 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeModel(action, forKey: .action) try container.encode(enabled, forKey: .enabled) - try container.encode(moleculeName, forKey: .moleculeName) try container.encode(textColor, forKey: .textColor) try container.encode(disabledColor, forKey: .disabledColor) - try container.encode(moleculeName, forKey: .moleculeName) } } From 6b1a02c369518e4e9739b6ec0a1b563f0f7f4d0e Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Wed, 19 Feb 2020 14:48:31 -0500 Subject: [PATCH 29/32] fix typo --- MVMCoreUI/Atoms/Buttons/LinkModel.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/Atoms/Buttons/LinkModel.swift b/MVMCoreUI/Atoms/Buttons/LinkModel.swift index a4fe6cf2..7094a038 100644 --- a/MVMCoreUI/Atoms/Buttons/LinkModel.swift +++ b/MVMCoreUI/Atoms/Buttons/LinkModel.swift @@ -70,6 +70,7 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(title, forKey: .title) + try container.encode(moleculeName, forKey: .moleculeName) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeModel(action, forKey: .action) try container.encode(enabled, forKey: .enabled) From 50d1d1a13a9af6b67fb50b5cc12171b765fb2d62 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 19 Feb 2020 17:12:50 -0500 Subject: [PATCH 30/32] Fixes to allow bundle improvements --- MVMCoreUI/Atoms/Views/ImageViewModel.swift | 14 +++++++++++++- MVMCoreUI/Atoms/Views/MFLoadImageView.swift | 6 +++--- .../RightVariable/ListRightVariablePayments.swift | 2 +- .../ListRightVariablePaymentsModel.swift | 7 +++++-- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ImageViewModel.swift b/MVMCoreUI/Atoms/Views/ImageViewModel.swift index 97f31ad2..02140bf9 100644 --- a/MVMCoreUI/Atoms/Views/ImageViewModel.swift +++ b/MVMCoreUI/Atoms/Views/ImageViewModel.swift @@ -18,8 +18,20 @@ import Foundation public var width: CGFloat? public var height: CGFloat? public var contentMode: UIView.ContentMode? - + public var localBundle: Bundle? + public init(image: String) { self.image = image } + + private enum CodingKeys: String, CodingKey { + case backgroundColor + case image + case accessibilityText + case fallbackImage + case imageFormat + case width + case height + case contentMode + } } diff --git a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift index 156e187d..0079d1a6 100644 --- a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift +++ b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift @@ -233,7 +233,7 @@ import UIKit if shouldLoadImage(withName: imageModel.image, width: width, height: height) { imageView.image = nil imageView.animatedImage = nil - loadImage(withName: imageModel.image, format: imageModel.imageFormat, width: width as NSNumber?, height: height as NSNumber?, customFallbackImage: imageModel.fallbackImage) + loadImage(withName: imageModel.image, format: imageModel.imageFormat, width: width as NSNumber?, height: height as NSNumber?, customFallbackImage: imageModel.fallbackImage, localBundle: imageModel.localBundle) } if let contentMode = imageModel.contentMode { @@ -276,7 +276,7 @@ import UIKit } // MARK: - load functions - public func loadImage(withName imageName: String?, format: String? = nil, width: NSNumber? = nil, height: NSNumber? = nil, customFallbackImage: String? = nil, allowServerParameters: Bool = false, completionHandler: MVMCoreGetImageBlock? = nil) { + public func loadImage(withName imageName: String?, format: String? = nil, width: NSNumber? = nil, height: NSNumber? = nil, customFallbackImage: String? = nil, allowServerParameters: Bool = false, localBundle: Bundle? = nil, completionHandler: MVMCoreGetImageBlock? = nil) { let completionBlock = completionHandler ?? defaultCompletionBlock() MVMCoreDispatchUtility.performBlock(onMainThread: { [unowned self] in @@ -308,7 +308,7 @@ import UIKit // Gifs aren't supported by default and need special handling MVMCoreCache.shared()?.getGif(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, allowServerQueryParameters: allowServerParameters, completionHandler: finishedLoadingBlock) } else { - MVMCoreCache.shared()?.getImage(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, allowServerQueryParameters: allowServerParameters, completionHandler: finishedLoadingBlock) + MVMCoreCache.shared()?.getImage(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, allowServerQueryParameters: allowServerParameters, localBundle: localBundle, completionHandler: finishedLoadingBlock) } }) } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 42f0b7da..2bfbc321 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -56,7 +56,7 @@ import Foundation let leftLabel = StackItemModel() leftLabel.horizontalAlignment = .leading let rightImage = StackItemModel() - rightImage.horizontalAlignment = .trailing + rightImage.horizontalAlignment = .fill let stackModel = StackModel(molecules: [leftLabel,rightImage]) stackModel.axis = .horizontal stack.model = stackModel diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index 681f2078..a8c6ff80 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -21,8 +21,11 @@ public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtoco } static func createPayPalImage() -> ImageViewModel { - let image = ImageViewModel(image: "imagename_paypal") - image.width = 30.0 + let image = ImageViewModel(image: "imageName_PayPal_logo") + image.localBundle = MVMCoreUIUtility.bundleForMVMCoreUI() + image.width = 70.0 + image.height = 18.0 + image.contentMode = .scaleAspectFit return image } From 6563a14ff72c7d97a72a27f4ce6ca68f3bacbdf2 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 19 Feb 2020 17:19:36 -0500 Subject: [PATCH 31/32] moleculeName coddle --- MVMCoreUI/Atoms/Views/ImageViewModel.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/Atoms/Views/ImageViewModel.swift b/MVMCoreUI/Atoms/Views/ImageViewModel.swift index 00694c69..0f585119 100644 --- a/MVMCoreUI/Atoms/Views/ImageViewModel.swift +++ b/MVMCoreUI/Atoms/Views/ImageViewModel.swift @@ -26,6 +26,7 @@ import Foundation } private enum CodingKeys: String, CodingKey { + case moleculeName case backgroundColor case image case accessibilityText From 0947ba93ef13dcfa7d33efd356fe9ae464e0e00c Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 19 Feb 2020 17:31:47 -0500 Subject: [PATCH 32/32] paypal image --- .../Contents.json | 23 ++++++++++++++++++ .../paypal_horiz_logo.jpeg | Bin 0 -> 1826 bytes .../paypal_horiz_logo@2x.jpeg | Bin 0 -> 3418 bytes .../paypal_horiz_logo@3x.jpeg | Bin 0 -> 4606 bytes 4 files changed, 23 insertions(+) create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/Contents.json create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo.jpeg create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo@2x.jpeg create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo@3x.jpeg diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/Contents.json new file mode 100644 index 00000000..b4c381b8 --- /dev/null +++ b/MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "paypal_horiz_logo.jpeg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "paypal_horiz_logo@2x.jpeg", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "paypal_horiz_logo@3x.jpeg", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo.jpeg b/MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..95113ebf4001cf2eed20fbe23530dea3d1e475a9 GIT binary patch literal 1826 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 literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo@3x.jpeg b/MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo@3x.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..cbd78652ce3bdb9fb3e62b4b4522b2f40b1556a2 GIT binary patch literal 4606 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 literal 0 HcmV?d00001