Merge branch 'bugfix/CXTDT-546581' into 'develop'
Digital PCT265 defect CXTDT-546581: Tabs page state tracking. ### Summary Add analyticsData map handling at the tabs level. ### Atomic Docs https://oneconfluence.verizon.com/display/MFD/Tabs ### JIRA Ticket https://onejira.verizon.com/browse/CXTDT-546581 Co-authored-by: Hedden, Kyle Matthew <kyle.hedden@verizonwireless.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1114
This commit is contained in:
commit
1e557e23e7
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol {
|
||||
MVMCoreUILoggingHandler.shared()?.defaultLogPageUpdate(forController: controller, from: ["analyticsData": analyticsData])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user