From 7557e913a21b8760271705551ed6aebec7d67a1b Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Fri, 17 May 2024 14:42:35 -0400 Subject: [PATCH 1/2] Digital PCT265 defect CXTDT-546581: Tabs page state tracking. --- .../Molecules/HorizontalCombinationViews/TabsModel.swift | 6 +++++- MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift index a7acadf6..16416933 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift @@ -112,6 +112,7 @@ open class TabsModel: MoleculeModelProtocol { open class TabItemModel: Codable { open var label: LabelModel open var action: ActionModelProtocol? + public var analyticsData: JSONValueDictionary? public init(label: LabelModel) { self.label = label @@ -120,6 +121,7 @@ open class TabItemModel: Codable { private enum CodingKeys: String, CodingKey { case label case action + case analyticsData } open func setDefaults() { @@ -138,12 +140,14 @@ open class TabItemModel: Codable { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) label = try typeContainer.decode(LabelModel.self, forKey: .label) action = try typeContainer.decodeModelIfPresent(codingKey: .action) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) setDefaults() } - + open func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeModel(label, forKey: .label) try container.encodeModelIfPresent(action, forKey: .action) + try container.encodeIfPresent(analyticsData, forKey: .analyticsData) } } diff --git a/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift index 631bf50f..3bb8ce43 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift @@ -66,6 +66,11 @@ extension TabsTableViewCell: TabsDelegate { MVMCoreUIActionHandler.performActionUnstructured(with: action, sourceModel: model.tabs, additionalData: nil, delegateObject: delegateObject) } MVMCoreUIActionHandler.performActionUnstructured(with: SwapMoleculesActionModel(index < previousTabIndex ? .left : .right), sourceModel: model, additionalData: nil, delegateObject: delegateObject) + + if let analyticsData = try? model.tabs.tabs[index].analyticsData?.toJSONAny(), + let controller = self.delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol { + MVMCoreUILoggingHandler.shared()?.defaultLogPageUpdate(forController: controller, from: ["analyticsData": analyticsData]) + } } } From 8e70aba1573780f9ec3646fbef70e9a43fc84271 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Mon, 20 May 2024 11:54:01 -0400 Subject: [PATCH 2/2] Digital PCT265 defect CXTDT-54658: Code review. --- MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift index 3bb8ce43..c97c0ed1 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift @@ -68,7 +68,7 @@ extension TabsTableViewCell: TabsDelegate { MVMCoreUIActionHandler.performActionUnstructured(with: SwapMoleculesActionModel(index < previousTabIndex ? .left : .right), sourceModel: model, additionalData: nil, delegateObject: delegateObject) if let analyticsData = try? model.tabs.tabs[index].analyticsData?.toJSONAny(), - let controller = self.delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol { + let controller = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol { MVMCoreUILoggingHandler.shared()?.defaultLogPageUpdate(forController: controller, from: ["analyticsData": analyticsData]) } }