From 74258f642d6ed027b196daa44b76c1b03972c782 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 3 Apr 2020 15:13:07 -0400 Subject: [PATCH] move Footer and Label adapters to MF --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ---- .../Legacy/Adapters/FooterModelAdapter.swift | 40 ------------------- .../Legacy/Adapters/LabelModelAdapter.swift | 33 --------------- 3 files changed, 81 deletions(-) delete mode 100644 MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift delete mode 100644 MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 72c1db81..a63b50e6 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -106,9 +106,7 @@ 0AE98BB323FF0934004C5109 /* ExternalLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */; }; 0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB423FF18D2004C5109 /* Arrow.swift */; }; 0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */; }; - 279B1567242BBBF200921D6C /* LabelModelAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279B1566242BBBF200921D6C /* LabelModelAdapter.swift */; }; 279B1569242BBC2F00921D6C /* ActionModelAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */; }; - 279B156D242BBFF100921D6C /* FooterModelAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279B156C242BBFF100921D6C /* FooterModelAdapter.swift */; }; 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */; }; 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; }; 522679C123FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */; }; @@ -503,9 +501,7 @@ 0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalLinkModel.swift; sourceTree = ""; }; 0AE98BB423FF18D2004C5109 /* Arrow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Arrow.swift; sourceTree = ""; }; 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrowModel.swift; sourceTree = ""; }; - 279B1566242BBBF200921D6C /* LabelModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelModelAdapter.swift; sourceTree = ""; }; 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionModelAdapter.swift; sourceTree = ""; }; - 279B156C242BBFF100921D6C /* FooterModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterModelAdapter.swift; sourceTree = ""; }; 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxLabelModel.swift; sourceTree = ""; }; 31BE15CA23D8924C00452370 /* CheckboxModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxModel.swift; sourceTree = ""; }; 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = ""; }; @@ -923,9 +919,7 @@ 279B1565242BBB8500921D6C /* Adapters */ = { isa = PBXGroup; children = ( - 279B1566242BBBF200921D6C /* LabelModelAdapter.swift */, 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */, - 279B156C242BBFF100921D6C /* FooterModelAdapter.swift */, ); path = Adapters; sourceTree = ""; @@ -2162,7 +2156,6 @@ D29DF28C21E7AC2B003B2FB9 /* ViewConstrainingView.m in Sources */, 0AE14F64238315D2005417F8 /* TextField.swift in Sources */, D29DF17B21E69E1F003B2FB9 /* PrimaryButton.m in Sources */, - 279B1567242BBBF200921D6C /* LabelModelAdapter.swift in Sources */, D2C78CD224228BBD00B69FDE /* ActionOpenPanelModel.swift in Sources */, C695A68123C9830D00BFB94E /* NumberedListModel.swift in Sources */, 01EB3684236097C0006832FA /* MoleculeModelProtocol.swift in Sources */, @@ -2254,7 +2247,6 @@ 01509D932327ECFB00EF99AA /* ProgressBar.swift in Sources */, D260106523D0CEA700764D80 /* StackModel.swift in Sources */, D29770F521F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.m in Sources */, - 279B156D242BBFF100921D6C /* FooterModelAdapter.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift deleted file mode 100644 index 3672a21f..00000000 --- a/MVMCoreUI/Legacy/Adapters/FooterModelAdapter.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// FooterModelAdapter.swift -// MVMCoreUI -// -// Created by Kyle on 3/25/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -public extension FooterModel { - - convenience init(withPrimaryAction primaryMap: [AnyHashable: Any]? = nil, secondaryAction secondaryMap: [AnyHashable: Any]? = nil, bottomLinkAction linkMap: [AnyHashable: Any]? = nil) { - - var primaryButtonModel: ButtonModel? - var secondaryButtonModel: ButtonModel? - if let primaryActionModel = try? primaryMap?.asActionModel(), let title = primaryActionModel.title { - primaryButtonModel = ButtonModel(primaryButtonWith: title, action: primaryActionModel) - } - if let secondaryActionModel = try? secondaryMap?.asActionModel(), let title = secondaryActionModel.title { - secondaryButtonModel = ButtonModel(secondaryButtonWith: title, action: secondaryActionModel) - } - let twoButtonModel = TwoButtonViewModel(primaryButtonModel, secondaryButtonModel) - - let footerContentModel: MoleculeModelProtocol - if let linkActionJSON = linkMap { - let labelModel = LabelModel(linkAction: linkActionJSON) - if primaryButtonModel != nil || secondaryButtonModel != nil { - let moleculeStack = MoleculeStackModel(molecules: [MoleculeStackItemModel(with: twoButtonModel), MoleculeStackItemModel(with: labelModel)]) - moleculeStack.spacing = MFStyler.defaultVerticalPaddingForApplicationWidth() - footerContentModel = moleculeStack - } else { - footerContentModel = labelModel - } - } else { - footerContentModel = twoButtonModel - } - - self.init(with: footerContentModel) - } - -} diff --git a/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift deleted file mode 100644 index 6b94f63e..00000000 --- a/MVMCoreUI/Legacy/Adapters/LabelModelAdapter.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// LabelModelAdapter.swift -// MVMCoreUI -// -// Created by Kyle on 3/25/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -public extension LabelModel { - - convenience init(linkAction: [AnyHashable: Any]) { - // Concatentate the text. - let title = linkAction.stringForkey(KeyTitle) - var titlePrefix = linkAction.stringForkey(KeyTitlePrefix) - var titlePostfix = linkAction.stringForkey(KeyTitlePostfix) - if !titlePrefix.isEmpty && (!title.isEmpty || !titlePostfix.isEmpty) { - titlePrefix += " " - } - if !titlePostfix.isEmpty && !title.isEmpty { - titlePostfix = " " + titlePostfix - } - let text = "\(titlePrefix)\(title)\(titlePostfix)" - - // Initialize with text. - self.init(text: text) - - // Add action attribute. - if let linkActionModel = try? linkAction.asActionModel() { - attributes = [LabelAttributeActionModel(titlePrefix.isEmpty ? 0 : titlePrefix.count, title.count, action: linkActionModel)] - } - } - -}