Digital ACT191 defect FeaturedProducts - Fix for bold when the font isn't supported, and for bg image forcing full image size.

This commit is contained in:
Scott Pfeil 2024-09-19 14:35:33 -04:00
parent 1b5ca94988
commit 47e63e0c8b
2 changed files with 11 additions and 4 deletions

View File

@ -94,29 +94,34 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
public func eyebrowModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.EyebrowModel? { public func eyebrowModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.EyebrowModel? {
guard let eyebrow else { return nil } guard let eyebrow else { return nil }
let attrs = eyebrow.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) let attrs = eyebrow.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData)
var isBold: Bool = true
do { do {
if let style = eyebrow.fontStyle { if let style = eyebrow.fontStyle {
isBold = style.isBold()
return .init(text: eyebrow.text, return .init(text: eyebrow.text,
textColor: eyebrowColor, textColor: eyebrowColor,
textAttributes: attrs, isBold: style.isBold(), textAttributes: attrs,
isBold: isBold,
standardStyle: try style.vdsSubsetStyle()) standardStyle: try style.vdsSubsetStyle())
} }
} catch MVMCoreError.errorObject(let object) { } catch MVMCoreError.errorObject(let object) {
MVMCoreLoggingHandler.shared()?.addError(toLog: object) MVMCoreLoggingHandler.shared()?.addError(toLog: object)
} catch { } } catch { }
return .init(text: eyebrow.text, textColor: eyebrowColor, textAttributes: attrs) return .init(text: eyebrow.text, textColor: eyebrowColor, textAttributes: attrs, isBold: isBold)
} }
public func titleModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.TitleModel? { public func titleModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.TitleModel? {
guard let title else { return nil } guard let title else { return nil }
let attrs = title.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) let attrs = title.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData)
var isBold: Bool = true
do { do {
if let style = title.fontStyle { if let style = title.fontStyle {
isBold = style.isBold()
return .init(text: title.text, return .init(text: title.text,
textColor: titleColor, textColor: titleColor,
textAttributes: attrs, textAttributes: attrs,
isBold: isBold,
standardStyle: try style.vdsSubsetStyle()) standardStyle: try style.vdsSubsetStyle())
} }
@ -124,7 +129,7 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
MVMCoreLoggingHandler.shared()?.addError(toLog: object) MVMCoreLoggingHandler.shared()?.addError(toLog: object)
} catch { } } catch { }
return .init(text: title.text, textColor: titleColor, textAttributes: attrs) return .init(text: title.text, textColor: titleColor, textAttributes: attrs, isBold: isBold)
} }
public func subTitleModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.SubTitleModel? { public func subTitleModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.SubTitleModel? {

View File

@ -16,6 +16,8 @@ open class BGImageMolecule: MoleculeContainer {
super.setupView() super.setupView()
insertSubview(image, at: 0) insertSubview(image, at: 0)
NSLayoutConstraint.constraintPinSubview(toSuperview: image) NSLayoutConstraint.constraintPinSubview(toSuperview: image)
image.setContentCompressionResistancePriority(.defaultLow, for: .vertical)
image.imageView.setContentCompressionResistancePriority(.defaultLow, for: .vertical)
} }
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {