Merge branch 'feature/carousel_swipeActionTagging' into 'release/7_8_0'
Feature/carousel swipe action tagging See merge request BPHV_MIPS/mvm_core_ui!495
This commit is contained in:
commit
4ef9d4641e
@ -20,6 +20,7 @@ import Foundation
|
||||
|
||||
public var peakingUI: Bool?
|
||||
public var peakingArrowColor: Color?
|
||||
public var analyticsData: JSONValueDictionary?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Keys
|
||||
@ -28,6 +29,7 @@ import Foundation
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case peakingUI
|
||||
case peakingArrowColor
|
||||
case analyticsData
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -38,6 +40,7 @@ import Foundation
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
peakingUI = try typeContainer.decodeIfPresent(Bool.self, forKey: .peakingUI)
|
||||
peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor)
|
||||
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
@ -46,5 +49,6 @@ import Foundation
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(peakingUI, forKey: .peakingUI)
|
||||
try container.encodeIfPresent(peakingArrowColor, forKey: .peakingArrowColor)
|
||||
try container.encodeIfPresent(analyticsData, forKey: .analyticsData)
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,6 +297,12 @@ open class Carousel: View {
|
||||
cell.accessibilityElementsHidden = true
|
||||
}
|
||||
}
|
||||
|
||||
func trackSwipeActionAnalyticsforIndex(_ index : Int){
|
||||
guard let itemModel = molecules?[index],
|
||||
let viewControllerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return }
|
||||
MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: viewControllerObject, actionInformation: itemModel.toJSON(), additionalData: nil)
|
||||
}
|
||||
}
|
||||
|
||||
extension Carousel: UICollectionViewDelegateFlowLayout {
|
||||
@ -454,5 +460,7 @@ extension Carousel: UIScrollViewDelegate {
|
||||
// Cycle to other end if on buffer cell.
|
||||
pagingView?.currentIndex = pageIndex
|
||||
showPeaking(true)
|
||||
// track analyticsData
|
||||
trackSwipeActionAnalyticsforIndex(pageIndex)
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,4 +10,12 @@ import Foundation
|
||||
|
||||
|
||||
public protocol CarouselItemModelProtocol: ContainerModelProtocol {
|
||||
var analyticsData: JSONValueDictionary? { get set }
|
||||
}
|
||||
public extension CarouselItemModelProtocol {
|
||||
|
||||
var analyticsData: JSONValueDictionary? {
|
||||
get { return nil }
|
||||
set { analyticsData = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user