Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/list_twocolumn_price_details
# Conflicts: # MVMCoreUI.xcodeproj/project.pbxproj
This commit is contained in:
commit
e07571f628
@ -128,8 +128,8 @@
|
||||
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, ); }; };
|
||||
94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; };
|
||||
AAB04E4E23FCE7ED007C79B0 /* ListTwoColumnPriceDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB04E4D23FCE7ED007C79B0 /* ListTwoColumnPriceDetails.swift */; };
|
||||
AAB04E5023FCE7FB007C79B0 /* ListTwoColumnPriceDetailsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB04E4F23FCE7FB007C79B0 /* ListTwoColumnPriceDetailsModel.swift */; };
|
||||
AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */; };
|
||||
AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */; };
|
||||
C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; };
|
||||
C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; };
|
||||
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; };
|
||||
@ -453,8 +453,8 @@
|
||||
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>"; };
|
||||
94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = "<group>"; };
|
||||
AAB04E4D23FCE7ED007C79B0 /* ListTwoColumnPriceDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetails.swift; sourceTree = "<group>"; };
|
||||
AAB04E4F23FCE7FB007C79B0 /* ListTwoColumnPriceDetailsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetailsModel.swift; sourceTree = "<group>"; };
|
||||
AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePayments.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>"; };
|
||||
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>"; };
|
||||
@ -786,13 +786,13 @@
|
||||
name = "Recovered References";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AAB04E4C23FCE7AC007C79B0 /* TwoColumn */ = {
|
||||
AA4FC2A323F4F69600E251DB /* RightVariable */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AAB04E4D23FCE7ED007C79B0 /* ListTwoColumnPriceDetails.swift */,
|
||||
AAB04E4F23FCE7FB007C79B0 /* ListTwoColumnPriceDetailsModel.swift */,
|
||||
AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */,
|
||||
AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */,
|
||||
);
|
||||
path = TwoColumn;
|
||||
path = RightVariable;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D213347423842FE3008E41B3 /* Controllers */ = {
|
||||
@ -976,6 +976,7 @@
|
||||
D22B38EA23F4E08B00490EF6 /* List */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA4FC2A323F4F69600E251DB /* RightVariable */,
|
||||
D22B38EB23F4E0AE00490EF6 /* LeftVariable */,
|
||||
);
|
||||
path = List;
|
||||
@ -993,7 +994,6 @@
|
||||
D22B38EC23F4E10700490EF6 /* SectionDividers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AAB04E4C23FCE7AC007C79B0 /* TwoColumn */,
|
||||
D22B38ED23F4E11100490EF6 /* ThreeColumn */,
|
||||
);
|
||||
path = SectionDividers;
|
||||
@ -1630,6 +1630,7 @@
|
||||
DBC4391922442197001AB423 /* DashLine.swift in Sources */,
|
||||
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */,
|
||||
D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */,
|
||||
AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */,
|
||||
D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */,
|
||||
0116A4E5228B19640094F3ED /* RadioButtonModel.swift in Sources */,
|
||||
017BEB48236230DB0024EF95 /* MoleculeViewProtocol.swift in Sources */,
|
||||
@ -1639,7 +1640,6 @@
|
||||
D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */,
|
||||
D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */,
|
||||
01004F3022721C3800991ECC /* RadioButton.swift in Sources */,
|
||||
AAB04E5023FCE7FB007C79B0 /* ListTwoColumnPriceDetailsModel.swift in Sources */,
|
||||
D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */,
|
||||
017BEB3C2361EA1D0024EF95 /* MFViewController+Model.swift in Sources */,
|
||||
D282AAB4223FDDAE00C46919 /* MFLoadImageView.swift in Sources */,
|
||||
@ -1692,8 +1692,8 @@
|
||||
D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */,
|
||||
0A21DB85235E06EF00C160A2 /* MFTextField.m in Sources */,
|
||||
014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */,
|
||||
AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */,
|
||||
01EB369223609801006832FA /* MoleculeStackModel.swift in Sources */,
|
||||
AAB04E4E23FCE7ED007C79B0 /* ListTwoColumnPriceDetails.swift in Sources */,
|
||||
012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */,
|
||||
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */,
|
||||
944589232385DA9600DE9FD4 /* ImageViewModel.swift in Sources */,
|
||||
|
||||
@ -30,6 +30,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
case enabledColor
|
||||
case disabledColor
|
||||
case enabled
|
||||
case moleculeName
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
@ -50,6 +51,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(title, forKey: .title)
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encodeModel(action, forKey: .action)
|
||||
|
||||
@ -36,6 +36,10 @@ import UIKit
|
||||
context?.strokePath()
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - ModelMoleculeViewProtocol
|
||||
//--------------------------------------------------
|
||||
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? LinkModel else { return }
|
||||
|
||||
@ -9,7 +9,12 @@
|
||||
import UIKit
|
||||
|
||||
public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
|
||||
public static var identifier: String = "link"
|
||||
|
||||
public var backgroundColor: Color?
|
||||
public var title: String
|
||||
public var action: ActionModelProtocol
|
||||
@ -17,12 +22,21 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
public var textColor = Color(uiColor: .mvmBlack)
|
||||
public var disabledColor = Color(uiColor: .mvmCoolGray6)
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
//--------------------------------------------------
|
||||
|
||||
public init(title: String, action: ActionModelProtocol) {
|
||||
self.title = title
|
||||
self.action = action
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Keys
|
||||
//--------------------------------------------------
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case backgroundColor
|
||||
case title
|
||||
case action
|
||||
@ -31,11 +45,16 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
case disabledColor
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Codec
|
||||
//--------------------------------------------------
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
title = try typeContainer.decode(String.self, forKey: .title)
|
||||
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||
|
||||
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
|
||||
self.enabled = enabled
|
||||
}
|
||||
@ -51,6 +70,7 @@ public class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(title, forKey: .title)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encodeModel(action, forKey: .action)
|
||||
try container.encode(enabled, forKey: .enabled)
|
||||
|
||||
@ -37,9 +37,9 @@
|
||||
}
|
||||
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(caretView, forKey: .caretView)
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,6 @@ import Foundation
|
||||
}
|
||||
|
||||
public var backgroundColor: Color?
|
||||
public var moleculeName: String?
|
||||
public var title: String?
|
||||
public var feedback: String?
|
||||
public var errorMessage: String = ""
|
||||
@ -54,7 +53,6 @@ import Foundation
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
||||
feedback = try typeContainer.decodeIfPresent(String.self, forKey: .feedback)
|
||||
|
||||
@ -12,7 +12,7 @@ import UIKit
|
||||
|
||||
public static var identifier: String = "textField"
|
||||
public var backgroundColor: Color?
|
||||
public var moleculeName: String
|
||||
public var moleculeName: String? = TextFieldModel.identifier
|
||||
public var editable: Bool?
|
||||
public var disabled: Bool?
|
||||
public var errorMsg: String?
|
||||
|
||||
@ -18,6 +18,7 @@ import Foundation
|
||||
public var lineWidth: CGFloat?
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case backgroundColor
|
||||
case strokeColor
|
||||
case isHidden
|
||||
@ -38,6 +39,7 @@ import Foundation
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(strokeColor, forKey: .strokeColor)
|
||||
try container.encodeIfPresent(isHidden, forKey: .isHidden)
|
||||
try container.encodeIfPresent(isOpaque, forKey: .isOpaque)
|
||||
|
||||
@ -39,6 +39,7 @@ import Foundation
|
||||
//--------------------------------------------------
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case groupName
|
||||
case value
|
||||
case fieldKey
|
||||
@ -85,6 +86,7 @@ import Foundation
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encodeIfPresent(groupName, forKey: .groupName)
|
||||
try container.encodeIfPresent(value, forKey: .value)
|
||||
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
|
||||
|
||||
@ -48,6 +48,7 @@ public class CircleProgressModel: MoleculeModelProtocol {
|
||||
case duration
|
||||
case colors
|
||||
case backgroundColor
|
||||
case moleculeName
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
@ -78,6 +79,7 @@ public class CircleProgressModel: MoleculeModelProtocol {
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(style, forKey: .style)
|
||||
try container.encode(size, forKey: .size)
|
||||
try container.encode(diameter, forKey: .diameter)
|
||||
|
||||
@ -20,6 +20,7 @@ import Foundation
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case backgroundColor
|
||||
case dashColor
|
||||
case isHidden
|
||||
@ -36,6 +37,7 @@ import Foundation
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(dashColor, forKey: .dashColor)
|
||||
try container.encodeIfPresent(isHidden, forKey: .isHidden)
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
|
||||
@ -11,6 +11,7 @@ import Foundation
|
||||
@objcMembers public class ImageViewModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "image"
|
||||
public var backgroundColor: Color?
|
||||
public var moleculeName: String? = ImageViewModel.identifier
|
||||
public var image: String
|
||||
public var accessibilityText: String?
|
||||
public var fallbackImage: String?
|
||||
@ -18,8 +19,21 @@ import Foundation
|
||||
public var width: 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
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,12 @@ import UIKit
|
||||
|
||||
@objcMembers public class LeftRightLabelModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "leftRightLabelView"
|
||||
public var moleculeName: String? = LeftRightLabelModel.identifier
|
||||
public var backgroundColor: Color?
|
||||
public var leftText: LabelModel
|
||||
public var rightText: LabelModel?
|
||||
|
||||
init(_ leftText: LabelModel) {
|
||||
self.leftText = leftText
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ import UIKit
|
||||
if shouldLoadImage(withName: imageModel.image, width: width, height: height) {
|
||||
imageView.image = 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 {
|
||||
@ -276,7 +276,7 @@ import UIKit
|
||||
}
|
||||
|
||||
// MARK: - load functions
|
||||
public func loadImage(withName imageName: String?, format: String? = nil, width: NSNumber? = nil, height: NSNumber? = nil, customFallbackImage: String? = nil, allowServerParameters: Bool = false, completionHandler: MVMCoreGetImageBlock? = nil) {
|
||||
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
|
||||
@ -308,7 +308,7 @@ import UIKit
|
||||
// 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, allowServerQueryParameters: allowServerParameters, completionHandler: finishedLoadingBlock)
|
||||
} else {
|
||||
MVMCoreCache.shared()?.getImage(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, allowServerQueryParameters: allowServerParameters, 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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ import Foundation
|
||||
public var roundedRect: Bool?
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case progressList
|
||||
case thickness
|
||||
case roundedRect
|
||||
@ -46,6 +47,7 @@ import Foundation
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(progressList, forKey: .progressList)
|
||||
try container.encodeIfPresent(thickness, forKey: .thickness)
|
||||
try container.encodeIfPresent(roundedRect, forKey: .roundedRect)
|
||||
|
||||
@ -10,7 +10,6 @@ import UIKit
|
||||
|
||||
public class ToggleModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "toggle"
|
||||
public var moleculeName: String?
|
||||
public var backgroundColor: Color?
|
||||
public var state: Bool = true
|
||||
public var action: ActionModelProtocol?
|
||||
|
||||
@ -12,6 +12,7 @@ public typealias ButtonAction = (Button) -> ()
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
|
||||
open var model: MoleculeModelProtocol?
|
||||
open var actionModel: ActionModelProtocol?
|
||||
|
||||
@ -67,7 +68,7 @@ public typealias ButtonAction = (Button) -> ()
|
||||
addTarget(self, action: #selector(callActionBlock(_:)), for: event)
|
||||
}
|
||||
|
||||
@objc private func callActionBlock(_ sender: Button) {
|
||||
@objc func callActionBlock(_ sender: Button) {
|
||||
buttonAction?(self)
|
||||
}
|
||||
|
||||
@ -88,11 +89,13 @@ public typealias ButtonAction = (Button) -> ()
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
self.model = model
|
||||
|
||||
if let backgroundColor = model?.backgroundColor {
|
||||
self.backgroundColor = backgroundColor.uiColor
|
||||
}
|
||||
|
||||
guard let model = model as? ButtonModelProtocol else { return }
|
||||
|
||||
isEnabled = model.enabled
|
||||
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
@ -113,7 +116,7 @@ public typealias ButtonAction = (Button) -> ()
|
||||
// MARK: - MVMCoreViewProtocol
|
||||
extension Button: MVMCoreViewProtocol {
|
||||
|
||||
open func updateView(_ size: CGFloat) {}
|
||||
open func updateView(_ size: CGFloat) { }
|
||||
|
||||
/// Will be called only once.
|
||||
open func setupView() {
|
||||
@ -126,6 +129,7 @@ extension Button: MVMCoreViewProtocol {
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
extension Button: MVMCoreUIMoleculeViewProtocol {
|
||||
|
||||
open func reset() {
|
||||
backgroundColor = .clear
|
||||
}
|
||||
@ -133,6 +137,7 @@ extension Button: MVMCoreUIMoleculeViewProtocol {
|
||||
|
||||
// MARK: AppleGuidelinesProtocol
|
||||
extension Button: AppleGuidelinesProtocol {
|
||||
|
||||
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
return Self.acceptablyOutsideBounds(point: point, bounds: bounds)
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ import Foundation
|
||||
|
||||
public protocol MoleculeModelProtocol: Model {
|
||||
var moleculeName: String? { get }
|
||||
var backgroundColor: Color? { get set}
|
||||
var backgroundColor: Color? { get set }
|
||||
}
|
||||
|
||||
public extension MoleculeModelProtocol {
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ import Foundation
|
||||
@objcMembers public class DoughnutChartModel: MoleculeModelProtocol {
|
||||
public var backgroundColor: Color?
|
||||
public static var identifier: String = "doughnutChart"
|
||||
public var moleculeName: String? = DoughnutChartModel.identifier
|
||||
public var title: LabelModel?
|
||||
public var subtitle: LabelModel?
|
||||
public var sections: [DoughnutChartItemModel]
|
||||
@ -24,6 +25,7 @@ import Foundation
|
||||
@objcMembers public class DoughnutChartItemModel: MoleculeModelProtocol {
|
||||
public var backgroundColor: Color?
|
||||
public static var identifier: String = "doughnutChartItem"
|
||||
public var moleculeName: String? = DoughnutChartItemModel.identifier
|
||||
public var label: LabelModel
|
||||
@Percent public var percent: CGFloat
|
||||
public var color: Color
|
||||
|
||||
@ -10,6 +10,7 @@ import Foundation
|
||||
|
||||
public struct ImageHeadlineBodyModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "imageHeadlineBody"
|
||||
public var moleculeName: String? = ImageHeadlineBodyModel.identifier
|
||||
public var backgroundColor: Color?
|
||||
public var image: ImageViewModel
|
||||
public var headlineBody: HeadlineBodyModel
|
||||
|
||||
@ -22,6 +22,7 @@ public class TabsModel: MoleculeModelProtocol {
|
||||
case backgroundColor
|
||||
case selectedColor
|
||||
case selectedIndex
|
||||
case moleculeName
|
||||
}
|
||||
|
||||
public init(with tabs: [LabelModel]) {
|
||||
@ -42,6 +43,7 @@ public class TabsModel: MoleculeModelProtocol {
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(tabs, forKey: .tabs)
|
||||
try container.encode(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encode(selectedColor, forKey: .selectedColor)
|
||||
|
||||
@ -14,7 +14,6 @@ import Foundation
|
||||
public var backgroundColor: Color?
|
||||
public var peakingUI: Bool?
|
||||
public var peakingArrowColor: Color?
|
||||
public var moleculeName: String?
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
@ -25,7 +24,6 @@ import Foundation
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
peakingUI = try typeContainer.decodeIfPresent(Bool.self, forKey: .peakingUI)
|
||||
peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor)
|
||||
|
||||
@ -10,6 +10,7 @@ import Foundation
|
||||
|
||||
@objcMembers public class StackItemModel: ContainerModel, StackItemModelProtocol, MoleculeModelProtocol {
|
||||
public static var identifier: String = "simpleStackItem"
|
||||
public var moleculeName: String? = StackItemModel.identifier
|
||||
public var backgroundColor: Color?
|
||||
public var spacing: CGFloat?
|
||||
public var percent: Int?
|
||||
|
||||
@ -10,6 +10,7 @@ import Foundation
|
||||
|
||||
public struct ActionDetailWithImageModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "actionDetailWithImage"
|
||||
public var moleculeName: String? = ActionDetailWithImageModel.identifier
|
||||
public var backgroundColor: Color?
|
||||
public var headlineBodyButton: HeadlineBodyButtonModel
|
||||
public var image: ImageViewModel
|
||||
|
||||
@ -28,6 +28,7 @@ public class CornerLabelsModel: MoleculeModelProtocol {
|
||||
case bottomLeftLabel
|
||||
case bottomRightLabel
|
||||
case molecule
|
||||
case moleculeName
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
@ -48,5 +49,6 @@ public class CornerLabelsModel: MoleculeModelProtocol {
|
||||
try container.encodeIfPresent(topRightLabel, forKey: .topRightLabel)
|
||||
try container.encodeIfPresent(bottomLeftLabel, forKey: .bottomLeftLabel)
|
||||
try container.encodeIfPresent(bottomRightLabel, forKey: .bottomRightLabel)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
import Foundation
|
||||
public struct HeadlineBodyLinkToggleModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBodyLinkToggle"
|
||||
public var moleculeName: String? = HeadlineBodyLinkToggleModel.identifier
|
||||
public var backgroundColor: Color?
|
||||
public var headlineBodyLink: HeadlineBodyLinkModel
|
||||
public var toggle: ToggleModel
|
||||
|
||||
@ -11,6 +11,7 @@ import Foundation
|
||||
|
||||
open class HeadlineBodyToggleModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBodyToggle"
|
||||
public var moleculeName: String? = HeadlineBodyToggleModel.identifier
|
||||
open var backgroundColor: Color?
|
||||
open var headlineBody: HeadlineBodyModel
|
||||
open var toggle: ToggleModel
|
||||
|
||||
@ -10,7 +10,13 @@ import Foundation
|
||||
|
||||
public class LabelToggleModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "labelToggle"
|
||||
public var moleculeName: String? = LabelToggleModel.identifier
|
||||
public var backgroundColor: Color?
|
||||
public var label: LabelModel
|
||||
public var toggle: ToggleModel
|
||||
|
||||
init(_ label: LabelModel, _ toggle: ToggleModel) {
|
||||
self.label = label
|
||||
self.toggle = toggle
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,5 +10,6 @@ import UIKit
|
||||
|
||||
public class ScrollerModel: MoleculeContainerModel, MoleculeModelProtocol {
|
||||
public static var identifier: String = "scroller"
|
||||
public var moleculeName: String? = ScrollerModel.identifier
|
||||
public var backgroundColor: Color?
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ import Foundation
|
||||
struct EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol {
|
||||
static var identifier: String = "eyebrowHeadlineBodyLink"
|
||||
var backgroundColor: Color?
|
||||
|
||||
var moleculeName: String? = EyebrowHeadlineBodyLinkModel.identifier
|
||||
public var eyeBrow: LabelModel?
|
||||
public var headline: LabelModel?
|
||||
public var body: LabelModel?
|
||||
|
||||
@ -10,6 +10,7 @@ import Foundation
|
||||
|
||||
public struct HeadlineBodyButtonModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBodyButton"
|
||||
public var moleculeName: String? = HeadlineBodyButtonModel.identifier
|
||||
public var backgroundColor: Color?
|
||||
|
||||
public var headlineBody: HeadlineBodyModel
|
||||
|
||||
@ -10,6 +10,7 @@ import Foundation
|
||||
|
||||
public struct HeadlineBodyLinkModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBodyLink"
|
||||
public var moleculeName: String? = HeadlineBodyLinkModel.identifier
|
||||
public var headlineBody: HeadlineBodyModel
|
||||
public var link: LinkModel
|
||||
public var backgroundColor: Color?
|
||||
|
||||
@ -10,6 +10,7 @@ import Foundation
|
||||
|
||||
@objcMembers public class HeadlineBodyModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBody"
|
||||
public var moleculeName: String? = HeadlineBodyModel.identifier
|
||||
public var headline: LabelModel?
|
||||
public var body: LabelModel?
|
||||
public var style: String?
|
||||
|
||||
@ -38,5 +38,6 @@ public class StringAndMoleculeModel: MoleculeModelProtocol {
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encode(string, forKey: .string)
|
||||
try container.encodeModel(molecule, forKey: .molecule)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ import UIKit
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
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.encode(molecules, forKey: .molecules)
|
||||
try container.encode(spacing, forKey: .spacing)
|
||||
|
||||
@ -45,5 +45,6 @@ import Foundation
|
||||
try container.encodeIfPresent(molecules, forKey: .molecules)
|
||||
try container.encodeIfPresent(axis.rawValueString, forKey: .axis)
|
||||
try container.encodeIfPresent(spacing, forKey: .spacing)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,6 +73,7 @@ import Foundation
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self)
|
||||
|
||||
// List items
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self)
|
||||
|
||||
23
MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/Contents.json
vendored
Normal file
23
MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/Contents.json
vendored
Normal 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"
|
||||
}
|
||||
}
|
||||
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo.jpeg
vendored
Normal file
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo.jpeg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo@2x.jpeg
vendored
Normal file
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo@2x.jpeg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo@3x.jpeg
vendored
Normal file
BIN
MVMCoreUI/SupportingFiles/Media.xcassets/imageName_PayPal_logo.imageset/paypal_horiz_logo@3x.jpeg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
Loading…
Reference in New Issue
Block a user