Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/ListLeftVar_Checkbox-_Right_Caret

# Conflicts:
#	MVMCoreUI.xcodeproj/project.pbxproj
#	MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift
This commit is contained in:
Subhankar Acharya 2020-02-20 14:52:57 +05:30
parent 576ce2ff56
commit 4803e20363
62 changed files with 609 additions and 83 deletions

View File

@ -27,6 +27,7 @@
012A88F123985E0100FE3DA1 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88F023985E0100FE3DA1 /* Color.swift */; }; 012A88F123985E0100FE3DA1 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88F023985E0100FE3DA1 /* Color.swift */; };
012CA99A2384A687003F810F /* MFTextField+ModelExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012CA9992384A687003F810F /* MFTextField+ModelExtension.swift */; }; 012CA99A2384A687003F810F /* MFTextField+ModelExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012CA9992384A687003F810F /* MFTextField+ModelExtension.swift */; };
012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */; }; 012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */; };
013F801923FB4A8E00AD8013 /* UIContentMode+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 013F801823FB4A8E00AD8013 /* UIContentMode+Extension.swift */; };
014AA72423C501E2006F3E93 /* MoleculeContainerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014AA72123C501E2006F3E93 /* MoleculeContainerModel.swift */; }; 014AA72423C501E2006F3E93 /* MoleculeContainerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014AA72123C501E2006F3E93 /* MoleculeContainerModel.swift */; };
014AA72523C501E2006F3E93 /* ContainerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014AA72223C501E2006F3E93 /* ContainerModel.swift */; }; 014AA72523C501E2006F3E93 /* ContainerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014AA72223C501E2006F3E93 /* ContainerModel.swift */; };
014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014AA72323C501E2006F3E93 /* ContainerModelProtocol.swift */; }; 014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014AA72323C501E2006F3E93 /* ContainerModelProtocol.swift */; };
@ -127,8 +128,8 @@
94F217B723E0BF6100A47C06 /* PrimaryButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */; }; 94F217B723E0BF6100A47C06 /* PrimaryButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */; };
94FB966223D797DA003D482B /* MFTextButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 94FB966023D797DA003D482B /* MFTextButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 94FB966223D797DA003D482B /* MFTextButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 94FB966023D797DA003D482B /* MFTextButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; }; 94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; };
AA29DC9B23F2AA3800A52198 /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA29DC9A23F2AA3800A52198 /* ListLeftVariableCheckboxAllTextAndLinks.swift */; }; AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */; };
AA29DC9D23F2ACAC00A52198 /* ListLeftVariableCheckboxAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA29DC9C23F2ACAC00A52198 /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */; }; AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */; };
C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; }; C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; };
C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; }; C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; };
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; }; C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; };
@ -361,6 +362,7 @@
012A88F023985E0100FE3DA1 /* Color.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; }; 012A88F023985E0100FE3DA1 /* Color.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; };
012CA9992384A687003F810F /* MFTextField+ModelExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFTextField+ModelExtension.swift"; sourceTree = "<group>"; }; 012CA9992384A687003F810F /* MFTextField+ModelExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFTextField+ModelExtension.swift"; sourceTree = "<group>"; };
012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFView+ModelExtension.swift"; sourceTree = "<group>"; }; 012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFView+ModelExtension.swift"; sourceTree = "<group>"; };
013F801823FB4A8E00AD8013 /* UIContentMode+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIContentMode+Extension.swift"; sourceTree = "<group>"; };
014AA72123C501E2006F3E93 /* MoleculeContainerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoleculeContainerModel.swift; sourceTree = "<group>"; }; 014AA72123C501E2006F3E93 /* MoleculeContainerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoleculeContainerModel.swift; sourceTree = "<group>"; };
014AA72223C501E2006F3E93 /* ContainerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContainerModel.swift; sourceTree = "<group>"; }; 014AA72223C501E2006F3E93 /* ContainerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContainerModel.swift; sourceTree = "<group>"; };
014AA72323C501E2006F3E93 /* ContainerModelProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContainerModelProtocol.swift; sourceTree = "<group>"; }; 014AA72323C501E2006F3E93 /* ContainerModelProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContainerModelProtocol.swift; sourceTree = "<group>"; };
@ -451,8 +453,8 @@
94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PrimaryButtonView.m; sourceTree = "<group>"; }; 94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PrimaryButtonView.m; sourceTree = "<group>"; };
94FB966023D797DA003D482B /* MFTextButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFTextButton.h; sourceTree = "<group>"; }; 94FB966023D797DA003D482B /* MFTextButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFTextButton.h; sourceTree = "<group>"; };
94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = "<group>"; }; 94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = "<group>"; };
AA29DC9A23F2AA3800A52198 /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = "<group>"; }; AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePayments.swift; sourceTree = "<group>"; };
AA29DC9C23F2ACAC00A52198 /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinksModel.swift; sourceTree = "<group>"; }; AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePaymentsModel.swift; sourceTree = "<group>"; };
C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; }; C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; };
C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = "<group>"; }; C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = "<group>"; };
C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = "<group>"; }; C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = "<group>"; };
@ -784,6 +786,15 @@
name = "Recovered References"; name = "Recovered References";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
AA4FC2A323F4F69600E251DB /* RightVariable */ = {
isa = PBXGroup;
children = (
AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */,
AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */,
);
path = RightVariable;
sourceTree = "<group>";
};
D213347423842FE3008E41B3 /* Controllers */ = { D213347423842FE3008E41B3 /* Controllers */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -965,6 +976,7 @@
D22B38EA23F4E08B00490EF6 /* List */ = { D22B38EA23F4E08B00490EF6 /* List */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
AA4FC2A323F4F69600E251DB /* RightVariable */,
D22B38EB23F4E0AE00490EF6 /* LeftVariable */, D22B38EB23F4E0AE00490EF6 /* LeftVariable */,
); );
path = List; path = List;
@ -975,8 +987,6 @@
children = ( children = (
8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */, 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */,
8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */, 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */,
AA29DC9A23F2AA3800A52198 /* ListLeftVariableCheckboxAllTextAndLinks.swift */,
AA29DC9C23F2ACAC00A52198 /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */,
); );
path = LeftVariable; path = LeftVariable;
sourceTree = "<group>"; sourceTree = "<group>";
@ -1148,6 +1158,7 @@
D29DF11021E6805F003B2FB9 /* Categories */ = { D29DF11021E6805F003B2FB9 /* Categories */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
013F801823FB4A8E00AD8013 /* UIContentMode+Extension.swift */,
D29DF11121E6805F003B2FB9 /* UIColor+MFConvenience.h */, D29DF11121E6805F003B2FB9 /* UIColor+MFConvenience.h */,
D29DF11321E6805F003B2FB9 /* UIColor+MFConvenience.m */, D29DF11321E6805F003B2FB9 /* UIColor+MFConvenience.m */,
D29DF11221E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.h */, D29DF11221E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.h */,
@ -1619,6 +1630,7 @@
DBC4391922442197001AB423 /* DashLine.swift in Sources */, DBC4391922442197001AB423 /* DashLine.swift in Sources */,
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */, 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */,
D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */, D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */,
AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */,
D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */, D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */,
0116A4E5228B19640094F3ED /* RadioButtonModel.swift in Sources */, 0116A4E5228B19640094F3ED /* RadioButtonModel.swift in Sources */,
017BEB48236230DB0024EF95 /* MoleculeViewProtocol.swift in Sources */, 017BEB48236230DB0024EF95 /* MoleculeViewProtocol.swift in Sources */,
@ -1645,7 +1657,6 @@
01C851D323CF9E740021F976 /* LabelToggleModel.swift in Sources */, 01C851D323CF9E740021F976 /* LabelToggleModel.swift in Sources */,
D29DF2C521E7BF57003B2FB9 /* MFTabBarSwipeAnimator.m in Sources */, D29DF2C521E7BF57003B2FB9 /* MFTabBarSwipeAnimator.m in Sources */,
D2E2A98323D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift in Sources */, D2E2A98323D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift in Sources */,
AA29DC9D23F2ACAC00A52198 /* ListLeftVariableCheckboxAllTextAndLinksModel.swift in Sources */,
012A88AD238C418100FE3DA1 /* TemplateProtocol.swift in Sources */, 012A88AD238C418100FE3DA1 /* TemplateProtocol.swift in Sources */,
D29DF2B421E7B76D003B2FB9 /* MFLoadingSpinner.m in Sources */, D29DF2B421E7B76D003B2FB9 /* MFLoadingSpinner.m in Sources */,
D260106323D0C05000764D80 /* StackItemModel.swift in Sources */, D260106323D0C05000764D80 /* StackItemModel.swift in Sources */,
@ -1681,6 +1692,7 @@
D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */, D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */,
0A21DB85235E06EF00C160A2 /* MFTextField.m in Sources */, 0A21DB85235E06EF00C160A2 /* MFTextField.m in Sources */,
014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */, 014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */,
AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */,
01EB369223609801006832FA /* MoleculeStackModel.swift in Sources */, 01EB369223609801006832FA /* MoleculeStackModel.swift in Sources */,
012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */, 012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */,
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */, D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
@ -1792,7 +1804,6 @@
D28A839323CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift in Sources */, D28A839323CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift in Sources */,
D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */, D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */,
D260105F23D0BFFC00764D80 /* StackItem.swift in Sources */, D260105F23D0BFFC00764D80 /* StackItem.swift in Sources */,
AA29DC9B23F2AA3800A52198 /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */,
9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */, 9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */,
01EB369323609801006832FA /* HeaderModel.swift in Sources */, 01EB369323609801006832FA /* HeaderModel.swift in Sources */,
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */, D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */,
@ -1809,6 +1820,7 @@
943784F6236B77BB006A1E82 /* GraphViewAnimationHandler.swift in Sources */, 943784F6236B77BB006A1E82 /* GraphViewAnimationHandler.swift in Sources */,
D29DF2AA21E7B2F9003B2FB9 /* MVMCoreUIConstants.m in Sources */, D29DF2AA21E7B2F9003B2FB9 /* MVMCoreUIConstants.m in Sources */,
948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */, 948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */,
013F801923FB4A8E00AD8013 /* UIContentMode+Extension.swift in Sources */,
D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */, D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */,
D2E2A9A323E096B1000B42E6 /* DisableableModelProtocol.swift in Sources */, D2E2A9A323E096B1000B42E6 /* DisableableModelProtocol.swift in Sources */,
D29DF11821E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.m in Sources */, D29DF11821E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.m in Sources */,

View File

@ -20,7 +20,6 @@ public enum ButtonSize: String, Codable {
public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol { public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol {
public static var identifier: String = "button" public static var identifier: String = "button"
public var moleculeName: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var title: String public var title: String
public var action: ActionModelProtocol public var action: ActionModelProtocol
@ -46,6 +45,12 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol {
self.action = action self.action = action
style = .secondary style = .secondary
} }
init(primaryButtonWith title: String, action: ActionModelProtocol) {
self.title = title
self.action = action
style = .primary
}
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName case moleculeName
@ -67,7 +72,6 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol {
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
title = try typeContainer.decode(String.self, forKey: .title) title = try typeContainer.decode(String.self, forKey: .title)

View File

@ -30,6 +30,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol {
case enabledColor case enabledColor
case disabledColor case disabledColor
case enabled case enabled
case moleculeName
} }
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
@ -50,6 +51,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol {
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(title, forKey: .title) try container.encode(title, forKey: .title)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeModel(action, forKey: .action) try container.encodeModel(action, forKey: .action)

View File

@ -36,6 +36,10 @@ import UIKit
context?.strokePath() context?.strokePath()
} }
//--------------------------------------------------
// MARK: - ModelMoleculeViewProtocol
//--------------------------------------------------
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.setWithModel(model, delegateObject, additionalData) super.setWithModel(model, delegateObject, additionalData)
guard let model = model as? LinkModel else { return } guard let model = model as? LinkModel else { return }

View File

@ -9,7 +9,12 @@
import UIKit import UIKit
public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol { public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "link" public static var identifier: String = "link"
public var backgroundColor: Color? public var backgroundColor: Color?
public var title: String public var title: String
public var action: ActionModelProtocol public var action: ActionModelProtocol
@ -17,12 +22,21 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
public var textColor = Color(uiColor: .mvmBlack) public var textColor = Color(uiColor: .mvmBlack)
public var disabledColor = Color(uiColor: .mvmCoolGray6) public var disabledColor = Color(uiColor: .mvmCoolGray6)
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(title: String, action: ActionModelProtocol) { public init(title: String, action: ActionModelProtocol) {
self.title = title self.title = title
self.action = action self.action = action
} }
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName
case backgroundColor case backgroundColor
case title case title
case action case action
@ -31,11 +45,16 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
case disabledColor case disabledColor
} }
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
title = try typeContainer.decode(String.self, forKey: .title) title = try typeContainer.decode(String.self, forKey: .title)
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
self.enabled = enabled self.enabled = enabled
} }
@ -51,6 +70,7 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(title, forKey: .title) try container.encode(title, forKey: .title)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeModel(action, forKey: .action) try container.encodeModel(action, forKey: .action)
try container.encode(enabled, forKey: .enabled) try container.encode(enabled, forKey: .enabled)

View File

@ -37,9 +37,9 @@
} }
public override func encode(to encoder: Encoder) throws { public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
try super.encode(to: encoder) try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(caretView, forKey: .caretView) try container.encode(caretView, forKey: .caretView)
} }
} }

View File

@ -19,7 +19,6 @@ import Foundation
} }
public var backgroundColor: Color? public var backgroundColor: Color?
public var moleculeName: String?
public var title: String? public var title: String?
public var feedback: String? public var feedback: String?
public var errorMessage: String = "" public var errorMessage: String = ""
@ -37,7 +36,7 @@ import Foundation
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName case moleculeName
case backgroundColor case backgroundColor
case title case title = "label"
case isEnabled case isEnabled
case feedback case feedback
case errorMessage = "errorMsg" case errorMessage = "errorMsg"
@ -54,7 +53,6 @@ import Foundation
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title) title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
feedback = try typeContainer.decodeIfPresent(String.self, forKey: .feedback) feedback = try typeContainer.decodeIfPresent(String.self, forKey: .feedback)

View File

@ -12,7 +12,7 @@ import UIKit
public static var identifier: String = "textField" public static var identifier: String = "textField"
public var backgroundColor: Color? public var backgroundColor: Color?
public var moleculeName: String public var moleculeName: String? = TextFieldModel.identifier
public var editable: Bool? public var editable: Bool?
public var disabled: Bool? public var disabled: Bool?
public var errorMsg: String? public var errorMsg: String?

View File

@ -18,6 +18,7 @@ import Foundation
public var lineWidth: CGFloat? public var lineWidth: CGFloat?
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName
case backgroundColor case backgroundColor
case strokeColor case strokeColor
case isHidden case isHidden
@ -38,6 +39,7 @@ import Foundation
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(strokeColor, forKey: .strokeColor) try container.encode(strokeColor, forKey: .strokeColor)
try container.encodeIfPresent(isHidden, forKey: .isHidden) try container.encodeIfPresent(isHidden, forKey: .isHidden)
try container.encodeIfPresent(isOpaque, forKey: .isOpaque) try container.encodeIfPresent(isOpaque, forKey: .isOpaque)

View File

@ -39,6 +39,7 @@ import Foundation
//-------------------------------------------------- //--------------------------------------------------
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName
case groupName case groupName
case value case value
case fieldKey case fieldKey
@ -85,6 +86,7 @@ import Foundation
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(groupName, forKey: .groupName) try container.encodeIfPresent(groupName, forKey: .groupName)
try container.encodeIfPresent(value, forKey: .value) try container.encodeIfPresent(value, forKey: .value)
try container.encodeIfPresent(fieldKey, forKey: .fieldKey) try container.encodeIfPresent(fieldKey, forKey: .fieldKey)

View File

@ -48,6 +48,7 @@ public class CircleProgressModel: MoleculeModelProtocol {
case duration case duration
case colors case colors
case backgroundColor case backgroundColor
case moleculeName
} }
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
@ -78,6 +79,7 @@ public class CircleProgressModel: MoleculeModelProtocol {
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(style, forKey: .style) try container.encode(style, forKey: .style)
try container.encode(size, forKey: .size) try container.encode(size, forKey: .size)
try container.encode(diameter, forKey: .diameter) try container.encode(diameter, forKey: .diameter)

View File

@ -20,6 +20,7 @@ import Foundation
} }
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName
case backgroundColor case backgroundColor
case dashColor case dashColor
case isHidden case isHidden
@ -36,6 +37,7 @@ import Foundation
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(dashColor, forKey: .dashColor) try container.encode(dashColor, forKey: .dashColor)
try container.encodeIfPresent(isHidden, forKey: .isHidden) try container.encodeIfPresent(isHidden, forKey: .isHidden)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)

View File

@ -11,11 +11,29 @@ import Foundation
@objcMembers public class ImageViewModel: MoleculeModelProtocol { @objcMembers public class ImageViewModel: MoleculeModelProtocol {
public static var identifier: String = "image" public static var identifier: String = "image"
public var backgroundColor: Color? public var backgroundColor: Color?
public var moleculeName: String? = ImageViewModel.identifier
public var image: String public var image: String
public var accessibilityText: String? public var accessibilityText: String?
public var fallbackImage: String? public var fallbackImage: String?
public var imageFormat: String? public var imageFormat: String?
public var width: CGFloat? public var width: CGFloat?
public var height: CGFloat? public var height: CGFloat?
public var contentMode: UIView.ContentMode?
public var localBundle: Bundle?
public init(image: String) {
self.image = image
}
private enum CodingKeys: String, CodingKey {
case moleculeName
case backgroundColor
case image
case accessibilityText
case fallbackImage
case imageFormat
case width
case height
case contentMode
}
} }

View File

@ -8,12 +8,21 @@
import UIKit import UIKit
class LabelAttributeActionModel: LabelAttributeModel { open class LabelAttributeActionModel: LabelAttributeModel {
override public class var identifier: String { override public class var identifier: String {
return "action" return "action"
} }
var action: ActionModelProtocol var action: ActionModelProtocol
public init(_ location: Int, _ length: Int, action: ActionModelProtocol) {
self.action = action
super.init(location, length)
}
private enum CodingKeys: String, CodingKey {
case action
}
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
@ -25,8 +34,4 @@ class LabelAttributeActionModel: LabelAttributeModel {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeModel(action, forKey: .action) try container.encodeModel(action, forKey: .action)
} }
private enum CodingKeys: String, CodingKey {
case action
}
} }

View File

@ -25,10 +25,18 @@ import Foundation
return "" return ""
} }
var type: String var type: String {
get { return Self.identifier }
}
var location: Int var location: Int
var length: Int var length: Int
init(_ location: Int, _ length: Int) {
self.location = location
self.length = length
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Keys // MARK: - Keys
//-------------------------------------------------- //--------------------------------------------------
@ -45,7 +53,6 @@ import Foundation
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
type = try typeContainer.decode(String.self, forKey: .type)
location = try typeContainer.decode(Int.self, forKey: .location) location = try typeContainer.decode(Int.self, forKey: .location)
length = try typeContainer.decode(Int.self, forKey: .length) length = try typeContainer.decode(Int.self, forKey: .length)
} }

View File

@ -11,9 +11,7 @@ import Foundation
@objcMembers public class LabelModel: MoleculeModelProtocol { @objcMembers public class LabelModel: MoleculeModelProtocol {
public static var identifier: String = "label" public static var identifier: String = "label"
public var moleculeName: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var text: String public var text: String
public var accessibilityText: String? public var accessibilityText: String?
public var textColor: String? public var textColor: String?
@ -45,10 +43,13 @@ import Foundation
enum AttributeTypeKey: String, CodingKey { enum AttributeTypeKey: String, CodingKey {
case type case type
} }
public init(text: String) {
self.text = text
}
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
text = try typeContainer.decode(String.self, forKey: .text) text = try typeContainer.decode(String.self, forKey: .text)
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
textColor = try typeContainer.decodeIfPresent(String.self, forKey: .textColor) textColor = try typeContainer.decodeIfPresent(String.self, forKey: .textColor)

View File

@ -10,7 +10,12 @@ import UIKit
@objcMembers public class LeftRightLabelModel: MoleculeModelProtocol { @objcMembers public class LeftRightLabelModel: MoleculeModelProtocol {
public static var identifier: String = "leftRightLabelView" public static var identifier: String = "leftRightLabelView"
public var moleculeName: String? = LeftRightLabelModel.identifier
public var backgroundColor: Color? public var backgroundColor: Color?
public var leftText: LabelModel public var leftText: LabelModel
public var rightText: LabelModel? public var rightText: LabelModel?
init(_ leftText: LabelModel) {
self.leftText = leftText
}
} }

View File

@ -210,6 +210,9 @@ import UIKit
} }
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
self.delegateObject = delegateObject
// TODO: Temporary, should be moved to init once we have type erasure ready.
setAsMolecule()
guard let imageModel = model as? ImageViewModel else { guard let imageModel = model as? ImageViewModel else {
return return
} }
@ -230,7 +233,11 @@ import UIKit
if shouldLoadImage(withName: imageModel.image, width: width, height: height) { if shouldLoadImage(withName: imageModel.image, width: width, height: height) {
imageView.image = nil imageView.image = nil
imageView.animatedImage = nil imageView.animatedImage = nil
loadImage(withName: imageModel.image, format: imageModel.imageFormat, width: width as NSNumber?, height: height as NSNumber?, customFallbackImage: imageModel.fallbackImage) loadImage(withName: imageModel.image, format: imageModel.imageFormat, width: width as NSNumber?, height: height as NSNumber?, customFallbackImage: imageModel.fallbackImage, localBundle: imageModel.localBundle)
}
if let contentMode = imageModel.contentMode {
imageView.contentMode = contentMode
} }
} }
@ -269,7 +276,9 @@ import UIKit
} }
// MARK: - load functions // MARK: - load functions
public func loadImage(withName imageName: String?, format: String?, width: NSNumber?, height: NSNumber?, customFallbackImage: String?, completionHandler: @escaping MVMCoreGetImageBlock) { public func loadImage(withName imageName: String?, format: String? = nil, width: NSNumber? = nil, height: NSNumber? = nil, customFallbackImage: String? = nil, allowServerParameters: Bool = false, localBundle: Bundle? = nil, completionHandler: MVMCoreGetImageBlock? = nil) {
let completionBlock = completionHandler ?? defaultCompletionBlock()
MVMCoreDispatchUtility.performBlock(onMainThread: { [unowned self] in MVMCoreDispatchUtility.performBlock(onMainThread: { [unowned self] in
self.currentImageName = imageName self.currentImageName = imageName
self.currentImageWidth = width?.cgfloat() self.currentImageWidth = width?.cgfloat()
@ -291,15 +300,15 @@ import UIKit
if layoutWillChange { if layoutWillChange {
self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self!) self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self!)
} }
completionHandler(image,data,isFallbackImage) completionBlock(image,data,isFallbackImage)
})} })}
let fallbackImageName = customFallbackImage ?? MVMCoreUIUtility.localizedImageName("fallback") let fallbackImageName = customFallbackImage ?? MVMCoreUIUtility.localizedImageName("fallback")
if let format = format, format.lowercased().contains("gif") { if let format = format, format.lowercased().contains("gif") {
// Gifs aren't supported by default and need special handling // Gifs aren't supported by default and need special handling
MVMCoreCache.shared()?.getGif(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, completionHandler: finishedLoadingBlock) MVMCoreCache.shared()?.getGif(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, allowServerQueryParameters: allowServerParameters, completionHandler: finishedLoadingBlock)
} else { } else {
MVMCoreCache.shared()?.getImage(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, completionHandler: finishedLoadingBlock) MVMCoreCache.shared()?.getImage(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, allowServerQueryParameters: allowServerParameters, localBundle: localBundle, completionHandler: finishedLoadingBlock)
} }
}) })
} }
@ -329,6 +338,8 @@ import UIKit
}) })
} }
// Note: Exposed for objective-c interfaces.
public func loadImage(withName imageName: String?) { public func loadImage(withName imageName: String?) {
loadImage(withName: imageName, format: nil, width: nil, height: nil, customFallbackImage: nil, completionHandler: defaultCompletionBlock()) loadImage(withName: imageName, format: nil, width: nil, height: nil, customFallbackImage: nil, completionHandler: defaultCompletionBlock())
} }
@ -364,4 +375,8 @@ import UIKit
public func loadImage(withName imageName: String?, format: String?, width: NSNumber?, height: NSNumber?, customFallbackImage: String?) { public func loadImage(withName imageName: String?, format: String?, width: NSNumber?, height: NSNumber?, customFallbackImage: String?) {
loadImage(withName: imageName, format: format, width: width, height: height, customFallbackImage: customFallbackImage, completionHandler: defaultCompletionBlock()) loadImage(withName: imageName, format: format, width: width, height: height, customFallbackImage: customFallbackImage, completionHandler: defaultCompletionBlock())
} }
public func loadImage(withName imageName: String?, format: String?, width: NSNumber?, height: NSNumber?, customFallbackImage: String?, completionHandler: @escaping MVMCoreGetImageBlock) {
loadImage(withName: imageName, format: format, width: width, height: height, customFallbackImage: customFallbackImage, allowServerParameters: false, completionHandler: completionHandler)
}
} }

View File

@ -26,6 +26,7 @@ import Foundation
public var roundedRect: Bool? public var roundedRect: Bool?
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName
case progressList case progressList
case thickness case thickness
case roundedRect case roundedRect
@ -46,6 +47,7 @@ import Foundation
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(progressList, forKey: .progressList) try container.encode(progressList, forKey: .progressList)
try container.encodeIfPresent(thickness, forKey: .thickness) try container.encodeIfPresent(thickness, forKey: .thickness)
try container.encodeIfPresent(roundedRect, forKey: .roundedRect) try container.encodeIfPresent(roundedRect, forKey: .roundedRect)

View File

@ -10,7 +10,6 @@ import UIKit
public class ToggleModel: MoleculeModelProtocol { public class ToggleModel: MoleculeModelProtocol {
public static var identifier: String = "toggle" public static var identifier: String = "toggle"
public var moleculeName: String?
public var backgroundColor: Color? public var backgroundColor: Color?
public var state: Bool = true public var state: Bool = true
public var action: ActionModelProtocol? public var action: ActionModelProtocol?

View File

@ -12,6 +12,7 @@ public typealias ButtonAction = (Button) -> ()
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
open var model: MoleculeModelProtocol? open var model: MoleculeModelProtocol?
open var actionModel: ActionModelProtocol? open var actionModel: ActionModelProtocol?
@ -67,7 +68,7 @@ public typealias ButtonAction = (Button) -> ()
addTarget(self, action: #selector(callActionBlock(_:)), for: event) addTarget(self, action: #selector(callActionBlock(_:)), for: event)
} }
@objc private func callActionBlock(_ sender: Button) { @objc func callActionBlock(_ sender: Button) {
buttonAction?(self) buttonAction?(self)
} }
@ -88,11 +89,13 @@ public typealias ButtonAction = (Button) -> ()
// MARK:- ModelMoleculeViewProtocol // MARK:- ModelMoleculeViewProtocol
open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
self.model = model self.model = model
if let backgroundColor = model?.backgroundColor { if let backgroundColor = model?.backgroundColor {
self.backgroundColor = backgroundColor.uiColor self.backgroundColor = backgroundColor.uiColor
} }
guard let model = model as? ButtonModelProtocol else { return } guard let model = model as? ButtonModelProtocol else { return }
isEnabled = model.enabled isEnabled = model.enabled
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData) set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
} }
@ -113,7 +116,7 @@ public typealias ButtonAction = (Button) -> ()
// MARK: - MVMCoreViewProtocol // MARK: - MVMCoreViewProtocol
extension Button: MVMCoreViewProtocol { extension Button: MVMCoreViewProtocol {
open func updateView(_ size: CGFloat) {} open func updateView(_ size: CGFloat) { }
/// Will be called only once. /// Will be called only once.
open func setupView() { open func setupView() {
@ -126,6 +129,7 @@ extension Button: MVMCoreViewProtocol {
// MARK: - MVMCoreUIMoleculeViewProtocol // MARK: - MVMCoreUIMoleculeViewProtocol
extension Button: MVMCoreUIMoleculeViewProtocol { extension Button: MVMCoreUIMoleculeViewProtocol {
open func reset() { open func reset() {
backgroundColor = .clear backgroundColor = .clear
} }
@ -133,6 +137,7 @@ extension Button: MVMCoreUIMoleculeViewProtocol {
// MARK: AppleGuidelinesProtocol // MARK: AppleGuidelinesProtocol
extension Button: AppleGuidelinesProtocol { extension Button: AppleGuidelinesProtocol {
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool { override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
return Self.acceptablyOutsideBounds(point: point, bounds: bounds) return Self.acceptablyOutsideBounds(point: point, bounds: bounds)
} }

View File

@ -37,7 +37,3 @@ extension MFViewController: MoleculeDelegateProtocol {
@objc public func removeMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) { } @objc public func removeMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) { }
} }
public extension MFViewController {
@objc func parsePageJSON() throws { }
}

View File

@ -96,6 +96,9 @@
// This view controller should subclass this function and check the load to make sure it has all the needed data. Fills the error object if there are any errors. Returns if we should finish the load or not. // This view controller should subclass this function and check the load to make sure it has all the needed data. Fills the error object if there are any errors. Returns if we should finish the load or not.
- (BOOL)shouldFinishProcessingLoad:(nonnull MVMCoreLoadObject *)loadObject error:(MVMCoreErrorObject *_Nonnull *_Nonnull)error; - (BOOL)shouldFinishProcessingLoad:(nonnull MVMCoreLoadObject *)loadObject error:(MVMCoreErrorObject *_Nonnull *_Nonnull)error;
/// Called in newDataBuildScreen. Can override to parse the json into a model object.
- (void)parsePageJSON:(NSError * _Nullable * _Nullable)error;
// Sets the screen to use the screen heading. // Sets the screen to use the screen heading.
// it is required in device flow, where we are showing greeting name as screen heading, // it is required in device flow, where we are showing greeting name as screen heading,
// device details screen heading needs to be updated/refreshed again, if user has changed device nick name // device details screen heading needs to be updated/refreshed again, if user has changed device nick name

View File

@ -98,7 +98,7 @@
self.loadObject = loadObject; self.loadObject = loadObject;
NSError *parseError = nil; NSError *parseError = nil;
[self parsePageJSONAndReturnError:&parseError]; [self parsePageJSON:&parseError];
if (parseError) { if (parseError) {
if (error) { if (error) {
MVMCoreErrorObject *errorObject = [MVMCoreErrorObject createErrorObjectForNSError:parseError location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]]; MVMCoreErrorObject *errorObject = [MVMCoreErrorObject createErrorObjectForNSError:parseError location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
@ -112,6 +112,10 @@
return [MFViewController verifyRequiredModulesLoadedForLoadObject:loadObject error:error]; return [MFViewController verifyRequiredModulesLoadedForLoadObject:loadObject error:error];
} }
- (void)parsePageJSON:(NSError * _Nullable * _Nullable)error {
}
// Sets the screen to use the screen heading. // Sets the screen to use the screen heading.
// it is required in device flow, where we are showing greeting name as screen heading, // it is required in device flow, where we are showing greeting name as screen heading,
// device details screen heading needs to be updated/refreshed again, if user has changed device nick name // device details screen heading needs to be updated/refreshed again, if user has changed device nick name
@ -261,7 +265,7 @@
- (BOOL)newPageLoaded:(nonnull NSDictionary *)page { - (BOOL)newPageLoaded:(nonnull NSDictionary *)page {
self.loadObject.pageJSON = page; self.loadObject.pageJSON = page;
NSError *parseError = nil; NSError *parseError = nil;
[self parsePageJSONAndReturnError:&parseError]; [self parsePageJSON:&parseError];
return YES; return YES;
} }

View File

@ -12,24 +12,52 @@ public typealias ColorHexTuple = (uiColor: UIColor, hex: String)
extension UIColor { extension UIColor {
//--------------------------------------------------
// MARK: - Convenience Dictionary
//--------------------------------------------------
/// Dictionary to access brand approved colors by name. /// Dictionary to access brand approved colors by name.
public static let names: [String: ColorHexTuple] = ["black": (.mvmBlack, "#000000"), public static let names: [String: ColorHexTuple] = ["black": (.mvmBlack, "#000000"),
"white": (.mvmWhite, "#FFFFFF"), "white": (.mvmWhite, "#FFFFFF"),
"red": (.mvmRed, "#D52B1E"), "red": (.mvmRed, "#D52B1E"),
"orange": (.mvmOrange, "#CC4D0F"), "pink": (.mvmPink, "#D90368"),
"green": (.mvmGreen, "#008631"), "pink33": (.mvmPink33, "#F2ABCD"),
"blue": (.mvmBlue, "#007AB8"), "pink66": (.mvmPink66, "#E6589B"),
"blueGradient": (.mvmBlueGradient, "#007AB8"), "pinkShade1": (.mvmPinkShade1, "#B31C63"),
"pinkShade2": (.mvmPinkShade2, "#830842"),
"purple": (.mvmPurple, "#8C00AC"),
"purple33": (.mvmPurple33, "#D9ABE4"),
"purple66": (.mvmPurple66, "#B356C8"),
"purpleShade1": (.mvmPurpleShade1, "#6C177F"),
"purpleShade2": (.mvmPurpleShade2, "#4A0E58"),
"green": (.mvmGreen, "#008330"),
"green33": (.mvmGreen33, "#ABE4BF"),
"green66": (.mvmGreen66, "#57C880"),
"greenShade1": (.mvmGreenShade1, "#178437"),
"greenShade2": (.mvmGreenShade2, "#0F5B25"),
"orange": (.mvmOrange, "#ED7000"),
"orange66": (.mvmOrange66, "#F3A157"),
"orange33": (.mvmOrange33, "#F9D0AB"),
"orangeShade1": (.mvmOrangeShade1, "#CB5F00"),
"orangeShade2": (.mvmOrangeShade2, "#984700"),
"orangeAA": (.mvmOrangeAA, "#CC4D0F"),
"blue": (.mvmBlue, "#0077B4"),
"blue33": (.mvmBlue33, "#57B1DF"),
"blue66": (.mvmBlue66, "#57B1DF"),
"blueShade1": (.mvmBlueShade1, "#136598"),
"blueShade2": (.mvmBlueShade2, "#0B4467"),
"yellow": (.mvmYellow, "#FFBC3D"), "yellow": (.mvmYellow, "#FFBC3D"),
"yellow33": (.mvmYellow33, "#FFE9BF"),
"yellow66": (.mvmYellow66, "#FFD37F"),
"yellowShade1": (.mvmYellowShade1, "#CC9630"),
"yellowShade2": (.mvmYellowShade2, "#997126"),
"coolGray1": (.mvmCoolGray1, "#F6F6F6"), "coolGray1": (.mvmCoolGray1, "#F6F6F6"),
"coolGray3": (.mvmCoolGray3, "#D8DADA"), "coolGray3": (.mvmCoolGray3, "#D8DADA"),
"coolGray6": (.mvmCoolGray6, "#747676"), "coolGray6": (.mvmCoolGray6, "#747676"),
"coolGray10": (.mvmCoolGray10, "#333333"), "coolGray10": (.mvmCoolGray10, "#333333"),
"vzupGold": (.vzupGold, "#B89B56"), "upGold1": (.vzupGold1, "#F9D542"),
"vzupYellow1": (.vzupYellow1, "#F9D542"), "upGold2": (.vzupGold2, "#F4CA53"),
"vzupYellow2": (.vzupYellow2, "#F4CA53"), "upGold3": (.vzupGold3, "#CC9B2D")]
"vzupYellow3": (.vzupYellow3, "#CC9B2D")]
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Brand // MARK: - Brand
@ -41,24 +69,134 @@ extension UIColor {
/// HEX: #FFFFFF /// HEX: #FFFFFF
public static let mvmWhite = UIColor.white public static let mvmWhite = UIColor.white
//--------------------------------------------------
// MARK: - Red
//--------------------------------------------------
/// HEX: #D52B1E /// HEX: #D52B1E
public static let mvmRed = UIColor.color8Bits(red: 213, green: 43, blue: 30) public static let mvmRed = UIColor.color8Bits(red: 213, green: 43, blue: 30)
//--------------------------------------------------
// MARK: - Pink
//--------------------------------------------------
/// HEX: #D90368
public static let mvmPink = UIColor.color8Bits(red: 217, green: 3, blue: 104)
/// HEX: #F2ABCD
public static let mvmPink33 = UIColor.color8Bits(red: 242, green: 171, blue: 205)
/// HEX: #E6589B
public static let mvmPink66 = UIColor.color8Bits(red: 230, green: 88, blue: 155)
/// HEX: #B31C63
public static let mvmPinkShade1 = UIColor.color8Bits(red: 179, green: 28, blue: 99)
/// HEX: #830842
public static let mvmPinkShade2 = UIColor.color8Bits(red: 131, green: 8, blue: 66)
//--------------------------------------------------
// MARK: - Purple
//--------------------------------------------------
/// HEX: #8C00AC
public static let mvmPurple = UIColor.color8Bits(red: 140, green: 0, blue: 172)
/// HEX: #D9ABE4
public static let mvmPurple33 = UIColor.color8Bits(red: 217, green: 171, blue: 228)
/// HEX: #B356C8
public static let mvmPurple66 = UIColor.color8Bits(red: 179, green: 86, blue: 200)
/// HEX: #6C177F
public static let mvmPurpleShade1 = UIColor.color8Bits(red: 108, green: 23, blue: 127)
/// HEX: #4A0E58
public static let mvmPurpleShade2 = UIColor.color8Bits(red: 74, green: 14, blue: 88)
//--------------------------------------------------
// MARK: - Orange
//--------------------------------------------------
/// HEX: #ED7000
public static let mvmOrange = UIColor.color8Bits(red: 237, green: 112, blue: 0)
/// HEX: #CC4D0F /// HEX: #CC4D0F
public static let mvmOrange = UIColor.color8Bits(red: 204, green: 77, blue: 15) public static let mvmOrangeAA = UIColor.color8Bits(red: 204, green: 77, blue: 15)
/// HEX: #008631 /// HEX: #F9D0AB
public static let mvmGreen = UIColor.color8Bits(red: 0, green: 134, blue: 49) public static let mvmOrange33 = UIColor.color8Bits(red: 249, green: 208, blue: 171)
/// HEX: #007AB8 /// HEX: #F3A157
public static let mvmBlue = UIColor.color8Bits(red: 0, green: 122, blue: 184) public static let mvmOrange66 = UIColor.color8Bits(red: 243, green: 161, blue: 87)
/// HEX: #007AB8 /// HEX: #CB5F00
public static let mvmBlueGradient = UIColor.color8Bits(red: 0, green: 122, blue: 184) public static let mvmOrangeShade1 = UIColor.color8Bits(red: 203, green: 95, blue: 0)
/// HEX: #984700
public static let mvmOrangeShade2 = UIColor.color8Bits(red: 152, green: 71, blue: 0)
//--------------------------------------------------
// MARK: - Green
//--------------------------------------------------
/// HEX: #008330
public static let mvmGreen = UIColor.color8Bits(red: 0, green: 134, blue: 48)
/// HEX: #ABE4BF
public static let mvmGreen33 = UIColor.color8Bits(red: 171, green: 228, blue: 191)
/// HEX: #57C880
public static let mvmGreen66 = UIColor.color8Bits(red: 87, green: 200, blue: 128)
/// HEX: #178437
public static let mvmGreenShade1 = UIColor.color8Bits(red: 23, green: 132, blue: 55)
/// HEX: #0F5B25
public static let mvmGreenShade2 = UIColor.color8Bits(red: 15, green: 91, blue: 37)
//--------------------------------------------------
// MARK: - Blue
//--------------------------------------------------
/// HEX: #0077B4
public static let mvmBlue = UIColor.color8Bits(red: 0, green: 119, blue: 180)
/// HEX: #57B1DF
public static let mvmBlue33 = UIColor.color8Bits(red: 87, green: 177, blue: 223)
/// HEX: #57B1DF
public static let mvmBlue66 = UIColor.color8Bits(red: 87, green: 177, blue: 223)
/// HEX: #136598
public static let mvmBlueShade1 = UIColor.color8Bits(red: 19, green: 101, blue: 152)
/// HEX: #0B4467
public static let mvmBlueShade2 = UIColor.color8Bits(red: 11, green: 68, blue: 103)
//--------------------------------------------------
// MARK: - Yellow
//--------------------------------------------------
/// HEX: #FFBC3D /// HEX: #FFBC3D
public static let mvmYellow = UIColor.color8Bits(red: 255, green: 188, blue: 61) public static let mvmYellow = UIColor.color8Bits(red: 255, green: 188, blue: 61)
/// HEX: #FFE9BF
public static let mvmYellow33 = UIColor.color8Bits(red: 255, green: 233, blue: 191)
/// HEX: #FFD37F
public static let mvmYellow66 = UIColor.color8Bits(red: 255, green: 211, blue: 127)
/// HEX: #CC9630
public static let mvmYellowShade1 = UIColor.color8Bits(red: 204, green: 150, blue: 48)
/// HEX: #997126
public static let mvmYellowShade2 = UIColor.color8Bits(red: 153, green: 113, blue: 38)
//--------------------------------------------------
// MARK: - Gray
//--------------------------------------------------
/// HEX: #F6F6F6 /// HEX: #F6F6F6
public static let mvmCoolGray1 = UIColor.grayscale(rgb: 246) public static let mvmCoolGray1 = UIColor.grayscale(rgb: 246)
@ -75,17 +213,14 @@ extension UIColor {
// MARK: - VZ UP Brand // MARK: - VZ UP Brand
//-------------------------------------------------- //--------------------------------------------------
/// HEX: #B89B56
public static let vzupGold = UIColor.color8Bits(red: 184, green: 155, blue: 68)
/// HEX: #F9D542 /// HEX: #F9D542
public static let vzupYellow1 = UIColor.color8Bits(red: 249, green: 213, blue: 66) public static let vzupGold1 = UIColor.color8Bits(red: 249, green: 213, blue: 66)
/// HEX: #F4CA53 /// HEX: #F4CA53
public static let vzupYellow2 = UIColor.color8Bits(red: 244, green: 202, blue: 83) public static let vzupGold2 = UIColor.color8Bits(red: 244, green: 202, blue: 83)
/// HEX: #CC9B2D /// HEX: #CC9B2D
public static let vzupYellow3 = UIColor.color8Bits(red: 204, green: 155, blue: 45) public static let vzupGold3 = UIColor.color8Bits(red: 204, green: 155, blue: 45)
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Functions // MARK: - Functions

View File

@ -21,6 +21,7 @@
+ (nonnull UIColor *)mfLightSilver; + (nonnull UIColor *)mfLightSilver;
+ (nonnull UIColor *)mfDarkSilver; + (nonnull UIColor *)mfDarkSilver;
+ (nonnull UIColor *)mfTomatoRed; + (nonnull UIColor *)mfTomatoRed;
+ (nonnull UIColor *)mvmOrange;
+ (nonnull UIColor *)mfPumpkinColor; + (nonnull UIColor *)mfPumpkinColor;
+ (nonnull UIColor *)mfShamrock; + (nonnull UIColor *)mfShamrock;
+ (nonnull UIColor *)mfCerulean; + (nonnull UIColor *)mfCerulean;

View File

@ -37,7 +37,6 @@
return [UIColor mfColor8bitsWithRed:198 green:197 blue:197 alpha:1.0]; return [UIColor mfColor8bitsWithRed:198 green:197 blue:197 alpha:1.0];
} }
+ (nonnull UIColor *)mfPrimaryButtonHighlightBlackColor { + (nonnull UIColor *)mfPrimaryButtonHighlightBlackColor {
return [UIColor mfColor8bitsWithRed:51 green:51 blue:51 alpha:1.0]; return [UIColor mfColor8bitsWithRed:51 green:51 blue:51 alpha:1.0];
} }
@ -54,6 +53,10 @@
return [UIColor mfColor8bitsWithRed:204 green:77 blue:15 alpha:1.0]; return [UIColor mfColor8bitsWithRed:204 green:77 blue:15 alpha:1.0];
} }
+ (nonnull UIColor *)mvmOrange {
return [UIColor mfColor8bitsWithRed:237 green:112 blue:0 alpha:1.0];
}
+ (nonnull UIColor *)mfShamrock { + (nonnull UIColor *)mfShamrock {
return [UIColor mfColor8bitsWithRed:0 green:134 blue:49 alpha:1.0]; return [UIColor mfColor8bitsWithRed:0 green:134 blue:49 alpha:1.0];
} }

View File

@ -0,0 +1,98 @@
//
// UIContentMode+Extension.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 2/17/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
enum ContentModeError: Error {
case notAContentMode
}
extension UIView.ContentMode: RawRepresentable {
init?(rawValue: String) {
switch rawValue {
case "scaleToFill":
self = .scaleToFill
case "scaleAspectFit":
self = .scaleAspectFit
case "scaleAspectFill":
self = .scaleAspectFill
case "redraw":
self = .redraw
case "center":
self = .center
case "top":
self = .top
case "bottom":
self = .bottom
case "left":
self = .left
case "right":
self = .right
case "topLeft":
self = .topLeft
case "topRight":
self = .topRight
case "bottomLeft":
self = .bottomLeft
case "bottomRight":
self = .bottomRight
default:
return nil
}
}
var rawValueString: String {
switch self {
case .scaleToFill:
return "scaleToFill"
case .scaleAspectFit:
return "scaleAspectFit"
case .scaleAspectFill:
return "scaleAspectFill"
case .redraw:
return "redraw"
case .center:
return "center"
case .top:
return "top"
case .bottom:
return "bottom"
case .left:
return "left"
case .right:
return "right"
case .topLeft:
return "topLeft"
case .topRight:
return "topRight"
case .bottomLeft:
return "bottomLeft"
case .bottomRight:
return "bottomRight"
@unknown default:
return ""
}
}
}
extension UIView.ContentMode: Codable {
public init(from decoder: Decoder) throws {
let typeContainer = try decoder.singleValueContainer()
let string = try typeContainer.decode(String.self)
guard let mode = UIView.ContentMode(rawValue: string) else {
throw ContentModeError.notAContentMode
}
self = mode
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encode(rawValueString)
}
}

View File

@ -49,7 +49,7 @@ public final class Color: Codable {
// MARK: - Class Initializers // MARK: - Class Initializers
//-------------------------------------------------- //--------------------------------------------------
init(uiColor: UIColor) { public init(uiColor: UIColor) {
self.uiColor = uiColor self.uiColor = uiColor
hex = UIColor.hexString(for: uiColor) ?? "" hex = UIColor.hexString(for: uiColor) ?? ""
determineRGBA() determineRGBA()

View File

@ -3,7 +3,7 @@ import Foundation
public protocol MoleculeModelProtocol: Model { public protocol MoleculeModelProtocol: Model {
var moleculeName: String? { get } var moleculeName: String? { get }
var backgroundColor: Color? { get set} var backgroundColor: Color? { get set }
} }
public extension MoleculeModelProtocol { public extension MoleculeModelProtocol {

View File

@ -0,0 +1,69 @@
//
// ListRightVariablePayments.swift
// MVMCoreUI
//
// Created by Lekshmi S on 10/02/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
@objcMembers public class ListRightVariablePayments: TableViewCell {
//-----------------------------------------------------
// MARK: - Outlets
//-------------------------------------------------------
let leftLabel = Label.commonLabelB1(true)
let rightImage = MFLoadImageView(pinnedEdges: .all)
let stack = Stack<StackModel>(frame: .zero)
//-----------------------------------------------------
// MARK: - View Lifecycle
//-------------------------------------------------------
open override func updateView(_ size: CGFloat) {
super.updateView(size)
stack.updateView(size)
}
override open func setupView() {
super.setupView()
guard leftLabel.superview == nil else {
return
}
stack.translatesAutoresizingMaskIntoConstraints = false
stack.stackItems = [StackItem(andContain: leftLabel),StackItem(andContain: rightImage)]
contentView.addSubview(stack)
containerHelper.constrainView(stack)
}
//----------------------------------------------------
// MARK: - Molecule
//------------------------------------------------------
override open func reset() {
super.reset()
stack.reset()
}
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
super.setWithModel(model, delegateObject, additionalData)
guard let model = model as? ListRightVariablePaymentsModel else { return }
leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData)
rightImage.setWithModel(model.image, delegateObject, additionalData)
// Create a stack model to use for the internal stack and set the alignment of label and image
let leftLabel = StackItemModel()
leftLabel.horizontalAlignment = .leading
let rightImage = StackItemModel()
rightImage.horizontalAlignment = .fill
let stackModel = StackModel(molecules: [leftLabel,rightImage])
stackModel.axis = .horizontal
stack.model = stackModel
stack.restack()
}
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
return 65
}
}

View File

@ -0,0 +1,52 @@
//
// ListRightVariablePaymentsModel.swift
// MVMCoreUI
//
// Created by Lekshmi S on 10/02/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtocol {
public static var identifier: String = "listRVImg"
public var image: ImageViewModel
public var leftLabel: LabelModel
public init(image: ImageViewModel, leftLabel: LabelModel) {
self.leftLabel = leftLabel
self.image = image
super.init()
}
static func createPayPalImage() -> ImageViewModel {
let image = ImageViewModel(image: "imageName_PayPal_logo")
image.localBundle = MVMCoreUIUtility.bundleForMVMCoreUI()
image.width = 70.0
image.height = 18.0
image.contentMode = .scaleAspectFit
return image
}
private enum CodingKeys: String, CodingKey {
case moleculeName
case leftLabel
case image
}
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)
image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) ?? ListRightVariablePaymentsModel.createPayPalImage()
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(leftLabel, forKey: .leftLabel)
try container.encode(image, forKey: .image)
}
}

View File

@ -11,6 +11,7 @@ import Foundation
@objcMembers public class DoughnutChartModel: MoleculeModelProtocol { @objcMembers public class DoughnutChartModel: MoleculeModelProtocol {
public var backgroundColor: Color? public var backgroundColor: Color?
public static var identifier: String = "doughnutChart" public static var identifier: String = "doughnutChart"
public var moleculeName: String? = DoughnutChartModel.identifier
public var title: LabelModel? public var title: LabelModel?
public var subtitle: LabelModel? public var subtitle: LabelModel?
public var sections: [DoughnutChartItemModel] public var sections: [DoughnutChartItemModel]
@ -24,6 +25,7 @@ import Foundation
@objcMembers public class DoughnutChartItemModel: MoleculeModelProtocol { @objcMembers public class DoughnutChartItemModel: MoleculeModelProtocol {
public var backgroundColor: Color? public var backgroundColor: Color?
public static var identifier: String = "doughnutChartItem" public static var identifier: String = "doughnutChartItem"
public var moleculeName: String? = DoughnutChartItemModel.identifier
public var label: LabelModel public var label: LabelModel
@Percent public var percent: CGFloat @Percent public var percent: CGFloat
public var color: Color public var color: Color

View File

@ -10,6 +10,7 @@ import Foundation
public struct ImageHeadlineBodyModel: MoleculeModelProtocol { public struct ImageHeadlineBodyModel: MoleculeModelProtocol {
public static var identifier: String = "imageHeadlineBody" public static var identifier: String = "imageHeadlineBody"
public var moleculeName: String? = ImageHeadlineBodyModel.identifier
public var backgroundColor: Color? public var backgroundColor: Color?
public var image: ImageViewModel public var image: ImageViewModel
public var headlineBody: HeadlineBodyModel public var headlineBody: HeadlineBodyModel

View File

@ -22,6 +22,7 @@ public class TabsModel: MoleculeModelProtocol {
case backgroundColor case backgroundColor
case selectedColor case selectedColor
case selectedIndex case selectedIndex
case moleculeName
} }
public init(with tabs: [LabelModel]) { public init(with tabs: [LabelModel]) {
@ -42,6 +43,7 @@ public class TabsModel: MoleculeModelProtocol {
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(tabs, forKey: .tabs) try container.encode(tabs, forKey: .tabs)
try container.encode(backgroundColor, forKey: .backgroundColor) try container.encode(backgroundColor, forKey: .backgroundColor)
try container.encode(selectedColor, forKey: .selectedColor) try container.encode(selectedColor, forKey: .selectedColor)

View File

@ -21,6 +21,11 @@ public class TwoButtonViewModel: MoleculeModelProtocol {
case secondaryButton case secondaryButton
} }
public init(_ primaryButton: ButtonModel?, _ secondaryButton: ButtonModel?) {
self.primaryButton = primaryButton
self.secondaryButton = secondaryButton
}
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)

View File

@ -14,7 +14,6 @@ import Foundation
public var backgroundColor: Color? public var backgroundColor: Color?
public var peakingUI: Bool? public var peakingUI: Bool?
public var peakingArrowColor: Color? public var peakingArrowColor: Color?
public var moleculeName: String?
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName case moleculeName
@ -25,7 +24,6 @@ import Foundation
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
peakingUI = try typeContainer.decodeIfPresent(Bool.self, forKey: .peakingUI) peakingUI = try typeContainer.decodeIfPresent(Bool.self, forKey: .peakingUI)
peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor) peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor)

View File

@ -25,7 +25,7 @@ import Foundation
public override init(with moleculeModel: MoleculeModelProtocol) { public override init(with moleculeModel: MoleculeModelProtocol) {
super.init(with: moleculeModel) super.init(with: moleculeModel)
} }
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
spacing = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .spacing) spacing = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .spacing)

View File

@ -10,6 +10,7 @@ import Foundation
@objcMembers public class StackItemModel: ContainerModel, StackItemModelProtocol, MoleculeModelProtocol { @objcMembers public class StackItemModel: ContainerModel, StackItemModelProtocol, MoleculeModelProtocol {
public static var identifier: String = "simpleStackItem" public static var identifier: String = "simpleStackItem"
public var moleculeName: String? = StackItemModel.identifier
public var backgroundColor: Color? public var backgroundColor: Color?
public var spacing: CGFloat? public var spacing: CGFloat?
public var percent: Int? public var percent: Int?

View File

@ -10,6 +10,7 @@ import Foundation
public struct ActionDetailWithImageModel: MoleculeModelProtocol { public struct ActionDetailWithImageModel: MoleculeModelProtocol {
public static var identifier: String = "actionDetailWithImage" public static var identifier: String = "actionDetailWithImage"
public var moleculeName: String? = ActionDetailWithImageModel.identifier
public var backgroundColor: Color? public var backgroundColor: Color?
public var headlineBodyButton: HeadlineBodyButtonModel public var headlineBodyButton: HeadlineBodyButtonModel
public var image: ImageViewModel public var image: ImageViewModel

View File

@ -28,6 +28,7 @@ public class CornerLabelsModel: MoleculeModelProtocol {
case bottomLeftLabel case bottomLeftLabel
case bottomRightLabel case bottomRightLabel
case molecule case molecule
case moleculeName
} }
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
@ -48,5 +49,6 @@ public class CornerLabelsModel: MoleculeModelProtocol {
try container.encodeIfPresent(topRightLabel, forKey: .topRightLabel) try container.encodeIfPresent(topRightLabel, forKey: .topRightLabel)
try container.encodeIfPresent(bottomLeftLabel, forKey: .bottomLeftLabel) try container.encodeIfPresent(bottomLeftLabel, forKey: .bottomLeftLabel)
try container.encodeIfPresent(bottomRightLabel, forKey: .bottomRightLabel) try container.encodeIfPresent(bottomRightLabel, forKey: .bottomRightLabel)
try container.encode(moleculeName, forKey: .moleculeName)
} }
} }

View File

@ -9,6 +9,7 @@
import Foundation import Foundation
public struct HeadlineBodyLinkToggleModel: MoleculeModelProtocol { public struct HeadlineBodyLinkToggleModel: MoleculeModelProtocol {
public static var identifier: String = "headlineBodyLinkToggle" public static var identifier: String = "headlineBodyLinkToggle"
public var moleculeName: String? = HeadlineBodyLinkToggleModel.identifier
public var backgroundColor: Color? public var backgroundColor: Color?
public var headlineBodyLink: HeadlineBodyLinkModel public var headlineBodyLink: HeadlineBodyLinkModel
public var toggle: ToggleModel public var toggle: ToggleModel

View File

@ -11,6 +11,7 @@ import Foundation
open class HeadlineBodyToggleModel: MoleculeModelProtocol { open class HeadlineBodyToggleModel: MoleculeModelProtocol {
public static var identifier: String = "headlineBodyToggle" public static var identifier: String = "headlineBodyToggle"
public var moleculeName: String? = HeadlineBodyToggleModel.identifier
open var backgroundColor: Color? open var backgroundColor: Color?
open var headlineBody: HeadlineBodyModel open var headlineBody: HeadlineBodyModel
open var toggle: ToggleModel open var toggle: ToggleModel

View File

@ -10,7 +10,13 @@ import Foundation
public class LabelToggleModel: MoleculeModelProtocol { public class LabelToggleModel: MoleculeModelProtocol {
public static var identifier: String = "labelToggle" public static var identifier: String = "labelToggle"
public var moleculeName: String? = LabelToggleModel.identifier
public var backgroundColor: Color? public var backgroundColor: Color?
public var label: LabelModel public var label: LabelModel
public var toggle: ToggleModel public var toggle: ToggleModel
init(_ label: LabelModel, _ toggle: ToggleModel) {
self.label = label
self.toggle = toggle
}
} }

View File

@ -10,5 +10,6 @@ import UIKit
public class ScrollerModel: MoleculeContainerModel, MoleculeModelProtocol { public class ScrollerModel: MoleculeContainerModel, MoleculeModelProtocol {
public static var identifier: String = "scroller" public static var identifier: String = "scroller"
public var moleculeName: String? = ScrollerModel.identifier
public var backgroundColor: Color? public var backgroundColor: Color?
} }

View File

@ -11,7 +11,7 @@ import Foundation
struct EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol { struct EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol {
static var identifier: String = "eyebrowHeadlineBodyLink" static var identifier: String = "eyebrowHeadlineBodyLink"
var backgroundColor: Color? var backgroundColor: Color?
var moleculeName: String? = EyebrowHeadlineBodyLinkModel.identifier
public var eyeBrow: LabelModel? public var eyeBrow: LabelModel?
public var headline: LabelModel? public var headline: LabelModel?
public var body: LabelModel? public var body: LabelModel?

View File

@ -10,6 +10,7 @@ import Foundation
public struct HeadlineBodyButtonModel: MoleculeModelProtocol { public struct HeadlineBodyButtonModel: MoleculeModelProtocol {
public static var identifier: String = "headlineBodyButton" public static var identifier: String = "headlineBodyButton"
public var moleculeName: String? = HeadlineBodyButtonModel.identifier
public var backgroundColor: Color? public var backgroundColor: Color?
public var headlineBody: HeadlineBodyModel public var headlineBody: HeadlineBodyModel

View File

@ -10,6 +10,7 @@ import Foundation
public struct HeadlineBodyLinkModel: MoleculeModelProtocol { public struct HeadlineBodyLinkModel: MoleculeModelProtocol {
public static var identifier: String = "headlineBodyLink" public static var identifier: String = "headlineBodyLink"
public var moleculeName: String? = HeadlineBodyLinkModel.identifier
public var headlineBody: HeadlineBodyModel public var headlineBody: HeadlineBodyModel
public var link: LinkModel public var link: LinkModel
public var backgroundColor: Color? public var backgroundColor: Color?

View File

@ -10,7 +10,7 @@ import Foundation
@objcMembers public class HeadlineBodyModel: MoleculeModelProtocol { @objcMembers public class HeadlineBodyModel: MoleculeModelProtocol {
public static var identifier: String = "headlineBody" public static var identifier: String = "headlineBody"
public var moleculeName: String? public var moleculeName: String? = HeadlineBodyModel.identifier
public var headline: LabelModel? public var headline: LabelModel?
public var body: LabelModel? public var body: LabelModel?
public var style: String? public var style: String?

View File

@ -38,5 +38,6 @@ public class StringAndMoleculeModel: MoleculeModelProtocol {
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(string, forKey: .string) try container.encode(string, forKey: .string)
try container.encodeModel(molecule, forKey: .molecule) try container.encodeModel(molecule, forKey: .molecule)
try container.encode(moleculeName, forKey: .moleculeName)
} }
} }

View File

@ -53,7 +53,7 @@ import UIKit
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(molecules, forKey: .molecules) try container.encode(molecules, forKey: .molecules)
try container.encode(spacing, forKey: .spacing) try container.encode(spacing, forKey: .spacing)

View File

@ -45,5 +45,6 @@ import Foundation
try container.encodeIfPresent(molecules, forKey: .molecules) try container.encodeIfPresent(molecules, forKey: .molecules)
try container.encodeIfPresent(axis.rawValueString, forKey: .axis) try container.encodeIfPresent(axis.rawValueString, forKey: .axis)
try container.encodeIfPresent(spacing, forKey: .spacing) try container.encodeIfPresent(spacing, forKey: .spacing)
try container.encode(moleculeName, forKey: .moleculeName)
} }
} }

View File

@ -22,8 +22,7 @@
@"stack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeStackTemplate class]], @"stack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeStackTemplate class]],
@"centerMoleculeStack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeStackCenteredTemplate class]], @"centerMoleculeStack" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeStackCenteredTemplate class]],
@"list" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeListTemplate class]], @"list" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MoleculeListTemplate class]],
@"threeLayer" : @"threeLayer" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ThreeLayerTemplate class]]
[[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[ThreeLayerTemplate class]]
} mutableCopy]; } mutableCopy];
}); });
return viewControllerMapping; return viewControllerMapping;

View File

@ -72,7 +72,7 @@ import Foundation
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self)
// List items // List items
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self)

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "paypal_horiz_logo.jpeg",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "paypal_horiz_logo@2x.jpeg",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "paypal_horiz_logo@3x.jpeg",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -23,8 +23,12 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
// MARK: - Computed Properties // MARK: - Computed Properties
//-------------------------------------------------- //--------------------------------------------------
@objc public override func parsePageJSON() throws { open override func parsePageJSON(_ error: NSErrorPointer) {
try parseTemplateJSON() do {
try parseTemplateJSON()
} catch let parseError {
error?.pointee = parseError as NSError
}
} }
open override var loadObject: MVMCoreLoadObject? { open override var loadObject: MVMCoreLoadObject? {

View File

@ -12,8 +12,12 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol {
var observer: NSKeyValueObservation? var observer: NSKeyValueObservation?
public var templateModel: StackPageTemplateModel? public var templateModel: StackPageTemplateModel?
public override func parsePageJSON() throws { open override func parsePageJSON(_ error: NSErrorPointer) {
try parseTemplateJSON() do {
try parseTemplateJSON()
} catch let parseError {
error?.pointee = parseError as NSError
}
} }
open override var loadObject: MVMCoreLoadObject? { open override var loadObject: MVMCoreLoadObject? {

View File

@ -11,8 +11,13 @@ import UIKit
@objcMembers open class ThreeLayerTemplate: ThreeLayerViewController, TemplateProtocol { @objcMembers open class ThreeLayerTemplate: ThreeLayerViewController, TemplateProtocol {
public var templateModel: ThreeLayerPageTemplateModel? public var templateModel: ThreeLayerPageTemplateModel?
@objc public override func parsePageJSON() throws {
try parseTemplateJSON() open override func parsePageJSON(_ error: NSErrorPointer) {
do {
try parseTemplateJSON()
} catch let parseError {
error?.pointee = parseError as NSError
}
} }
override open func viewDidLoad() { override open func viewDidLoad() {

View File

@ -108,7 +108,7 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed.";
- (nonnull UIColor *)getBackgroundColorForType:(nullable NSString *)type { - (nonnull UIColor *)getBackgroundColorForType:(nullable NSString *)type {
if ([type isEqualToString:ValueTypeError]) { if ([type isEqualToString:ValueTypeError]) {
return [UIColor mfPumpkinColor]; return [UIColor mvmOrange];
} else { } else {
return [UIColor mfShamrock]; return [UIColor mfShamrock];
} }