diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 8de69762..ad7231bb 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -154,6 +154,8 @@ 94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; }; AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */; }; AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */; }; + AA3CA8D0241627CE008BF379 /* HeadersH1Bill.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3CA8CF241627CE008BF379 /* HeadersH1Bill.swift */; }; + AA3CA8D2241627DB008BF379 /* HeadersH1BillModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3CA8D1241627DB008BF379 /* HeadersH1BillModel.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 */; }; @@ -505,6 +507,8 @@ 94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = ""; }; AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePayments.swift; sourceTree = ""; }; AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePaymentsModel.swift; sourceTree = ""; }; + AA3CA8CF241627CE008BF379 /* HeadersH1Bill.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1Bill.swift; sourceTree = ""; }; + AA3CA8D1241627DB008BF379 /* HeadersH1BillModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1BillModel.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 = ""; }; @@ -1054,6 +1058,8 @@ 525239C32407FFCC00454969 /* LockUps */, D22B38EC23F4E10700490EF6 /* SectionDividers */, D22B38EA23F4E08B00490EF6 /* List */, + AA3CA8CF241627CE008BF379 /* HeadersH1Bill.swift */, + AA3CA8D1241627DB008BF379 /* HeadersH1BillModel.swift */, ); path = DesignedComponents; sourceTree = ""; @@ -1788,6 +1794,7 @@ D29DF27621E79E81003B2FB9 /* MVMCoreUILoggingHandler.m in Sources */, C695A69623C990BC00BFB94E /* DoughnutChart.swift in Sources */, 014AA72D23C5059B006F3E93 /* StackPageTemplateModel.swift in Sources */, + AA3CA8D0241627CE008BF379 /* HeadersH1Bill.swift in Sources */, D260106123D0C02A00764D80 /* StackItemModelProtocol.swift in Sources */, 0AE98BAF23FEF956004C5109 /* ExternalLink.swift in Sources */, 012A88C4238D86E600FE3DA1 /* CarouselItemModelProtocol.swift in Sources */, @@ -1847,6 +1854,7 @@ D22479942316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift in Sources */, D2B18B94236214AD00A9AEDC /* NavigationController.swift in Sources */, D29E28DA23D21AFA00ACEA85 /* StringAndMoleculeModel.swift in Sources */, + AA3CA8D2241627DB008BF379 /* HeadersH1BillModel.swift in Sources */, D282AACB2243C61700C46919 /* ButtonView.swift in Sources */, D260105D23D0BCD400764D80 /* Stack.swift in Sources */, 0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/HeadersH1Bill.swift b/MVMCoreUI/Molecules/DesignedComponents/HeadersH1Bill.swift new file mode 100644 index 00000000..68c696e0 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/HeadersH1Bill.swift @@ -0,0 +1,76 @@ +// +// HeadersH1Bill.swift +// MVMCoreUI +// +// Created by Lekshmi S on 09/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class HeadersH1Bill: View { + //-------------------------------------------------- + // MARK: - Outlets + //-------------------------------------------------- + let headline = Label.commonLabelH1(true) + let headline2 = Label.commonLabelH1(true) + let subHeadline = Label.commonLabelB3(true) + let body = Label.commonLabelB2(true) + let link = Link() + let buttons = TwoButtonView(frame: .zero) + var stack = Stack(frame: .zero) + + //-------------------------------------------------- + // MARK: - Constants + //-------------------------------------------------- + let spacingBetweenHeadlineHeadline2: CGFloat = 9.0 + let spacingBetweenHeadlin2esubHeadline: CGFloat = 24.0 + let spacingBetweenSubHeadlineBodyLink: CGFloat = 8.0 + let spacingBetweenLinkButtons: CGFloat = 129.0 + + + //------------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + open override func setupView() { + super.setupView() + stack = Stack.createStack(with: [(view: headline, model: StackItemModel(horizontalAlignment: .leading)), + (view: headline2, model: StackItemModel(spacing: spacingBetweenHeadlineHeadline2, horizontalAlignment: .leading)), (view: subHeadline, model: StackItemModel(spacing: spacingBetweenHeadlin2esubHeadline, horizontalAlignment: .leading)), (view: body, model: StackItemModel(spacing: spacingBetweenSubHeadlineBodyLink, horizontalAlignment: .leading)), (view: link, model: StackItemModel(spacing: spacingBetweenSubHeadlineBodyLink, horizontalAlignment: .leading)), (view: buttons, model: StackItemModel(spacing: spacingBetweenLinkButtons, horizontalAlignment: .leading))], axis: .vertical) + addSubview(stack) + NSLayoutConstraint.constraintPinSubview(toSuperview: stack) + } + + open override func updateView(_ size: CGFloat) { + super.updateView(size) + stack.updateView(size) + } + + //---------------------------------------------------- + // MARK: - Molecule + //------------------------------------------------------ + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? HeadersH1BillModel else { return } + headline.set(with: model.headline, delegateObject, additionalData) + headline2.set(with: model.headline2, delegateObject, additionalData) + subHeadline.set(with: model.subHeadline, delegateObject, additionalData) + body.set(with: model.body, delegateObject, additionalData) + link.set(with: model.link, delegateObject, additionalData) + buttons.set(with: model.buttons, delegateObject, additionalData) + stack.restack() + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 121 + } + + open override func reset() { + super.reset() + headline.styleH1(true) + headline2.styleH1(true) + subHeadline.styleB3(true) + body.styleB2(true) + link.reset() + buttons.reset() + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/HeadersH1BillModel.swift b/MVMCoreUI/Molecules/DesignedComponents/HeadersH1BillModel.swift new file mode 100644 index 00000000..168f63ae --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/HeadersH1BillModel.swift @@ -0,0 +1,76 @@ +// +// HeadersH1BillModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 09/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class HeadersH1BillModel: MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public static var identifier: String = "headerH1Bill" + public var backgroundColor: Color? + public var headline: LabelModel + public var headline2: LabelModel + public var subHeadline: LabelModel + public var body: LabelModel + public var link: LinkModel + public var buttons: TwoButtonViewModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + public init(headline: LabelModel, headline2: LabelModel, subHeadline: LabelModel, body: LabelModel, link: LinkModel, buttons: TwoButtonViewModel) { + self.headline = headline + self.headline2 = headline2 + self.subHeadline = subHeadline + self.body = body + self.link = link + self.buttons = buttons + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { + case moleculeName + case backgroundColor + case headline + case headline2 + case subHeadline + case body + case link + case buttons + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + headline = try typeContainer.decode(LabelModel.self, forKey: .headline) + headline2 = try typeContainer.decode(LabelModel.self, forKey: .headline2) + subHeadline = try typeContainer.decode(LabelModel.self, forKey: .subHeadline) + body = try typeContainer.decode(LabelModel.self, forKey: .body) + link = try typeContainer.decode(LinkModel.self, forKey: .link) + buttons = try typeContainer.decode(TwoButtonViewModel.self, forKey: .buttons) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) + try container.encode(headline, forKey: .headline) + try container.encode(headline2, forKey: .headline2) + try container.encode(subHeadline, forKey: .subHeadline) + try container.encode(body, forKey: .body) + try container.encode(link, forKey: .link) + try container.encode(buttons, forKey: .buttons) + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 003b5d03..2b8eaa88 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -109,6 +109,7 @@ import Foundation // Designed Section Dividers MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadersH1Bill.self, viewModelClass: HeadersH1BillModel.self) // TODO: Need model MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(DigitEntryField.self, forKey: "digitTextField" as NSString)