refactor to add resetAttributeStyle

This commit is contained in:
Nandhini Rajendran 2022-12-09 12:34:06 +05:30
parent 2026d9171c
commit a72f3cc3c1

View File

@ -241,18 +241,7 @@ public typealias ActionBlock = () -> ()
case left
}
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject? = nil, _ additionalData: [AnyHashable: Any]? = nil) {
clauses = []
text = nil
attributedText = nil
originalAttributedString = nil
shouldMaskWhileRecording = model.shouldMaskRecordedView ?? false
guard let labelModel = model as? LabelModel else { return }
text = labelModel.text
@objc public func resetAttributeStyle() {
/*
* This is to address a reuse issue with iOS 13 and up.
* Even if you set text & attributedText to nil, the moment you set text with a value,
@ -274,6 +263,21 @@ public typealias ActionBlock = () -> ()
self.attributedText = attributedString
}
}
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject? = nil, _ additionalData: [AnyHashable: Any]? = nil) {
clauses = []
text = nil
attributedText = nil
originalAttributedString = nil
shouldMaskWhileRecording = model.shouldMaskRecordedView ?? false
guard let labelModel = model as? LabelModel else { return }
text = labelModel.text
resetAttributeStyle()
hero = labelModel.hero
Label.setLabel(self, withHTML: labelModel.html)
@ -786,10 +790,8 @@ public typealias ActionBlock = () -> ()
extension Label {
public func reset() {
//Weird issue. when cell reuse. text style is not getting reset.Fix for:CXTDT-344190
//We need to reset the attribute text first and then text. Its working fine
attributedText = nil
text = nil
attributedText = nil
hero = nil
textAlignment = .left
originalAttributedString = nil