From af2360c13a1b12f071adcd3d9d76cfed91e494ae Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Tue, 8 Nov 2022 18:41:27 +0530 Subject: [PATCH 1/2] fix for CXTDT_344190 --- MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index 9e5881a4..ec94149b 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -757,8 +757,10 @@ public typealias ActionBlock = () -> () extension Label { public func reset() { - text = nil + //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 hero = nil textAlignment = .left originalAttributedString = nil From a72f3cc3c1542a2d0fb2d2994b0f32d50d1309f9 Mon Sep 17 00:00:00 2001 From: Nandhini Rajendran Date: Fri, 9 Dec 2022 12:34:06 +0530 Subject: [PATCH 2/2] refactor to add resetAttributeStyle --- .../Atomic/Atoms/Views/Label/Label.swift | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index 225d39c1..059c5637 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -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