Digital PCT265 defect CXTDT-546581: Tabs page state tracking.
This commit is contained in:
parent
ee3fccd708
commit
7557e913a2
@ -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 = self.delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol {
|
||||
MVMCoreUILoggingHandler.shared()?.defaultLogPageUpdate(forController: controller, from: ["analyticsData": analyticsData])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user