This commit is contained in:
Pfeil, Scott Robert 2020-04-29 19:14:09 -04:00
commit 8cc67991ed
9 changed files with 187 additions and 22 deletions

View File

@ -191,6 +191,8 @@
AAC6F167243332E400F295C1 /* RadioSwatchesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */; };
BB1D17E0244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */; };
BB1D17E2244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */; };
BB2BF0EA2452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2BF0E92452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift */; };
BB2BF0EC2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */; };
BB2C968F24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */; };
BB2C969224330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */; };
BB47A586241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */; };
@ -588,6 +590,8 @@
AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchesModel.swift; sourceTree = "<group>"; };
BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMediumModel.swift; sourceTree = "<group>"; };
BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMedium.swift; sourceTree = "<group>"; };
BB2BF0E92452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonSmall.swift; sourceTree = "<group>"; };
BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonSmallModel.swift; sourceTree = "<group>"; };
BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinksModel.swift; sourceTree = "<group>"; };
BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinks.swift; sourceTree = "<group>"; };
BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = "<group>"; };
@ -1061,6 +1065,8 @@
D20FFFB42451E32100A31DA2 /* Device */ = {
isa = PBXGroup;
children = (
BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */,
BB2BF0E92452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift */,
BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */,
BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */,
AA617AB12453012400910B8F /* ListDeviceComplexLinkSmallModel.swift */,
@ -1915,6 +1921,7 @@
D2B18B7F2360913400A9AEDC /* Control.swift in Sources */,
D253BB8A24574CC5002DE544 /* StackModel.swift in Sources */,
011D95A924057AC7000E3791 /* FormGroupWatcherFieldProtocol.swift in Sources */,
BB2BF0EA2452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift in Sources */,
D236E5B4241FEB1000C38625 /* ListTwoColumnPriceDescription.swift in Sources */,
0AA33B3A2398524F0067DD0F /* Toggle.swift in Sources */,
D29DF12F21E6851E003B2FB9 /* MVMCoreUITopAlertMainView.m in Sources */,
@ -2159,6 +2166,7 @@
AA85236C244435A20059CC1E /* RadioSwatchCollectionViewCell.swift in Sources */,
52B201D224081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift in Sources */,
D26C5A6B23F4A40D007AEECE /* ListItemModel.swift in Sources */,
BB2BF0EC2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift in Sources */,
943784F6236B77BB006A1E82 /* WheelAnimationHandler.swift in Sources */,
011D95A1240453D0000E3791 /* RuleEqualsModel.swift in Sources */,
D29DF2AA21E7B2F9003B2FB9 /* MVMCoreUIConstants.m in Sources */,

View File

@ -177,6 +177,8 @@ import Foundation
// Device Items
MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexButtonMedium.self, viewModelClass: ListDeviceComplexButtonMediumModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexButtonSmall.self, viewModelClass: ListDeviceComplexButtonSmallModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexLinkSmall.self, viewModelClass: ListDeviceComplexLinkSmallModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexLinkMedium.self, viewModelClass: ListDeviceComplexLinkMediumModel.self)

View File

@ -21,15 +21,16 @@ import Foundation
// MARK: - Initializers
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
rightImageView.addSizeConstraintsForAspectRatio = true
rightImageView.imageView.contentMode = .scaleAspectFit
rightImageView.heightAnchor.constraint(equalToConstant: 116.0).isActive = true
rightImageView.widthAnchor.constraint(equalToConstant: 116.0).isActive = true
verticalStack = Stack<StackModel>.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)),
(view: headline, model: StackItemModel(horizontalAlignment: .leading)),
(view: body, model: StackItemModel(horizontalAlignment: .leading)),
(view: body2, model: StackItemModel(horizontalAlignment: .leading)),
(view: button, model: StackItemModel(spacing:16, horizontalAlignment: .leading))],
(view: button, model: StackItemModel(spacing: 16, horizontalAlignment: .leading))],
axis: .vertical, spacing: 0)
stack = Stack<StackModel>.createStack(with: [(view: verticalStack, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .leading)),
stack = Stack<StackModel>.createStack(with: [(view: verticalStack, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .leading)),
(view: rightImageView, model: StackItemModel(horizontalAlignment: .fill, verticalAlignment: .center))],
axis: .horizontal)
super.init(style: style, reuseIdentifier: reuseIdentifier)

View File

@ -0,0 +1,80 @@
//
// ListDeviceComplexButtonSmall.swift
// MVMCoreUI
//
// Created by Dhamodaram Nandi on 24/04/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
@objcMembers open class ListDeviceComplexButtonSmall: TableViewCell {
public var verticalStack: Stack<StackModel>
public let eyebrow = Label.createLabelRegularMicro(true)
public let headline = Label.createLabelBoldTitleMedium(true)
public let body = Label.createLabelRegularBodySmall(true)
public let body2 = Label.createLabelRegularBodySmall(true)
public let button = PillButton(frame: .zero)
public let rightImageView = MFLoadImageView()
public var stack: Stack<StackModel>
// MARK: - Initializers
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
rightImageView.addSizeConstraintsForAspectRatio = true
rightImageView.imageView.contentMode = .scaleAspectFit
rightImageView.heightAnchor.constraint(equalToConstant: 71.0).isActive = true
rightImageView.widthAnchor.constraint(equalToConstant: 71.0).isActive = true
verticalStack = Stack<StackModel>.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)),
(view: headline, model: StackItemModel(horizontalAlignment: .leading)),
(view: body, model: StackItemModel(horizontalAlignment: .leading)),
(view: body2, model: StackItemModel(horizontalAlignment: .leading)),
(view: button, model: StackItemModel(spacing: 16, horizontalAlignment: .leading))],
axis: .vertical, spacing: 0)
stack = Stack<StackModel>.createStack(with: [(view: verticalStack, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .leading)),
(view: rightImageView, model: StackItemModel(horizontalAlignment: .fill, verticalAlignment: .center))],
axis: .horizontal)
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - MFViewProtocol
open override func setupView() {
super.setupView()
addMolecule(stack)
stack.restack()
verticalStack.restack()
}
// MARK: - ModelMoleculeViewProtocol
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListDeviceComplexButtonSmallModel else { return }
verticalStack.updateContainedMolecules(with: [model.eyebrow,
model.headline,
model.body,
model.body2,
model.button],
delegateObject, additionalData)
rightImageView.set(with: model.image, delegateObject, additionalData)
}
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
return 120
}
public func setDefault() {
eyebrow.styleRegularMicro(true)
headline.styleBoldTitleMedium(true)
body.styleRegularBodySmall(true)
body2.styleRegularBodySmall(true)
eyebrow.textColor = .mvmCoolGray6
}
open override func reset() {
super.reset()
setDefault()
}
}

View File

@ -0,0 +1,68 @@
//
// ListDeviceComplexButtonSmallModel.swift
// MVMCoreUI
//
// Created by Dhamodaram Nandi on 24/04/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
public class ListDeviceComplexButtonSmallModel: ListItemModel, MoleculeModelProtocol {
public static var identifier: String = "listDvcBtnS"
public var eyebrow: LabelModel?
public var headline: LabelModel?
public var body: LabelModel?
public var body2: LabelModel?
public var button: ButtonModel
public var image: ImageViewModel
public init(eyebrow: LabelModel, headline:LabelModel, body: LabelModel, body2: LabelModel, button: ButtonModel, image: ImageViewModel) {
self.eyebrow = eyebrow
self.headline = headline
self.body = body
self.body2 = body2
self.button = button
self.image = image
super.init()
}
/// Defaults to set
override public func setDefaults() {
super.setDefaults()
button.size = .tiny
button.style = .secondary
}
private enum CodingKeys: String, CodingKey {
case moleculeName
case eyebrow
case headline
case body
case body2
case button
case image
}
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
headline = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .headline)
body = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body)
body2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body2)
button = try typeContainer.decode(ButtonModel.self, forKey: .button)
image = try typeContainer.decode(ImageViewModel.self, forKey: .image)
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.encodeIfPresent(eyebrow, forKey: .eyebrow)
try container.encodeIfPresent(headline, forKey: .headline)
try container.encodeIfPresent(body, forKey: .body)
try container.encodeIfPresent(body2, forKey: .body2)
try container.encode(button, forKey: .button)
try container.encode(image, forKey: .image)
}
}

View File

@ -16,7 +16,7 @@ import Foundation
public let headline = Label.createLabelBoldTitleMedium(true)
public let body = Label.createLabelRegularBodySmall(true)
public let body2 = Label.createLabelRegularBodySmall(true)
public let link = Link()
public let twoLinkView = TwoLinkView()
public let rightImage = LoadImageView()
let verticalStack: Stack<StackModel>
public let stack: Stack<StackModel>
@ -26,11 +26,14 @@ import Foundation
//------------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
rightImage.addSizeConstraintsForAspectRatio = true
rightImage.imageView.contentMode = .scaleAspectFit
rightImage.heightAnchor.constraint(equalToConstant: 116.0).isActive = true
rightImage.widthAnchor.constraint(equalToConstant: 116.0).isActive = true
verticalStack = Stack<StackModel>.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)), (view: headline, model: StackItemModel(horizontalAlignment: .leading)), (view: body, model: StackItemModel(horizontalAlignment: .leading)), (view: body2, model: StackItemModel(horizontalAlignment: .leading)), (view: link, model: StackItemModel(spacing: 16, horizontalAlignment: .leading))], axis: .vertical, spacing: 0)
verticalStack = Stack<StackModel>.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)), (view: headline, model: StackItemModel(horizontalAlignment: .leading)), (view: body, model: StackItemModel(horizontalAlignment: .leading)), (view: body2, model: StackItemModel(horizontalAlignment: .leading)), (view: twoLinkView, model: StackItemModel(spacing: 16, horizontalAlignment: .leading))], axis: .vertical, spacing: 0)
stack = Stack<StackModel>.createStack(with: [(view: verticalStack, model: StackItemModel(horizontalAlignment: .leading)), (view: rightImage, model: StackItemModel(verticalAlignment: .center))], axis: .horizontal)
stack = Stack<StackModel>.createStack(with: [(view: verticalStack, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .leading)),
(view: rightImage, model: StackItemModel(verticalAlignment: .center))],
axis: .horizontal)
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
@ -54,7 +57,7 @@ import Foundation
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListDeviceComplexLinkMediumModel else { return }
verticalStack.updateContainedMolecules(with: [model.eyebrow, model.headline, model.body, model.body2, model.link], delegateObject, additionalData)
verticalStack.updateContainedMolecules(with: [model.eyebrow, model.headline, model.body, model.body2, model.twoLinkView], delegateObject, additionalData)
rightImage.set(with: model.image, delegateObject, additionalData)
}

View File

@ -13,15 +13,15 @@ public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProto
public var headline: LabelModel?
public var body: LabelModel?
public var body2: LabelModel?
public var link: LinkModel
public var twoLinkView: TwoLinkViewModel
public var image: ImageViewModel
public init(eyebrow: LabelModel, headline: LabelModel, body: LabelModel, body2: LabelModel, link: LinkModel, image: ImageViewModel) {
public init(eyebrow: LabelModel, headline: LabelModel, body: LabelModel, body2: LabelModel, twoLinkView: TwoLinkViewModel, image: ImageViewModel) {
self.eyebrow = eyebrow
self.headline = headline
self.body = body
self.body2 = body2
self.link = link
self.twoLinkView = twoLinkView
self.image = image
super.init()
}
@ -32,7 +32,7 @@ public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProto
case headline
case body
case body2
case link
case twoLinkView
case image
}
@ -42,7 +42,7 @@ public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProto
headline = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .headline)
body = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body)
body2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body2)
link = try typeContainer.decode(LinkModel.self, forKey: .link)
twoLinkView = try typeContainer.decode(TwoLinkViewModel.self, forKey: .twoLinkView)
image = try typeContainer.decode(ImageViewModel.self, forKey: .image)
try super.init(from: decoder)
}
@ -55,7 +55,7 @@ public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProto
try container.encodeIfPresent(headline, forKey: .headline)
try container.encodeIfPresent(body, forKey: .body)
try container.encodeIfPresent(body2, forKey: .body2)
try container.encode(link, forKey: .link)
try container.encode(twoLinkView, forKey: .twoLinkView)
try container.encode(image, forKey: .image)
}
}

View File

@ -16,7 +16,7 @@ import Foundation
public let headline = Label.createLabelBoldTitleMedium(true)
public let body = Label.createLabelRegularBodySmall(true)
public let body2 = Label.createLabelRegularBodySmall(true)
public let link = Link()
public let twoLinkView = TwoLinkView()
public let rightImage = LoadImageView()
let verticalStack: Stack<StackModel>
public let stack: Stack<StackModel>
@ -26,11 +26,14 @@ import Foundation
//------------------------------------------------------
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
rightImage.addSizeConstraintsForAspectRatio = true
rightImage.imageView.contentMode = .scaleAspectFit
rightImage.heightAnchor.constraint(equalToConstant: 71.0).isActive = true
rightImage.widthAnchor.constraint(equalToConstant: 71.0).isActive = true
verticalStack = Stack<StackModel>.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)), (view: headline, model: StackItemModel(horizontalAlignment: .leading)), (view: body, model: StackItemModel(horizontalAlignment: .leading)), (view: body2, model: StackItemModel(horizontalAlignment: .leading)), (view: link, model: StackItemModel(spacing: 16, horizontalAlignment: .leading))], axis: .vertical, spacing: 0)
verticalStack = Stack<StackModel>.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)), (view: headline, model: StackItemModel(horizontalAlignment: .leading)), (view: body, model: StackItemModel(horizontalAlignment: .leading)), (view: body2, model: StackItemModel(horizontalAlignment: .leading)), (view: twoLinkView, model: StackItemModel(spacing: 16, horizontalAlignment: .leading))], axis: .vertical, spacing: 0)
stack = Stack<StackModel>.createStack(with: [(view: verticalStack, model: StackItemModel(horizontalAlignment: .leading)), (view: rightImage, model: StackItemModel(verticalAlignment: .center))], axis: .horizontal)
stack = Stack<StackModel>.createStack(with: [(view: verticalStack, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .leading)),
(view: rightImage, model: StackItemModel(verticalAlignment: .center))],
axis: .horizontal)
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
@ -54,7 +57,7 @@ import Foundation
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListDeviceComplexLinkSmallModel else { return }
verticalStack.updateContainedMolecules(with: [model.eyebrow, model.headline, model.body, model.body2, model.link], delegateObject, additionalData)
verticalStack.updateContainedMolecules(with: [model.eyebrow, model.headline, model.body, model.body2, model.twoLinkView], delegateObject, additionalData)
rightImage.set(with: model.image, delegateObject, additionalData)
}

View File

@ -13,15 +13,15 @@ public class ListDeviceComplexLinkSmallModel: ListItemModel, MoleculeModelProtoc
public var headline: LabelModel?
public var body: LabelModel?
public var body2: LabelModel?
public var link: LinkModel
public var twoLinkView: TwoLinkViewModel
public var image: ImageViewModel
public init(eyebrow: LabelModel, headline: LabelModel, body: LabelModel, body2: LabelModel, link: LinkModel, image: ImageViewModel) {
public init(eyebrow: LabelModel, headline: LabelModel, body: LabelModel, body2: LabelModel, twoLinkView: TwoLinkViewModel, image: ImageViewModel) {
self.eyebrow = eyebrow
self.headline = headline
self.body = body
self.body2 = body2
self.link = link
self.twoLinkView = twoLinkView
self.image = image
super.init()
}
@ -32,7 +32,7 @@ public class ListDeviceComplexLinkSmallModel: ListItemModel, MoleculeModelProtoc
case headline
case body
case body2
case link
case twoLinkView
case image
}
@ -42,7 +42,7 @@ public class ListDeviceComplexLinkSmallModel: ListItemModel, MoleculeModelProtoc
headline = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .headline)
body = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body)
body2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body2)
link = try typeContainer.decode(LinkModel.self, forKey: .link)
twoLinkView = try typeContainer.decode(TwoLinkViewModel.self, forKey: .twoLinkView)
image = try typeContainer.decode(ImageViewModel.self, forKey: .image)
try super.init(from: decoder)
}
@ -55,7 +55,7 @@ public class ListDeviceComplexLinkSmallModel: ListItemModel, MoleculeModelProtoc
try container.encodeIfPresent(headline, forKey: .headline)
try container.encodeIfPresent(body, forKey: .body)
try container.encodeIfPresent(body2, forKey: .body2)
try container.encode(link, forKey: .link)
try container.encode(twoLinkView, forKey: .twoLinkView)
try container.encode(image, forKey: .image)
}
}