parsing analytics data
This commit is contained in:
parent
b987bbc2c1
commit
78ca4984f1
@ -10,6 +10,8 @@ import Foundation
|
|||||||
|
|
||||||
|
|
||||||
@objcMembers public class CarouselItemModel: MoleculeCollectionItemModel, CarouselItemModelProtocol {
|
@objcMembers public class CarouselItemModel: MoleculeCollectionItemModel, CarouselItemModelProtocol {
|
||||||
|
public var analyticsData: [String : String]?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -28,6 +30,7 @@ import Foundation
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case peakingUI
|
case peakingUI
|
||||||
case peakingArrowColor
|
case peakingArrowColor
|
||||||
|
case analyticsData
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -38,6 +41,7 @@ import Foundation
|
|||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
peakingUI = try typeContainer.decodeIfPresent(Bool.self, forKey: .peakingUI)
|
peakingUI = try typeContainer.decodeIfPresent(Bool.self, forKey: .peakingUI)
|
||||||
peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor)
|
peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor)
|
||||||
|
analyticsData = try typeContainer.decodeIfPresent([String:String].self, forKey: .analyticsData)
|
||||||
try super.init(from: decoder)
|
try super.init(from: decoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,5 +50,6 @@ import Foundation
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encodeIfPresent(peakingUI, forKey: .peakingUI)
|
try container.encodeIfPresent(peakingUI, forKey: .peakingUI)
|
||||||
try container.encodeIfPresent(peakingArrowColor, forKey: .peakingArrowColor)
|
try container.encodeIfPresent(peakingArrowColor, forKey: .peakingArrowColor)
|
||||||
|
try container.encodeIfPresent(analyticsData, forKey: .analyticsData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,6 +163,9 @@ open class Carousel: View {
|
|||||||
pageIndex = carouselModel.index
|
pageIndex = carouselModel.index
|
||||||
pagingView?.currentIndex = carouselModel.index
|
pagingView?.currentIndex = carouselModel.index
|
||||||
collectionView.reloadData()
|
collectionView.reloadData()
|
||||||
|
|
||||||
|
// track analyticsData
|
||||||
|
trackSwipeActionAnalyticsforIndex(pageIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -297,6 +300,13 @@ open class Carousel: View {
|
|||||||
cell.accessibilityElementsHidden = true
|
cell.accessibilityElementsHidden = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func trackSwipeActionAnalyticsforIndex(_ index : Int){
|
||||||
|
guard let itemModel = molecules?[index],
|
||||||
|
let analyticsData = itemModel.analyticsData,
|
||||||
|
let viewcontrollerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return }
|
||||||
|
MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController:viewcontrollerObject, actionInformation: analyticsData, additionalData: analyticsData)
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Carousel: UICollectionViewDelegateFlowLayout {
|
extension Carousel: UICollectionViewDelegateFlowLayout {
|
||||||
@ -454,5 +464,7 @@ extension Carousel: UIScrollViewDelegate {
|
|||||||
// Cycle to other end if on buffer cell.
|
// Cycle to other end if on buffer cell.
|
||||||
pagingView?.currentIndex = pageIndex
|
pagingView?.currentIndex = pageIndex
|
||||||
showPeaking(true)
|
showPeaking(true)
|
||||||
|
// track analyticsData
|
||||||
|
trackSwipeActionAnalyticsforIndex(pageIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,4 +10,11 @@ import Foundation
|
|||||||
|
|
||||||
|
|
||||||
public protocol CarouselItemModelProtocol: ContainerModelProtocol {
|
public protocol CarouselItemModelProtocol: ContainerModelProtocol {
|
||||||
|
var analyticsData: [String:String]? { get }
|
||||||
|
}
|
||||||
|
public extension CarouselItemModelProtocol {
|
||||||
|
|
||||||
|
var analyticsData: [String:String]? {
|
||||||
|
get { return nil}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user