Code changes as per condensed code feature branch.

This commit is contained in:
Subhankar Acharya 2020-02-24 22:04:28 +05:30
parent 47603e7a59
commit 2f94f3435a

View File

@ -36,24 +36,15 @@ import Foundation
return
}
stack.translatesAutoresizingMaskIntoConstraints = false
stack.stackItems = [StackItem(andContain: eyebrow),StackItem(andContain: headline),StackItem(andContain: subHeadline),StackItem(andContain: body),StackItem(andContain: link)]
stack.stackItems = [StackItem(andContain: eyebrow),
StackItem(andContain: headline),
StackItem(andContain: body),
StackItem(andContain: link)]
contentView.addSubview(stack)
containerHelper.constrainView(stack)
}
//----------------------------------------------------
// MARK: - Molecule
//------------------------------------------------------
override open func reset() {
super.reset()
stack.reset()
eyebrow.styleB3(true)
headline.styleH3(true)
subHeadline.styleB1(true)
body.styleB2(true)
addMolecule(stack)
}
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){
super.setWithModel(model, delegateObject, additionalData)
guard let model = model as? ListOneColumnFullWidthTextAllTextAndLinksModel else { return}
eyebrow.setWithModel(model.eyebrow, delegateObject, additionalData)
@ -61,14 +52,25 @@ import Foundation
subHeadline.setWithModel(model.subHeadline, delegateObject, additionalData)
body.setWithModel(model.body, delegateObject, additionalData)
link.setWithModel(model.link, delegateObject, additionalData)
let stackModel = StackModel(molecules: [StackItemModel(gone: !eyebrow.hasText),StackItemModel(gone: !headline.hasText),StackItemModel(gone: !subHeadline.hasText),StackItemModel(gone: !body.hasText),StackItemModel(gone: (link.titleLabel?.text?.count ?? 0) == 0)])
let stackModel = StackModel(molecules: [StackItemModel(gone: !eyebrow.hasText),
StackItemModel(gone: !headline.hasText),
StackItemModel(gone: !body.hasText),
StackItemModel(gone: (link.titleLabel?.text?.count ?? 0) == 0)])
stack.model = stackModel
stackModel.spacing = 2
stack.restack()
}
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat?{
return 90
}
open override func reset() {
super.reset()
stack.reset()
eyebrow.styleB3(true)
headline.styleH3(true)
subHeadline.styleB1(true)
body.styleB2(true)
}
}