diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index b29cdf75..4066abcc 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -118,6 +118,8 @@ 52267A0723FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */; }; 5248BFEC23F12E350059236A /* ListThreeColumnPlanDataDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */; }; 5248BFED23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */; }; + 525019DD2406430800EED91C /* ListProgressBarDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525019DB2406430700EED91C /* ListProgressBarDataModel.swift */; }; + 525019DE2406430800EED91C /* ListProgressBarData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525019DC2406430800EED91C /* ListProgressBarData.swift */; }; 525019E52406852100EED91C /* ListFourColumnDataUsageDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525019E42406852100EED91C /* ListFourColumnDataUsageDividerModel.swift */; }; 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525019E62406853600EED91C /* ListFourColumnDataUsageDivider.swift */; }; 52B201D224081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B201D024081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift */; }; @@ -125,6 +127,10 @@ 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */; }; 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; + 942C372E241149170066E45E /* NHaasGroteskDSStd-75Bd.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */; }; + 942C372F241149170066E45E /* NHaasGroteskDSStd-55Rg.otf in Resources */ = {isa = PBXBuildFile; fileRef = 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */; }; + 942C378C2412F4FA0066E45E /* ModalMoleculeListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 942C378B2412F4FA0066E45E /* ModalMoleculeListTemplate.swift */; }; + 942C378E2412F5B60066E45E /* ModalMoleculeStackTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 942C378D2412F5B60066E45E /* ModalMoleculeStackTemplate.swift */; }; 9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9432A79E23DB47BA00719041 /* EntryFieldContainer.swift */; }; 943784F5236B77BB006A1E82 /* GraphView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F3236B77BB006A1E82 /* GraphView.swift */; }; 943784F6236B77BB006A1E82 /* GraphViewAnimationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */; }; @@ -136,7 +142,6 @@ 9455B19C234F8A0400A574DB /* MVMAnimationFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */; }; 9458C3172406C8FD00930963 /* UIFont+FontWrapping.h in Headers */ = {isa = PBXBuildFile; fileRef = 9458C3152406C8FD00930963 /* UIFont+FontWrapping.h */; settings = {ATTRIBUTES = (Public, ); }; }; 9458C3182406C8FD00930963 /* UIFont+FontWrapping.m in Sources */ = {isa = PBXBuildFile; fileRef = 9458C3162406C8FD00930963 /* UIFont+FontWrapping.m */; }; - 946EE1BA237B66D80036751F /* MoleculeModelHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 946EE1B9237B66D80036751F /* MoleculeModelHelper.swift */; }; 948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 948DB67D2326DCD90011F916 /* MultiProgress.swift */; }; 94AF4A3E23E9D13900676048 /* MFCaretButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 94AF4A3C23E9D13900676048 /* MFCaretButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 94AF4A3F23E9D13900676048 /* MFCaretButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94AF4A3D23E9D13900676048 /* MFCaretButton.m */; }; @@ -191,6 +196,7 @@ D22D1F562204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; D22D1F572204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */; }; D243859923A16B1800332775 /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = D243859823A16B1800332775 /* Container.swift */; }; + D256E9932412880000360572 /* Header.swift in Sources */ = {isa = PBXBuildFile; fileRef = D256E9922412880000360572 /* Header.swift */; }; D260105323CEA61600764D80 /* ToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105223CEA61600764D80 /* ToggleModel.swift */; }; D260105523CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105423CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift */; }; D260105923D0A92900764D80 /* ContainerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105823D0A92900764D80 /* ContainerProtocol.swift */; }; @@ -476,6 +482,8 @@ 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinks.swift; sourceTree = ""; }; 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDivider.swift; sourceTree = ""; }; 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDividerModel.swift; sourceTree = ""; }; + 525019DB2406430700EED91C /* ListProgressBarDataModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListProgressBarDataModel.swift; sourceTree = ""; }; + 525019DC2406430800EED91C /* ListProgressBarData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListProgressBarData.swift; sourceTree = ""; }; 525019E42406852100EED91C /* ListFourColumnDataUsageDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageDividerModel.swift; sourceTree = ""; }; 525019E62406853600EED91C /* ListFourColumnDataUsageDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageDivider.swift; sourceTree = ""; }; 52B201D024081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAndPaymentMethod.swift; sourceTree = ""; }; @@ -484,6 +492,10 @@ 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretModel.swift; sourceTree = ""; }; 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; 9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftRightLabelModel.swift; sourceTree = ""; }; + 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NHaasGroteskDSStd-75Bd.otf"; sourceTree = ""; }; + 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NHaasGroteskDSStd-55Rg.otf"; sourceTree = ""; }; + 942C378B2412F4FA0066E45E /* ModalMoleculeListTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalMoleculeListTemplate.swift; sourceTree = ""; }; + 942C378D2412F5B60066E45E /* ModalMoleculeStackTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalMoleculeStackTemplate.swift; sourceTree = ""; }; 9432A79E23DB47BA00719041 /* EntryFieldContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EntryFieldContainer.swift; sourceTree = ""; }; 943784F3236B77BB006A1E82 /* GraphView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphView.swift; sourceTree = ""; }; 943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphViewAnimationHandler.swift; sourceTree = ""; }; @@ -495,7 +507,6 @@ 9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MVMAnimationFramework.framework; path = ../SharedFrameworks/MVMAnimationFramework.framework; sourceTree = ""; }; 9458C3152406C8FD00930963 /* UIFont+FontWrapping.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIFont+FontWrapping.h"; sourceTree = ""; }; 9458C3162406C8FD00930963 /* UIFont+FontWrapping.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIFont+FontWrapping.m"; sourceTree = ""; }; - 946EE1B9237B66D80036751F /* MoleculeModelHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeModelHelper.swift; sourceTree = ""; }; 948DB67D2326DCD90011F916 /* MultiProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiProgress.swift; sourceTree = ""; }; 94AF4A3C23E9D13900676048 /* MFCaretButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MFCaretButton.h; sourceTree = ""; }; 94AF4A3D23E9D13900676048 /* MFCaretButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MFCaretButton.m; sourceTree = ""; }; @@ -548,6 +559,7 @@ D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIStackableViewController.h; sourceTree = ""; }; D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIStackableViewController.m; sourceTree = ""; }; D243859823A16B1800332775 /* Container.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Container.swift; sourceTree = ""; }; + D256E9922412880000360572 /* Header.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Header.swift; sourceTree = ""; }; D260105223CEA61600764D80 /* ToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleModel.swift; sourceTree = ""; }; D260105423CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUISwitch+Model.swift"; sourceTree = ""; }; D260105823D0A92900764D80 /* ContainerProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContainerProtocol.swift; sourceTree = ""; }; @@ -811,7 +823,6 @@ isa = PBXGroup; children = ( 011B58EE23A2AA850085F53C /* ModelProtocols */, - 946EE1B5237B663A0036751F /* Extensions */, ); path = Models; sourceTree = ""; @@ -875,12 +886,13 @@ path = FourColumn; sourceTree = ""; }; - 946EE1B5237B663A0036751F /* Extensions */ = { + 525239C32407FFCC00454969 /* LockUps */ = { isa = PBXGroup; children = ( - 946EE1B9237B66D80036751F /* MoleculeModelHelper.swift */, + 525019DB2406430700EED91C /* ListProgressBarDataModel.swift */, + 525019DC2406430800EED91C /* ListProgressBarData.swift */, ); - path = Extensions; + path = LockUps; sourceTree = ""; }; 94C2D9822386F3E30006CF46 /* Label */ = { @@ -1089,6 +1101,7 @@ D22B38E923F4E07800490EF6 /* DesignedComponents */ = { isa = PBXGroup; children = ( + 525239C32407FFCC00454969 /* LockUps */, D22B38EC23F4E10700490EF6 /* SectionDividers */, D22B38EA23F4E08B00490EF6 /* List */, ); @@ -1205,11 +1218,13 @@ 012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */, 014AA72823C5059B006F3E93 /* StackPageTemplateModel.swift */, D2A5146022121FBF00345BFB /* MoleculeStackTemplate.swift */, + 942C378D2412F5B60066E45E /* ModalMoleculeStackTemplate.swift */, 014AA72923C5059B006F3E93 /* StackCenteredPageTemplateModel.swift */, D2A514622213643100345BFB /* MoleculeStackCenteredTemplate.swift */, D28A837A23C928DA00DFE4FC /* MoleculeListCellProtocol.swift */, 014AA72C23C5059B006F3E93 /* ListPageTemplateModel.swift */, D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */, + 942C378B2412F4FA0066E45E /* ModalMoleculeListTemplate.swift */, 014AA72A23C5059B006F3E93 /* ThreeLayerPageTemplateModel.swift */, D2D6CD4122E78FAB00D701B8 /* ThreeLayerTemplate.swift */, ); @@ -1244,6 +1259,7 @@ D224798E2316A995003FCCF9 /* HorizontalCombinationViews */, D224798D2316A988003FCCF9 /* VerticalCombinationViews */, 01EB368C23609801006832FA /* HeaderModel.swift */, + D256E9922412880000360572 /* Header.swift */, D2D90B41240463E100DD6EC9 /* MoleculeHeaderModel.swift */, D2A514662213885800345BFB /* MoleculeHeaderView.swift */, 012A88EB238F084D00FE3DA1 /* FooterModel.swift */, @@ -1531,6 +1547,8 @@ 94CA227924058533002D6750 /* VerizonNHGeDS-Regular.otf */, 94CA227824058533002D6750 /* VerizonNHGeTX-Bold.otf */, 94CA227B24058533002D6750 /* VerizonNHGeTX-Regular.otf */, + 942C372D241149170066E45E /* NHaasGroteskDSStd-55Rg.otf */, + 942C372C241149170066E45E /* NHaasGroteskDSStd-75Bd.otf */, D29DF31721ECECC0003B2FB9 /* OCRAExtended.ttf */, ); path = Fonts; @@ -1740,6 +1758,8 @@ 0A21DB86235E06EF00C160A2 /* MFTextField.xib in Resources */, 94CA227D24058534002D6750 /* VerizonNHGeDS-Regular.otf in Resources */, D29DF32E21EE8C3D003B2FB9 /* Media.xcassets in Resources */, + 942C372E241149170066E45E /* NHaasGroteskDSStd-75Bd.otf in Resources */, + 942C372F241149170066E45E /* NHaasGroteskDSStd-55Rg.otf in Resources */, 94CA227E24058534002D6750 /* VerizonNHGeDS-Bold.otf in Resources */, D29DF31B21ECECC0003B2FB9 /* OCRAExtended.ttf in Resources */, ); @@ -1786,6 +1806,7 @@ 011D95A924057AC7000E3791 /* FormActionFieldProtocol.swift in Sources */, 0AA33B3A2398524F0067DD0F /* Toggle.swift in Sources */, D29DF12F21E6851E003B2FB9 /* MVMCoreUITopAlertMainView.m in Sources */, + 942C378C2412F4FA0066E45E /* ModalMoleculeListTemplate.swift in Sources */, 012A88C8238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift in Sources */, 0A7EF86123D8AC2500B2AAD1 /* DigitEntryFieldModel.swift in Sources */, DBC4392122491730001AB423 /* LabelWithInternalButton.swift in Sources */, @@ -1847,6 +1868,7 @@ D213347723843825008E41B3 /* Line.swift in Sources */, D28A837723C79FC600DFE4FC /* MFCustomButton+ActionModel.swift in Sources */, D2E2A99C23D8D975000B42E6 /* ImageHeadlineBodyModel.swift in Sources */, + 525019DE2406430800EED91C /* ListProgressBarData.swift in Sources */, D28A837F23CCA96400DFE4FC /* TabsModel.swift in Sources */, 012A88EC238F084D00FE3DA1 /* FooterModel.swift in Sources */, D2A514672213885800345BFB /* MoleculeHeaderView.swift in Sources */, @@ -1887,6 +1909,8 @@ 0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */, D2D6CD4222E78FAB00D701B8 /* ThreeLayerTemplate.swift in Sources */, 01EB368F23609801006832FA /* LabelModel.swift in Sources */, + 942C378E2412F5B60066E45E /* ModalMoleculeStackTemplate.swift in Sources */, + 0105618F224BBE7700E1557D /* FormValidator+FormParams.swift in Sources */, 01F2A03223A4498200D954D8 /* CaretLinkModel.swift in Sources */, 0A7BAFA1232BE61800FB8E22 /* Checkbox.swift in Sources */, 011B58F023A2AA980085F53C /* ListItemModelProtocol.swift in Sources */, @@ -1899,6 +1923,7 @@ D29DF18321E69E54003B2FB9 /* SeparatorView.m in Sources */, D29DF17A21E69E1F003B2FB9 /* MFCustomButton.m in Sources */, 017BEB7B236763000024EF95 /* LineModel.swift in Sources */, + D256E9932412880000360572 /* Header.swift in Sources */, 94C2D9A523872C350006CF46 /* LabelAttributeFontModel.swift in Sources */, 011D958724042492000E3791 /* FormFieldProtocol.swift in Sources */, 011D95AF2407266E000E3791 /* RadioButtonModel.swift in Sources */, @@ -2021,6 +2046,7 @@ 94C661D923CCF4B400D9FE5B /* LeftRightLabelModel.swift in Sources */, 011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */, D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */, + 525019DD2406430800EED91C /* ListProgressBarDataModel.swift in Sources */, C6FA7D5223C77A4A00A3614A /* UnOrderedList.swift in Sources */, 01509D8F2327EC6F00EF99AA /* MoleculeTableViewCell.swift in Sources */, 0105618D224BBE7700E1557D /* FormValidator.swift in Sources */, diff --git a/MVMCoreUI/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atoms/Buttons/ButtonModel.swift index 2826ac03..ac9d1dc1 100644 --- a/MVMCoreUI/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atoms/Buttons/ButtonModel.swift @@ -81,9 +81,9 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormAction 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) + action = try typeContainer.decodeModel(codingKey: .action) if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) { - self.groupName = groupName + self.groupName = groupName } if let style = try typeContainer.decodeIfPresent(ButtonStyle.self, forKey: .style) { self.style = style diff --git a/MVMCoreUI/Atoms/Buttons/CaretLinkModel.swift b/MVMCoreUI/Atoms/Buttons/CaretLinkModel.swift index 4ea79ef8..8f3ee74d 100644 --- a/MVMCoreUI/Atoms/Buttons/CaretLinkModel.swift +++ b/MVMCoreUI/Atoms/Buttons/CaretLinkModel.swift @@ -46,7 +46,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol { if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { self.enabled = enabled } - action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) + action = try typeContainer.decodeModel(codingKey: .action) } public func encode(to encoder: Encoder) throws { diff --git a/MVMCoreUI/Atoms/Buttons/Link/LinkModel.swift b/MVMCoreUI/Atoms/Buttons/Link/LinkModel.swift index 6e7fc83d..7a4661bd 100644 --- a/MVMCoreUI/Atoms/Buttons/Link/LinkModel.swift +++ b/MVMCoreUI/Atoms/Buttons/Link/LinkModel.swift @@ -55,7 +55,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) 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) + action = try typeContainer.decodeModel(codingKey: .action) if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { self.enabled = enabled diff --git a/MVMCoreUI/Atoms/Views/Checkbox.swift b/MVMCoreUI/Atoms/Views/Checkbox.swift index a87c3e3e..f288c4cd 100644 --- a/MVMCoreUI/Atoms/Views/Checkbox.swift +++ b/MVMCoreUI/Atoms/Views/Checkbox.swift @@ -19,9 +19,8 @@ import MVMCore public var sizeObject: MFSizeObject? = MFSizeObject(standardSize: Checkbox.defaultHeightWidth, standardiPadPortraitSize: Checkbox.defaultHeightWidth + 6.0) // Form Validation - var isRequired = false var fieldKey: String? - var fieldValue: String? + var fieldValue: JSONValue? var groupName: String? var delegateObject: MVMCoreUIDelegateObject? @@ -398,7 +397,7 @@ import MVMCore //layoutIfNeeded() } - + public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? CheckboxModel else { return } diff --git a/MVMCoreUI/Atoms/Views/CheckboxModel.swift b/MVMCoreUI/Atoms/Views/CheckboxModel.swift index cf7f7298..70224200 100644 --- a/MVMCoreUI/Atoms/Views/CheckboxModel.swift +++ b/MVMCoreUI/Atoms/Views/CheckboxModel.swift @@ -15,22 +15,23 @@ import Foundation public static var identifier: String = "checkbox" public var backgroundColor: Color? - - public var borderColor: Color = Color(uiColor: .black) - public var borderWidth: CGFloat = 1 public var isChecked: Bool = false + public var isEnabled: Bool = true + public var isAnimated: Bool = true + public var isRound: Bool = false + public var borderWidth: CGFloat = 1 + public var borderColor: Color = Color(uiColor: .black) public var checkColor: Color = Color(uiColor: .black) public var unCheckedBackgroundColor: Color = Color(uiColor: .clear) public var checkedBackgroundColor: Color = Color(uiColor: .clear) - public var isAnimated: Bool = true - public var isRound: Bool = false - public var isEnabled: Bool = true - public var action: ActionModelProtocol? public var disabledBackgroundColor: Color = Color(uiColor: .clear) public var disabledBorderColor: Color = Color(uiColor: .mvmCoolGray3) public var disabledCheckColor: Color = Color(uiColor: .mvmCoolGray3) + public var action: ActionModelProtocol? + public var fieldKey: String? + public var fieldValue: JSONValue? public var groupName: String? = FormValidator.defaultGroupName public var baseValue: JSONValue? @@ -41,18 +42,19 @@ import Foundation private enum CodingKeys: String, CodingKey { case moleculeName case fieldKey - case borderColor + case fieldValue + case isChecked = "checked" + case isEnabled = "enabled" + case isAnimated = "animated" + case isRound = "round" case borderWidth - case isChecked + case borderColor case checkColor case unCheckedBackgroundColor case checkedBackgroundColor case disabledBackgroundColor case disabledCheckColor case disabledBorderColor - case isAnimated - case isRound - case isEnabled case action case groupName } @@ -69,6 +71,7 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + fieldValue = try typeContainer.decodeIfPresent(JSONValue.self, forKey: .fieldValue) fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey) borderWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .borderWidth) ?? 1 borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor) ?? Color(uiColor: .black) @@ -82,7 +85,7 @@ import Foundation isAnimated = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAnimated) ?? true isRound = try typeContainer.decodeIfPresent(Bool.self, forKey: .isRound) ?? false isEnabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .isEnabled) ?? true - action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) + action = try typeContainer.decodeModelIfPresent(codingKey: .action) if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) { self.groupName = groupName } @@ -91,6 +94,8 @@ 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(fieldValue, forKey: .fieldValue) try container.encodeIfPresent(fieldKey, forKey: .fieldKey) try container.encodeIfPresent(borderColor, forKey: .borderColor) try container.encode(borderWidth, forKey: .borderWidth) diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift b/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift index 503f00d8..3e615cdd 100644 --- a/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift +++ b/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift @@ -25,7 +25,7 @@ open class LabelAttributeActionModel: LabelAttributeModel { required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) + action = try typeContainer.decodeModel(codingKey: .action) try super.init(from: decoder) } diff --git a/MVMCoreUI/Atoms/Views/Label/LabelModel.swift b/MVMCoreUI/Atoms/Views/Label/LabelModel.swift index 3b5f2b66..7a04c577 100644 --- a/MVMCoreUI/Atoms/Views/Label/LabelModel.swift +++ b/MVMCoreUI/Atoms/Views/Label/LabelModel.swift @@ -74,7 +74,7 @@ import Foundation fontName = try typeContainer.decodeIfPresent(String.self, forKey: .fontName) fontSize = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .fontSize) textAlignment = try typeContainer.decodeIfPresent(String.self, forKey: .textAlignment) - attributes = try typeContainer.decodeModelsIfPresent(codingKey: .attributes, typeCodingKey: AttributeTypeKey.type) as? [LabelAttributeModel] + attributes = try typeContainer.decodeModelsIfPresent(codingKey: .attributes) html = try typeContainer.decodeIfPresent(String.self, forKey: .html) hero = try typeContainer.decodeIfPresent(Int.self, forKey: .hero) makeWholeViewClickable = try typeContainer.decodeIfPresent(Bool.self, forKey: .makeWholeViewClickable) @@ -91,10 +91,7 @@ import Foundation try container.encodeIfPresent(fontName, forKey: .fontName) try container.encodeIfPresent(fontSize, forKey: .fontSize) try container.encodeIfPresent(textAlignment, forKey: .textAlignment) - var attributeContainer = container.nestedUnkeyedContainer(forKey: .attributes) - try attributes?.forEach { attributeModel in - try attributeContainer.encode(attributeModel) - } + try container.encodeModelsIfPresent(attributes, forKey: .attributes) try container.encodeIfPresent(html, forKey: .html) try container.encodeIfPresent(hero, forKey: .hero) try container.encodeIfPresent(makeWholeViewClickable, forKey: .makeWholeViewClickable) diff --git a/MVMCoreUI/Atoms/Views/ToggleModel.swift b/MVMCoreUI/Atoms/Views/ToggleModel.swift index 51f49828..afe9ed41 100644 --- a/MVMCoreUI/Atoms/Views/ToggleModel.swift +++ b/MVMCoreUI/Atoms/Views/ToggleModel.swift @@ -43,8 +43,8 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol { if let state = try typeContainer.decodeIfPresent(Bool.self, forKey: .state) { self.state = state } - action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) - alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction, typeCodingKey: ActionCodingKey.actionType) + action = try typeContainer.decodeModelIfPresent(codingKey: .action) + alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey) if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) { diff --git a/MVMCoreUI/Categories/NSLayoutConstraintExtension.swift b/MVMCoreUI/Categories/NSLayoutConstraintExtension.swift index 4057a88c..242e3fc0 100644 --- a/MVMCoreUI/Categories/NSLayoutConstraintExtension.swift +++ b/MVMCoreUI/Categories/NSLayoutConstraintExtension.swift @@ -10,48 +10,48 @@ import Foundation public extension NSLayoutConstraint { - /// Pins the views vertically in the super view, allowing the super to expand depending on the tallest view. Shorter views are aligned center. - static func pinViewsVerticalExpandableAlignCenter(_ views: [UIView]) { + /// Pins the views vertically to the top and bottom anchor, allowing the super to expand depending on the tallest view. Shorter views are aligned center. + static func pinViewsVerticalExpandableAlignCenter(_ views: [UIView], topAnchor: NSLayoutYAxisAnchor? = nil, bottomAnchor: NSLayoutYAxisAnchor? = nil, constant: CGFloat = 0) { for view in views { - guard let superView = view.superview else { - return - } + guard let superView = view.superview else { return } + let top = topAnchor ?? superView.layoutMarginsGuide.topAnchor + let bottom = bottomAnchor ?? superView.layoutMarginsGuide.bottomAnchor view.centerYAnchor.constraint(equalTo: superView.centerYAnchor).isActive = true - view.topAnchor.constraint(greaterThanOrEqualTo: superView.layoutMarginsGuide.topAnchor).isActive = true - superView.layoutMarginsGuide.bottomAnchor.constraint(greaterThanOrEqualTo: view.bottomAnchor).isActive = true + view.topAnchor.constraint(greaterThanOrEqualTo: top).isActive = true + bottom.constraint(greaterThanOrEqualTo: view.bottomAnchor).isActive = true - var constraint = view.topAnchor.constraint(equalTo: superView.layoutMarginsGuide.topAnchor) + var constraint = view.topAnchor.constraint(equalTo: top) constraint.priority = .defaultLow constraint.isActive = true - constraint = superView.layoutMarginsGuide.bottomAnchor.constraint(equalTo: view.bottomAnchor) + constraint = bottom.constraint(equalTo: view.bottomAnchor) constraint.priority = .defaultLow constraint.isActive = true } } - /// Pins the views vertically in the super view, allowing the super to expand depending on the tallest view. Shorter views are aligned top. - static func pinViewsVerticalExpandableAlignTop(_ views: [UIView]) { + /// Pins the views vertically to the top and bottom anchor, allowing the super to expand depending on the tallest view. Shorter views are aligned top. + static func pinViewsVerticalExpandableAlignTop(_ views: [UIView], topAnchor: NSLayoutYAxisAnchor? = nil, bottomAnchor: NSLayoutYAxisAnchor? = nil, constant: CGFloat = 0) { for view in views { - guard let superView = view.superview else { - return - } - view.topAnchor.constraint(equalTo: superView.layoutMarginsGuide.topAnchor).isActive = true - superView.layoutMarginsGuide.bottomAnchor.constraint(greaterThanOrEqualTo: view.bottomAnchor).isActive = true + guard let superView = view.superview else { return } + let top = topAnchor ?? superView.layoutMarginsGuide.topAnchor + let bottom = bottomAnchor ?? superView.layoutMarginsGuide.bottomAnchor + view.topAnchor.constraint(equalTo: top).isActive = true + bottom.constraint(greaterThanOrEqualTo: view.bottomAnchor, constant: constant).isActive = true - let constraint = superView.layoutMarginsGuide.bottomAnchor.constraint(equalTo: view.bottomAnchor) + let constraint = bottom.constraint(equalTo: view.bottomAnchor) constraint.priority = .defaultLow constraint.isActive = true } } /// Pins a view to the left and a view to the right, flexible space in between. The super can expand depending on the taller view. Shorter views are aligned top if alignTop true, else aligned center. - static func pinViews(leftView: UIView, rightView: UIView, alignTop: Bool) { + static func pinViews(leftView: UIView, rightView: UIView, alignTop: Bool, topAnchor: NSLayoutYAxisAnchor? = nil, bottomAnchor: NSLayoutYAxisAnchor? = nil, constant: CGFloat = 0) { guard let superView = leftView.superview else { return } if alignTop { - pinViewsVerticalExpandableAlignTop([leftView, rightView]) + pinViewsVerticalExpandableAlignTop([leftView, rightView], topAnchor: topAnchor, bottomAnchor: bottomAnchor, constant: constant) } else { - pinViewsVerticalExpandableAlignCenter([leftView, rightView]) + pinViewsVerticalExpandableAlignCenter([leftView, rightView], topAnchor: topAnchor, bottomAnchor: bottomAnchor, constant: constant) } leftView.leadingAnchor.constraint(equalTo: superView.layoutMarginsGuide.leadingAnchor).isActive = true superView.layoutMarginsGuide.trailingAnchor.constraint(equalTo: rightView.trailingAnchor).isActive = true diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index 1a72a190..2c82fe21 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -50,11 +50,14 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { // Convenience getter + (nullable instancetype)mainSplitViewController; +/// Initializes the splitviewcontroller with the passed in panels. +- (nullable instancetype)initWithLeftPanel:(nullable UIViewController *)leftPanel rightPanel:(nullable UIViewController *)rightPanel; + // Returns a split controller with the mvm styling. Also sets the appropriate handlers. -+ (nullable instancetype)setup; ++ (nullable instancetype)setup:(nullable UIViewController *)leftPanel rightPanel:(nullable UIViewController *)rightPanel; // Returns a split controller with the mvm styling. Also sets the appropriate handlers. Also sets up the default load screen -+ (nullable instancetype)setupAsMainController; ++ (nullable instancetype)setupAsMainController:(nullable UIViewController *)leftPanel rightPanel:(nullable UIViewController *)rightPanel; #pragma mark - Panel Functions @@ -83,9 +86,6 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { // contains speicaly logic to set the icon color - (void)setNavigationIconColor:(nullable UIColor *)color; -///create right and left panel. if left and right panel is already created, will replace them -- (void)createPanels; - /// Updates the panels that are used. - (void)setupPanels; @@ -123,10 +123,6 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { // Can subclass to set threshold for when the drawers are permanently extended. Default is 1000 for the left panel and 2000 for both. - (MFNumberOfDrawers)numberOfDrawersShouldShow:(nullable NSNumber *)forWidth; -// subclass to return default global panels. kept alive after creation. -- (nullable UIViewController *)createLeftPanelViewController; -- (nullable UIViewController *)createRightPanelViewController; - // subclass to change image of back button - (nullable UIImage *)imageForBackButton; diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 93aeb6fd..44642f3a 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -76,18 +76,26 @@ CGFloat const PanelAnimationDuration = 0.2; return [MVMCoreActionUtility initializerClassCheck:[MVMCoreUISession sharedGlobal].splitViewController classToVerify:self]; } -+ (nullable instancetype)setup { - MVMCoreUISplitViewController *splitViewController = [[self alloc] init]; ++ (nullable instancetype)setup:(nullable UIViewController *)leftPanel rightPanel:(nullable UIViewController *)rightPanel { + MVMCoreUISplitViewController *splitViewController = [[self alloc] initWithLeftPanel:leftPanel rightPanel:rightPanel]; [MVMCoreUISession sharedGlobal].splitViewController = splitViewController; return splitViewController; } -+ (nullable instancetype)setupAsMainController { - MVMCoreUISplitViewController *splitViewController = [self setup]; ++ (nullable instancetype)setupAsMainController:(nullable UIViewController *)leftPanel rightPanel:(nullable UIViewController *)rightPanel { + MVMCoreUISplitViewController *splitViewController = [self setup:leftPanel rightPanel:rightPanel]; [[MVMCoreUISession sharedGlobal] setupAsStandardLoadViewDelegate:splitViewController]; return splitViewController; } +- (nullable instancetype)initWithLeftPanel:(nullable UIViewController *)leftPanel rightPanel:(nullable UIViewController *)rightPanel { + if (self = [super init]) { + self.globalLeftPanel = leftPanel; + self.globalRightPanel = rightPanel; + } + return self; +} + #pragma mark - Main Subclassables - (MFNumberOfDrawers)numberOfDrawersShouldShow:(NSNumber *)forWidth { @@ -100,14 +108,6 @@ CGFloat const PanelAnimationDuration = 0.2; return (width > 2000 ? MFTwoDrawer : (width > 1000 ? MFOneDrawer : MFNoDrawer)); } -- (nullable UIViewController *)createLeftPanelViewController { - return nil; -} - -- (nullable UIViewController *)createRightPanelViewController { - return nil; -} - - (nullable NSArray *)additionalLeftButtons { return nil; } @@ -766,13 +766,6 @@ CGFloat const PanelAnimationDuration = 0.2; } } -- (void)createPanels { - // Create panels - self.globalLeftPanel = [self createLeftPanelViewController]; - self.globalRightPanel = [self createRightPanelViewController]; - [self setupPanels]; -} - - (void)setupPanels { [self forceHideBothDrawers]; [self setupLeftPanel]; @@ -869,7 +862,7 @@ CGFloat const PanelAnimationDuration = 0.2; [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES; [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES; - [self createPanels]; + [self setupPanels]; } - (void)viewDidLoad { diff --git a/MVMCoreUI/Containers/Views/MoleculeContainerModel.swift b/MVMCoreUI/Containers/Views/MoleculeContainerModel.swift index 95683f8f..01116a48 100644 --- a/MVMCoreUI/Containers/Views/MoleculeContainerModel.swift +++ b/MVMCoreUI/Containers/Views/MoleculeContainerModel.swift @@ -22,7 +22,7 @@ public class MoleculeContainerModel: ContainerModel, MoleculeContainerModelProto required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - molecule = try typeContainer.decodeMolecule(codingKey: .molecule) + molecule = try typeContainer.decodeModel(codingKey: .molecule) try super.init(from: decoder) } diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/FormGroupRule.swift b/MVMCoreUI/FormUIHelpers/New/Rules/FormGroupRule.swift index bc3bd023..29872de7 100644 --- a/MVMCoreUI/FormUIHelpers/New/Rules/FormGroupRule.swift +++ b/MVMCoreUI/FormUIHelpers/New/Rules/FormGroupRule.swift @@ -8,16 +8,6 @@ import Foundation -extension KeyedDecodingContainer where Key: CodingKey { - /// Decodes the list of molecule models with the given coding key based on moleculeName - public func decodeFormRules(codingKey: KeyedDecodingContainer.Key) throws -> [RulesProtocol] { - guard let models = try decodeModels(codingKey: codingKey, typeCodingKey: RulesCodingKey.ruleType) as? [RulesProtocol] else { - throw ModelRegistry.Error.decoderError - } - return models - } -} - open class FormGroupRule: Codable { // public static var identifier: String = "formRule" @@ -37,7 +27,8 @@ open class FormGroupRule: Codable { required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) self.groupName = try typeContainer.decode(String.self, forKey: .groupName) - self.rules = try typeContainer.decodeFormRules(codingKey: .rules) + self.rules = try typeContainer.decodeModels(codingKey: .rules) + //try typeContainer.decodeFormRules(codingKey: .rules) } public func encode(to encoder: Encoder) throws { diff --git a/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.h b/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.h index af699ddc..e86d3f9e 100644 --- a/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.h +++ b/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.h @@ -23,6 +23,7 @@ @property (nullable, weak, nonatomic) UIView *containerView; @property (nullable, weak, nonatomic) UIView *indicatorRectangle; @property (nullable, copy, nonatomic) PagingTouchBlock pagingTouchBlock; +@property (nullable, strong, nonatomic) UITapGestureRecognizer *tapGestureRecognizer; ///set YES to make the accessibility value as "Slide #currentPage of #totalPage", otherwise will be "Page #currentPage of #totalPage", default is NO @property (nonatomic) BOOL isSlidesAcc; diff --git a/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m b/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m index 6648b513..9a8f880f 100644 --- a/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m +++ b/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m @@ -267,6 +267,7 @@ static CGFloat const IndicatorRectangleHeight = 4; UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] init]; [tapGesture addTarget:self action:@selector(rectangleTapped:)]; [self addGestureRecognizer:tapGesture]; + self.tapGestureRecognizer = tapGesture; } } diff --git a/MVMCoreUI/Models/Extensions/MoleculeModelHelper.swift b/MVMCoreUI/Models/Extensions/MoleculeModelHelper.swift deleted file mode 100644 index 87460640..00000000 --- a/MVMCoreUI/Models/Extensions/MoleculeModelHelper.swift +++ /dev/null @@ -1,53 +0,0 @@ -// -// MoleculeModelHelper.swift -// MVMCoreUI -// -// Created by Ryan on 11/12/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - - -extension KeyedDecodingContainer where Key: CodingKey { - - private enum TypeCodingKey: String, CodingKey { - case moleculeName - } - - /// Decodes the molecule model with the given coding key based on moleculeName - public func decodeMolecule(codingKey: KeyedDecodingContainer.Key) throws -> MoleculeModelProtocol { - return try decodeModel(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) - } - - /// Decodes the molecule model with the given coding key based on moleculeName, optional - public func decodeMoleculeIfPresent(codingKey: KeyedDecodingContainer.Key) throws -> MoleculeModelProtocol? { - return try decodeModelIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) - } - - /// Decodes the list of molecule models with the given coding key based on moleculeName - public func decodeMolecules(codingKey: KeyedDecodingContainer.Key) throws -> [MoleculeModelProtocol] { - guard let models = try decodeModels(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [MoleculeModelProtocol] else { - throw ModelRegistry.Error.decoderError - } - return models - } - - /// Decodes the list of molecule models with the given coding key based on moleculeName, optional - public func decodeMoleculesIfPresent(codingKey: KeyedDecodingContainer.Key) throws -> [MoleculeModelProtocol]? { - return try decodeModelsIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [MoleculeModelProtocol] - } - - /// Decodes an array with arrays of molecules based on the identifiers, optional. - public func decodeMolecules2DIfPresent(codingKey: KeyedDecodingContainer.Key) throws -> [[MoleculeModelProtocol]]? { - return try decodeModels2DIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [[MoleculeModelProtocol]] - } - - /// Decodes an array with arrays of models based on the identifiers. - public func decodeMolecules2D(codingKey: KeyedDecodingContainer.Key) throws -> [[MoleculeModelProtocol]] { - guard let models = try decodeModels2D(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [[MoleculeModelProtocol]] else { - throw ModelRegistry.Error.decoderError - } - return models - } -} diff --git a/MVMCoreUI/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift b/MVMCoreUI/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift new file mode 100644 index 00000000..48f734ad --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift @@ -0,0 +1,73 @@ +// +// ListProgressBarData.swift +// MVMCoreUI +// +// Created by Kruthika KP on 18/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + +@objcMembers open class ListProgressBarData: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + let progressBar = MultiProgress(frame: .zero) + let leftLabel = Label.createLabelBoldBodySmall(true) + let rightLabel = Label.createLabelBoldBodySmall(true) + let view = MVMCoreUICommonViewsUtility.commonView() + + //----------------------------------------------------- + // MARK: - MFViewProtocol + //----------------------------------------------------- + override open func setupView() { + super.setupView() + + rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) + view.addSubview(progressBar) + view.addSubview(leftLabel) + view.addSubview(rightLabel) + contentView.addSubview(view) + containerHelper.constrainView(view) + NSLayoutConstraint.pinViews(leftView: leftLabel, rightView: rightLabel, alignTop: true, bottomAnchor: progressBar.topAnchor, constant: 8) + progressBar.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true + progressBar.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true + view.bottomAnchor.constraint(equalTo: progressBar.bottomAnchor).isActive = true + } + + public override func updateView(_ size: CGFloat) { + super.updateView(size) + progressBar.updateView(size) + leftLabel.updateView(size) + rightLabel.updateView(size) + } + + //----------------------------------------------------- + // MARK: - ModelMoleculeViewProtocol + //----------------------------------------------------- + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListProgressBarDataModel else { return} + progressBar.set(with: model.progressBar, delegateObject, additionalData) + leftLabel.set(with: model.leftLabel, delegateObject, additionalData) + rightLabel.set(with: model.rightLabel, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } + + //----------------------------------------------------- + // MARK: - MVMCoreUIMoleculeViewProtocol + //----------------------------------------------------- + override open func reset() { + super.reset() + progressBar.reset() + leftLabel.reset() + rightLabel.reset() + leftLabel.styleBoldBodySmall(true) + rightLabel.styleBoldBodySmall(true) + } +} + diff --git a/MVMCoreUI/Molecules/DesignedComponents/LockUps/ListProgressBarDataModel.swift b/MVMCoreUI/Molecules/DesignedComponents/LockUps/ListProgressBarDataModel.swift new file mode 100644 index 00000000..de6ada2e --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/LockUps/ListProgressBarDataModel.swift @@ -0,0 +1,47 @@ +// +// ListProgressBarDataModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 18/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListProgressBarDataModel : ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "listPrgBarData" + public var progressBar : MultiProgressBarModel + public var leftLabel: LabelModel + public var rightLabel: LabelModel + + public init (progressBar: MultiProgressBarModel, leftLabel: LabelModel, rightLabel: LabelModel){ + self.progressBar = progressBar + self.leftLabel = leftLabel + self.rightLabel = rightLabel + super.init() + } + + private enum CodingKeys: String, CodingKey{ + case moleculeName + case progressBar + case leftLabel + case rightLabel + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + progressBar = try typeContainer.decode(MultiProgressBarModel.self, forKey: .progressBar) + leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) + rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(progressBar, forKey: .progressBar) + try container.encode(leftLabel, forKey: .leftLabel) + try container.encode(rightLabel, forKey: .rightLabel) + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift index 35968599..8e37c16a 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift @@ -38,7 +38,7 @@ import Foundation stack.restack() } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - ModelMoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? ListFourColumnDataUsageDividerModel else { return } @@ -48,6 +48,10 @@ import Foundation label4.set(with: model.label4, delegateObject, additionalData) } + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 121 + } + // MARK: - MVMCoreUIMoleculeViewProtocol open override func reset() { super.reset() @@ -56,8 +60,4 @@ import Foundation label3.styleBoldBodySmall(true) label4.styleBoldBodySmall(true) } - - open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - return 121 - } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDivider.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDivider.swift index 9adbe531..cc904a77 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDivider.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDivider.swift @@ -35,7 +35,7 @@ import Foundation stack.restack() } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - ModelMoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? ListThreeColumnPlanDataDividerModel else { return } diff --git a/MVMCoreUI/Molecules/Header.swift b/MVMCoreUI/Molecules/Header.swift new file mode 100644 index 00000000..c878c5ff --- /dev/null +++ b/MVMCoreUI/Molecules/Header.swift @@ -0,0 +1,63 @@ +// +// Header.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 3/6/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +open class HeaderView: Container { + public let line = Line() + + /// Convenience for doing some default setting + open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)? + + var headerModel: HeaderModel? { + get { return model as? HeaderModel } + } + + /// Convenience function to add a molecule to the view. + open func addMolecule(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) { + addSubview(molecule) + containerHelper.constrainView(molecule) + self.molecule = molecule + } + + // MARK: - MVMCoreViewProtocol + open override func updateView(_ size: CGFloat) { + super.updateView(size) + line.updateView(size) + molecule?.updateView(size) + } + + public override func setupView() { + super.setupView() + line.setStyle(.heavy) + addSubview(line) + NSLayoutConstraint.pinViewBottom(toSuperview: line, useMargins: false, constant: 0).isActive = true + NSLayoutConstraint.pinViewLeft(toSuperview: line, useMargins: true, constant: 0).isActive = true + NSLayoutConstraint.pinViewRight(toSuperview: line, useMargins: true, constant: 0).isActive = true + } + + // MARK: - MVMCoreUIMoleculeViewProtocol + open override func reset() { + super.reset() + line.setStyle(.heavy) + molecule?.reset?() + } + + // MARK: - ModelMoleculeViewProtocol + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let headerModel = headerModel else { return } + if let lineModel = headerModel.line { + line.set(with: lineModel, delegateObject, additionalData) + } + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return PaddingDefaultVerticalSpacing + PaddingDefaultVerticalSpacing + } +} diff --git a/MVMCoreUI/Molecules/Items/AccordionListItemModel.swift b/MVMCoreUI/Molecules/Items/AccordionListItemModel.swift index 60192c2d..ac299a8b 100644 --- a/MVMCoreUI/Molecules/Items/AccordionListItemModel.swift +++ b/MVMCoreUI/Molecules/Items/AccordionListItemModel.swift @@ -29,10 +29,7 @@ class AccordionListItemModel: MoleculeListItemModel { required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - guard let molecules = try typeContainer.decodeMolecules(codingKey: .molecules) as? [ListItemModelProtocol & MoleculeModelProtocol] else { - throw DecodingError.typeMismatch([ListItemModelProtocol & MoleculeModelProtocol].self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "Casting failed")) - } - self.molecules = molecules + molecules = try typeContainer.decodeModels(codingKey: .molecules) if let hideLine = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideLineWhenExpanded) { hideLineWhenExpanded = hideLine } diff --git a/MVMCoreUI/Molecules/Items/DropDownListItemModel.swift b/MVMCoreUI/Molecules/Items/DropDownListItemModel.swift index b623f20e..99d493b8 100644 --- a/MVMCoreUI/Molecules/Items/DropDownListItemModel.swift +++ b/MVMCoreUI/Molecules/Items/DropDownListItemModel.swift @@ -51,7 +51,7 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - molecules = try typeContainer.decodeMolecules2D(codingKey: .molecules) as? [[ListItemModelProtocol & MoleculeModelProtocol]] ?? [[]] + molecules = try typeContainer.decodeModels2D(codingKey: .molecules) dropDown = try typeContainer.decode(ItemDropdownEntryFieldModel.self, forKey: .dropDown) try super.init(from: decoder) } diff --git a/MVMCoreUI/Molecules/Items/ListItemModel.swift b/MVMCoreUI/Molecules/Items/ListItemModel.swift index 3ff483eb..9365125a 100644 --- a/MVMCoreUI/Molecules/Items/ListItemModel.swift +++ b/MVMCoreUI/Molecules/Items/ListItemModel.swift @@ -65,7 +65,7 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) + action = try typeContainer.decodeModelIfPresent(codingKey: .action) hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) style = try typeContainer.decodeIfPresent(String.self, forKey: .style) diff --git a/MVMCoreUI/Molecules/Items/MoleculeListItemModel.swift b/MVMCoreUI/Molecules/Items/MoleculeListItemModel.swift index 499669c6..1384ee88 100644 --- a/MVMCoreUI/Molecules/Items/MoleculeListItemModel.swift +++ b/MVMCoreUI/Molecules/Items/MoleculeListItemModel.swift @@ -27,7 +27,7 @@ import MVMCore required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - molecule = try typeContainer.decodeMolecule(codingKey: .molecule) + molecule = try typeContainer.decodeModel(codingKey: .molecule) try super.init(from: decoder) } diff --git a/MVMCoreUI/Molecules/Items/TabsListItemModel.swift b/MVMCoreUI/Molecules/Items/TabsListItemModel.swift index c89ee1a0..e49b4adb 100644 --- a/MVMCoreUI/Molecules/Items/TabsListItemModel.swift +++ b/MVMCoreUI/Molecules/Items/TabsListItemModel.swift @@ -37,7 +37,7 @@ public class TabsListItemModel: ListItemModel, MoleculeModelProtocol { required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) tabs = try typeContainer.decode(TabsModel.self, forKey: .tabs) - molecules = try typeContainer.decodeMolecules2D(codingKey: .molecules) as! [[ListItemModelProtocol & MoleculeModelProtocol]] + molecules = try typeContainer.decodeModels2D(codingKey: .molecules) try super.init(from: decoder) } diff --git a/MVMCoreUI/Molecules/LeftRightViews/CornerLabelsModel.swift b/MVMCoreUI/Molecules/LeftRightViews/CornerLabelsModel.swift index bb3e6f17..76a56178 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/CornerLabelsModel.swift +++ b/MVMCoreUI/Molecules/LeftRightViews/CornerLabelsModel.swift @@ -34,7 +34,7 @@ public class CornerLabelsModel: MoleculeModelProtocol { required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - molecule = try typeContainer.decodeMoleculeIfPresent(codingKey: .molecule) + molecule = try typeContainer.decodeModelIfPresent(codingKey: .molecule) topLeftLabel = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .topLeftLabel) topRightLabel = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .topRightLabel) bottomLeftLabel = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .bottomLeftLabel) diff --git a/MVMCoreUI/Molecules/MoleculeHeaderModel.swift b/MVMCoreUI/Molecules/MoleculeHeaderModel.swift index 92958ca1..b8f2144e 100644 --- a/MVMCoreUI/Molecules/MoleculeHeaderModel.swift +++ b/MVMCoreUI/Molecules/MoleculeHeaderModel.swift @@ -24,7 +24,7 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - molecule = try typeContainer.decodeMolecule(codingKey: .molecule) + molecule = try typeContainer.decodeModel(codingKey: .molecule) try super.init(from: decoder) } diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift index 795eec7d..8a7b6125 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift @@ -23,7 +23,7 @@ import Foundation public required init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - let list = try typeContainer.decodeMolecules(codingKey: .list) + let list: [MoleculeModelProtocol] = try typeContainer.decodeModels(codingKey: .list) var models: [MoleculeStackItemModel] = [] for (index, molecule) in list.enumerated() { models.append(MoleculeStackItemModel(with: StringAndMoleculeModel(string: "\(index+1).", molecule: molecule))) diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift index c66f27b8..3adb0bb3 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift @@ -30,7 +30,7 @@ public class StringAndMoleculeModel: MoleculeModelProtocol { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) string = try typeContainer.decode(String.self, forKey: .string) - molecule = try typeContainer.decodeMolecule(codingKey: .molecule) + molecule = try typeContainer.decodeModel(codingKey: .molecule) } public func encode(to encoder: Encoder) throws { diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/UnOrderedListModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/UnOrderedListModel.swift index 87d57927..84d23a11 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/UnOrderedListModel.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/UnOrderedListModel.swift @@ -28,7 +28,7 @@ import Foundation self.bulletChar = bulletChar } - let list = try typeContainer.decodeMolecules(codingKey: .list) + let list: [MoleculeModelProtocol] = try typeContainer.decodeModels(codingKey: .list) var models: [MoleculeStackItemModel] = [] for molecule in list { models.append(MoleculeStackItemModel(with: StringAndMoleculeModel(string: bulletChar, molecule: molecule))) diff --git a/MVMCoreUI/Organisms/CarouselModel.swift b/MVMCoreUI/Organisms/CarouselModel.swift index 79693135..da12b7b8 100644 --- a/MVMCoreUI/Organisms/CarouselModel.swift +++ b/MVMCoreUI/Organisms/CarouselModel.swift @@ -48,7 +48,7 @@ import UIKit self.height = try typeContainer.decode(Float.self, forKey: .height) self.itemWidthPercent = try typeContainer.decode(Float.self, forKey: .itemWidthPercent) self.itemAlignment = try typeContainer.decode(String.self, forKey: .itemAlignment) - self.pagingMolecule = try typeContainer.decodeMoleculeIfPresent(codingKey: .pagingMolecule) as? CarouselPagingModelProtocol + self.pagingMolecule = try typeContainer.decodeModelIfPresent(codingKey: .pagingMolecule) } public func encode(to encoder: Encoder) throws { diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIViewControllerMappingObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIViewControllerMappingObject.m index 5b9592cc..6a0805f3 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIViewControllerMappingObject.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIViewControllerMappingObject.m @@ -22,7 +22,9 @@ @"stack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeStackTemplate class]], @"centerMoleculeStack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeStackCenteredTemplate class]], @"list" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeListTemplate class]], - @"threeLayer" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ThreeLayerTemplate class]] + @"threeLayer" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ThreeLayerTemplate class]], + @"stackModal" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ModalMoleculeStackTemplate class]], + @"listModal" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ModalMoleculeListTemplate class]] } mutableCopy]; }); return viewControllerMapping; diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 8d150395..d6163cec 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -79,6 +79,8 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DropDownFilterTableViewCell.self, viewModelClass: DropDownListItemModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: AccordionMoleculeTableViewCell.self, viewModelClass: AccordionListItemModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: TabsTableViewCell.self, viewModelClass: TabsListItemModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListProgressBarData.self, viewModelClass: ListProgressBarDataModel.self) + // Other Items MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeStackItem.self, viewModelClass: MoleculeStackItemModel.self) diff --git a/MVMCoreUI/SupportingFiles/Fonts/NHaasGroteskDSStd-55Rg.otf b/MVMCoreUI/SupportingFiles/Fonts/NHaasGroteskDSStd-55Rg.otf new file mode 100644 index 00000000..f56ed7aa Binary files /dev/null and b/MVMCoreUI/SupportingFiles/Fonts/NHaasGroteskDSStd-55Rg.otf differ diff --git a/MVMCoreUI/SupportingFiles/Fonts/NHaasGroteskDSStd-75Bd.otf b/MVMCoreUI/SupportingFiles/Fonts/NHaasGroteskDSStd-75Bd.otf new file mode 100644 index 00000000..fbcba354 Binary files /dev/null and b/MVMCoreUI/SupportingFiles/Fonts/NHaasGroteskDSStd-75Bd.otf differ diff --git a/MVMCoreUI/Templates/ListPageTemplateModel.swift b/MVMCoreUI/Templates/ListPageTemplateModel.swift index 5f8da7fc..12c300f9 100644 --- a/MVMCoreUI/Templates/ListPageTemplateModel.swift +++ b/MVMCoreUI/Templates/ListPageTemplateModel.swift @@ -62,10 +62,10 @@ import Foundation let typeContainer = try decoder.container(keyedBy: CodingKeys.self) pageType = try typeContainer.decode(String.self, forKey: .pageType) screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading) - molecules = try typeContainer.decodeMoleculesIfPresent(codingKey: .molecules) as? [ListItemModelProtocol & MoleculeModelProtocol] + molecules = try typeContainer.decodeModelsIfPresent(codingKey: .molecules) isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs) - header = try typeContainer.decodeMoleculeIfPresent(codingKey: .header) - footer = try typeContainer.decodeMoleculeIfPresent(codingKey: .footer) + header = try typeContainer.decodeModelIfPresent(codingKey: .header) + footer = try typeContainer.decodeModelIfPresent(codingKey: .footer) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) formRules = try typeContainer.decodeIfPresent([FormGroupRule].self, forKey: .formRules) } diff --git a/MVMCoreUI/Templates/ModalMoleculeListTemplate.swift b/MVMCoreUI/Templates/ModalMoleculeListTemplate.swift new file mode 100644 index 00000000..6dae1700 --- /dev/null +++ b/MVMCoreUI/Templates/ModalMoleculeListTemplate.swift @@ -0,0 +1,20 @@ +// +// ModalMoleculeListTemplate.swift +// MVMCoreUI +// +// Created by Ryan on 3/6/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + +open class ModalMoleculeListTemplate: MoleculeListTemplate { + + override open func newDataBuildScreen() { + super.newDataBuildScreen() + MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: {[weak self] _ in + self?.dismiss() + }, verticalCentered: false) + } + +} diff --git a/MVMCoreUI/Templates/ModalMoleculeStackTemplate.swift b/MVMCoreUI/Templates/ModalMoleculeStackTemplate.swift new file mode 100644 index 00000000..9f1ea9b9 --- /dev/null +++ b/MVMCoreUI/Templates/ModalMoleculeStackTemplate.swift @@ -0,0 +1,20 @@ +// +// ModalMoleculeStackTemplate.swift +// MVMCoreUI +// +// Created by Ryan on 3/6/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + +open class ModalMoleculeStackTemplate: MoleculeStackTemplate { + + override open func newDataBuildScreen() { + super.newDataBuildScreen() + MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: {[weak self] _ in + self?.dismiss() + }, verticalCentered: false) + } + +} diff --git a/MVMCoreUI/Templates/StackPageTemplateModel.swift b/MVMCoreUI/Templates/StackPageTemplateModel.swift index 1e5541eb..ed94e4ef 100644 --- a/MVMCoreUI/Templates/StackPageTemplateModel.swift +++ b/MVMCoreUI/Templates/StackPageTemplateModel.swift @@ -44,8 +44,8 @@ import Foundation moleculeStack = try typeContainer.decode(MoleculeStackModel.self, forKey: .stack) screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading) isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs) - header = try typeContainer.decodeMoleculeIfPresent(codingKey: .header) - footer = try typeContainer.decodeMoleculeIfPresent(codingKey: .footer) + header = try typeContainer.decodeModelIfPresent(codingKey: .header) + footer = try typeContainer.decodeModelIfPresent(codingKey: .footer) formRules = try typeContainer.decodeIfPresent([FormGroupRule].self, forKey: .formRules) } diff --git a/MVMCoreUI/Templates/ThreeLayerPageTemplateModel.swift b/MVMCoreUI/Templates/ThreeLayerPageTemplateModel.swift index d22b6675..5ad39c4b 100644 --- a/MVMCoreUI/Templates/ThreeLayerPageTemplateModel.swift +++ b/MVMCoreUI/Templates/ThreeLayerPageTemplateModel.swift @@ -44,9 +44,9 @@ import Foundation pageType = try typeContainer.decode(String.self, forKey: .pageType) screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading) isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs) - header = try typeContainer.decodeMoleculeIfPresent(codingKey: .header) - middle = try typeContainer.decodeMoleculeIfPresent(codingKey: .middle) - footer = try typeContainer.decodeMoleculeIfPresent(codingKey: .footer) + header = try typeContainer.decodeModelIfPresent(codingKey: .header) + middle = try typeContainer.decodeModelIfPresent(codingKey: .middle) + footer = try typeContainer.decodeModelIfPresent(codingKey: .footer) } public func encode(to encoder: Encoder) throws { diff --git a/MVMCoreUI/Utility/MFFonts.h b/MVMCoreUI/Utility/MFFonts.h index 46947581..fb4bbe92 100644 --- a/MVMCoreUI/Utility/MFFonts.h +++ b/MVMCoreUI/Utility/MFFonts.h @@ -14,6 +14,9 @@ extern NSString * _Nonnull const DSBold; extern NSString * _Nonnull const DSRegular; extern NSString * _Nonnull const TXBold; extern NSString * _Nonnull const TXRegular; +//2.0 font +extern NSString * _Nonnull const DS75Bd; +extern NSString * _Nonnull const DS55Rg; @interface MFFonts : NSObject diff --git a/MVMCoreUI/Utility/MFFonts.m b/MVMCoreUI/Utility/MFFonts.m index 0a73fb36..533b3a87 100644 --- a/MVMCoreUI/Utility/MFFonts.m +++ b/MVMCoreUI/Utility/MFFonts.m @@ -17,6 +17,10 @@ NSString * const DSRegular = @"VerizonNHGeDS-Regular"; NSString * const TXBold = @"VerizonNHGeTX-Bold"; NSString * const TXRegular = @"VerizonNHGeTX-Regular"; +//2.0 font +NSString * const DS75Bd = @"NHaasGroteskDSStd-75Bd"; +NSString * const DS55Rg = @"NHaasGroteskDSStd-55Rg"; + @implementation MFFonts @@ -27,6 +31,8 @@ NSString * const TXRegular = @"VerizonNHGeTX-Regular"; [MFFonts loadFont:DSRegular type:@"otf"]; [MFFonts loadFont:TXBold type:@"otf"]; [MFFonts loadFont:TXRegular type:@"otf"]; + [MFFonts loadFont:DS75Bd type:@"otf"]; + [MFFonts loadFont:DS55Rg type:@"otf"]; [MFFonts loadFont:@"OCRAExtended" type:@"ttf"]; }); } @@ -49,50 +55,44 @@ NSString * const TXRegular = @"VerizonNHGeTX-Regular"; } + (nonnull UIFont *)mfFontDSBold:(CGFloat)size { + [self loadMVMFonts]; UIFont *font = [UIFont fontWithName:DSBold size:size]; [self validFont:font fontName:DSBold]; return font ?: [UIFont boldSystemFontOfSize:size]; } + (nonnull UIFont *)mfFontDSRegular:(CGFloat)size { + [self loadMVMFonts]; UIFont *font = [UIFont fontWithName:DSRegular size:size]; [self validFont:font fontName:DSRegular]; return font ?: [UIFont systemFontOfSize:size]; } + (nonnull UIFont *)mfFontTXBold:(CGFloat)size { + [self loadMVMFonts]; UIFont *font = [UIFont fontWithName:TXBold size:size]; [self validFont:font fontName:TXBold]; return font ?: [UIFont boldSystemFontOfSize:size]; } + (nonnull UIFont *)mfFontTXRegular:(CGFloat)size { + [self loadMVMFonts]; UIFont *font = [UIFont fontWithName:TXRegular size:size]; [self validFont:font fontName:TXRegular]; return font ?: [UIFont systemFontOfSize:size]; } -+ (UIFont *)mfFont75Bd:(CGFloat)size { ++ (nonnull UIFont *)mfFont75Bd:(CGFloat)size { [self loadMVMFonts]; - UIFont *font; - if (size >= 15) { - font = [self mfFontDSBold:size]; - } else { - font = [self mfFontTXBold:size]; - } - return font; + UIFont *font = [UIFont fontWithName:DS75Bd size:size]; + return font ?: [UIFont boldSystemFontOfSize:size]; } -+ (UIFont *)mfFont55Rg:(CGFloat)size { ++ (nonnull UIFont *)mfFont55Rg:(CGFloat)size { [self loadMVMFonts]; - UIFont *font; - if (size >= 15) { - font = [self mfFontDSRegular:size]; - } else { - font = [self mfFontTXRegular:size]; - } - return font; + UIFont *font = [UIFont fontWithName:DS55Rg size:size]; + return font ?: [UIFont systemFontOfSize:size]; } + (nullable UIFont *)mfFontOcratxt:(CGFloat)size {