From 8406b788fb10b199cb8bbb63263d0beb2994f48f Mon Sep 17 00:00:00 2001 From: Vicente Veltri Date: Fri, 7 Feb 2020 18:06:15 -0300 Subject: [PATCH 1/2] Modified Discount Tracker Protocol --- .../MockData/DiscountTrackerData.swift | 2 +- Source/Commons/MLBusinessDiscountTrackerProtocol.swift | 2 +- Source/Components/Discount/MLBusinessDiscountBoxView.swift | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Example/Example_BusinessComponents/MockData/DiscountTrackerData.swift b/Example/Example_BusinessComponents/MockData/DiscountTrackerData.swift index 5a9aa110..9e3b0f70 100644 --- a/Example/Example_BusinessComponents/MockData/DiscountTrackerData.swift +++ b/Example/Example_BusinessComponents/MockData/DiscountTrackerData.swift @@ -18,7 +18,7 @@ class DiscountTrackerData: NSObject, MLBusinessDiscountTrackerProtocol { self.touchPointId = touchPointId } - func track(action: String, eventData: [[String : Any]]) { + func track(action: String, eventData: [String : Any]) { //Melidata tracking print("Melidata track path: \(basePath)/\(touchPointId)/\(action) with event data: \(eventData)") } diff --git a/Source/Commons/MLBusinessDiscountTrackerProtocol.swift b/Source/Commons/MLBusinessDiscountTrackerProtocol.swift index e496b580..415602fa 100644 --- a/Source/Commons/MLBusinessDiscountTrackerProtocol.swift +++ b/Source/Commons/MLBusinessDiscountTrackerProtocol.swift @@ -8,5 +8,5 @@ import Foundation @objc public protocol MLBusinessDiscountTrackerProtocol: NSObjectProtocol { - func track(action: String, eventData: [[String : Any]]) + func track(action: String, eventData: [String : Any]) } diff --git a/Source/Components/Discount/MLBusinessDiscountBoxView.swift b/Source/Components/Discount/MLBusinessDiscountBoxView.swift index 0fd3a225..313b39d9 100644 --- a/Source/Components/Discount/MLBusinessDiscountBoxView.swift +++ b/Source/Components/Discount/MLBusinessDiscountBoxView.swift @@ -115,14 +115,14 @@ private extension MLBusinessDiscountBoxView { } } - private func getEventDataFrom(discountItems: [MLBusinessSingleItemProtocol]) -> [[String : Any]] { + private func getEventDataFrom(discountItems: [MLBusinessSingleItemProtocol]) -> [String : Any] { var eventData = [[String : Any]]() for discountItem in discountItems { if let eventDataForItem = discountItem.eventDataForItem?() { eventData.append(eventDataForItem) } } - return eventData + return ["items" : eventData] } private func updateUI() { @@ -156,7 +156,7 @@ private extension MLBusinessDiscountBoxView { extension MLBusinessDiscountBoxView: MLBusinessUserInteractionProtocol { func didTap(item: MLBusinessSingleItemProtocol, index: Int, section: Int) { if let viewData = viewData, let trackingProvider = viewData.getDiscountTracker?(), let eventDataForItem = item.eventDataForItem?() { - trackingProvider.track(action: "tap", eventData: [eventDataForItem]) + trackingProvider.track(action: "tap", eventData: eventDataForItem) } tapAction?(index, item.deepLinkForItem(), item.trackIdForItem()) From 5fc568b055d4098d6d4ad430a1963a3b60f4c6f6 Mon Sep 17 00:00:00 2001 From: Vicente Veltri Date: Fri, 7 Feb 2020 18:07:34 -0300 Subject: [PATCH 2/2] Updated CHANGELOG. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f50b3974..5e848038 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # v1.8.1 🚀 1.8.1 🚀 - Restored tap tracking on Discount Box component. +- Modified MLBusinessDiscountTrackerProtocol. # v1.8 🚀 1.8 🚀