move Footer and Label adapters to MF

This commit is contained in:
Kyle Matthew Hedden 2020-04-03 15:13:07 -04:00
parent eee0b65036
commit 74258f642d
3 changed files with 0 additions and 81 deletions

View File

@ -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 = "<group>"; };
0AE98BB423FF18D2004C5109 /* Arrow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Arrow.swift; sourceTree = "<group>"; };
0AE98BB623FF18E9004C5109 /* ArrowModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrowModel.swift; sourceTree = "<group>"; };
279B1566242BBBF200921D6C /* LabelModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelModelAdapter.swift; sourceTree = "<group>"; };
279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionModelAdapter.swift; sourceTree = "<group>"; };
279B156C242BBFF100921D6C /* FooterModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterModelAdapter.swift; sourceTree = "<group>"; };
31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxLabelModel.swift; sourceTree = "<group>"; };
31BE15CA23D8924C00452370 /* CheckboxModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxModel.swift; sourceTree = "<group>"; };
522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = "<group>"; };
@ -923,9 +919,7 @@
279B1565242BBB8500921D6C /* Adapters */ = {
isa = PBXGroup;
children = (
279B1566242BBBF200921D6C /* LabelModelAdapter.swift */,
279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */,
279B156C242BBFF100921D6C /* FooterModelAdapter.swift */,
);
path = Adapters;
sourceTree = "<group>";
@ -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;
};

View File

@ -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)
}
}

View File

@ -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)]
}
}
}