From 78ca4984f1081c70ce8ca34ee04ef730ef16a886 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 16 Jun 2020 09:51:59 +0530 Subject: [PATCH 1/8] parsing analytics data --- .../Atomic/Molecules/Items/CarouselItemModel.swift | 5 +++++ MVMCoreUI/Atomic/Organisms/Carousel.swift | 12 ++++++++++++ .../ModelProtocols/CarouselItemModelProtocol.swift | 7 +++++++ 3 files changed, 24 insertions(+) diff --git a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift index 15a83552..9165cec7 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift @@ -10,6 +10,8 @@ import Foundation @objcMembers public class CarouselItemModel: MoleculeCollectionItemModel, CarouselItemModelProtocol { + public var analyticsData: [String : String]? + //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- @@ -28,6 +30,7 @@ import Foundation private enum CodingKeys: String, CodingKey { case peakingUI case peakingArrowColor + case analyticsData } //-------------------------------------------------- @@ -38,6 +41,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([String:String].self, forKey: .analyticsData) try super.init(from: decoder) } @@ -46,5 +50,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) } } diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index abc0e74b..baa62c88 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -163,6 +163,9 @@ open class Carousel: View { pageIndex = carouselModel.index pagingView?.currentIndex = carouselModel.index collectionView.reloadData() + + // track analyticsData + trackSwipeActionAnalyticsforIndex(pageIndex) } //-------------------------------------------------- @@ -297,6 +300,13 @@ open class Carousel: View { 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 { @@ -454,5 +464,7 @@ extension Carousel: UIScrollViewDelegate { // Cycle to other end if on buffer cell. pagingView?.currentIndex = pageIndex showPeaking(true) + // track analyticsData + trackSwipeActionAnalyticsforIndex(pageIndex) } } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift index 198cf80d..2d8444b5 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift @@ -10,4 +10,11 @@ import Foundation public protocol CarouselItemModelProtocol: ContainerModelProtocol { + var analyticsData: [String:String]? { get } +} +public extension CarouselItemModelProtocol { + + var analyticsData: [String:String]? { + get { return nil} + } } From 0e0de7a0fa58e75fb1c1c1a5378d4959578bb19b Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 16 Jun 2020 16:26:29 +0530 Subject: [PATCH 2/8] adobe tracking method added --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 6 ++++-- MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h | 3 +++ MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m | 4 ++++ MVMCoreUI/Utility/MVMCoreUIConstants.h | 4 ++++ MVMCoreUI/Utility/MVMCoreUIConstants.m | 4 ++++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index baa62c88..71f8c198 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -302,9 +302,11 @@ open class Carousel: View { } func trackSwipeActionAnalyticsforIndex(_ index : Int){ guard let itemModel = molecules?[index], - let analyticsData = itemModel.analyticsData, + var analyticsData = itemModel.analyticsData, let viewcontrollerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } - MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController:viewcontrollerObject, actionInformation: analyticsData, additionalData: analyticsData) + analyticsData[KeyAdobeTrackerPageType] = viewcontrollerObject.loadObject??.pageType + analyticsData["ClassName"] = String(describing: type(of: viewcontrollerObject)) + MVMCoreUILoggingHandler.shared()?.trackAdobeAnalytics(analyticsData) } } diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h index 9fec90f5..869bb098 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h @@ -20,6 +20,9 @@ NS_ASSUME_NONNULL_BEGIN - (void)defaultLogActionForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; - (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; +- (void)trackAdobeAnalytics:(nullable NSDictionary *)analyticsData; + + @end NS_ASSUME_NONNULL_END diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m index 0c694cce..4c99b1af 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m @@ -19,5 +19,9 @@ - (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { return nil; } +- (void)trackAnalyticsAction:(nullable NSDictionary *)analyticsData{ + +} + @end diff --git a/MVMCoreUI/Utility/MVMCoreUIConstants.h b/MVMCoreUI/Utility/MVMCoreUIConstants.h index 4c0a3553..c70f9e84 100644 --- a/MVMCoreUI/Utility/MVMCoreUIConstants.h +++ b/MVMCoreUI/Utility/MVMCoreUIConstants.h @@ -82,3 +82,7 @@ typedef NS_ENUM(NSInteger, CoreUIErrorCode) { #pragma mark - Apple Design Guidelines extern CGFloat const MinimumTappableArea; + +#pragma mark - Adobe Action Tracking + +extern NSString * const KeyAdobeTrackerPageType; diff --git a/MVMCoreUI/Utility/MVMCoreUIConstants.m b/MVMCoreUI/Utility/MVMCoreUIConstants.m index 5f5a9a45..34e3dc8c 100644 --- a/MVMCoreUI/Utility/MVMCoreUIConstants.m +++ b/MVMCoreUI/Utility/MVMCoreUIConstants.m @@ -74,3 +74,7 @@ NSString * const KeyHandScroll = @"hand_scroll"; #pragma mark - Apple Design Guidelines CGFloat const MinimumTappableArea = 44.0f; + +#pragma mark - Adobe Action Tracking + +NSString * const KeyAdobeTrackerPageType = @"vzwi.mvmapp.PageType"; From c5b4b5dfbf559e0d166842944b1b84b954cb6247 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 16 Jun 2020 20:53:21 +0530 Subject: [PATCH 3/8] removed new adobe method calling --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 21 +++++++++---------- .../OtherHandlers/MVMCoreUILoggingHandler.h | 3 --- .../OtherHandlers/MVMCoreUILoggingHandler.m | 4 ---- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 71f8c198..6dde83ce 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -18,7 +18,7 @@ public protocol CarouselPageControlProtocol { open class Carousel: View { - + public let collectionView: CollectionView = { let layout = UICollectionViewFlowLayout() layout.scrollDirection = .horizontal @@ -26,7 +26,7 @@ open class Carousel: View { layout.minimumLineSpacing = 0 return CollectionView(frame: .zero, collectionViewLayout: layout) }() - + /// The current index of the collection view. Includes dummy cells when looping. public var currentIndex = 0 @@ -85,7 +85,7 @@ open class Carousel: View { open func layoutCollection() { collectionView.collectionViewLayout.invalidateLayout() showPeaking(false) - + // Go to current cell. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking logic. The dispatch is a sad way to ensure the collection view is ready to be scrolled. guard let model = model as? CarouselModel, (model.paging == true || model.loop == true) else { return } @@ -145,19 +145,19 @@ open class Carousel: View { collectionView.layer.borderWidth = (carouselModel.border ?? false) ? 1 : 0 backgroundColor = .white (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumLineSpacing = carouselModel.spacing ?? 0 - + itemWidthPercent = carouselModel.itemWidthPercent / 100.0 if let alignment = carouselModel.itemAlignment { itemAlignment = alignment } - + if let height = carouselModel.height { collectionViewHeight?.constant = height } registerCells(with: carouselModel, delegateObject: delegateObject) prepareMolecules(with: carouselModel) - + setupPagingMolecule(carouselModel.pagingMolecule, delegateObject: delegateObject) pageIndex = carouselModel.index @@ -185,7 +185,7 @@ open class Carousel: View { if carouselModel?.loop ?? false && newMolecules.count > 1 { // Sets up the row data with buffer cells on each side (for illusion of endless scroll... also has one more buffer cell on each side in case we can peek that cell). loop = true - + molecules?.insert(contentsOf: newMolecules.suffix(2), at: 0) molecules?.append(contentsOf: newMolecules.prefix(2)) } @@ -306,8 +306,7 @@ open class Carousel: View { let viewcontrollerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } analyticsData[KeyAdobeTrackerPageType] = viewcontrollerObject.loadObject??.pageType analyticsData["ClassName"] = String(describing: type(of: viewcontrollerObject)) - MVMCoreUILoggingHandler.shared()?.trackAdobeAnalytics(analyticsData) - + MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: viewcontrollerObject, actionInformation: itemModel.toJSON(), additionalData: nil) } } @@ -386,7 +385,7 @@ extension Carousel: UIScrollViewDelegate { } open func scrollViewDidScroll(_ scrollView: UIScrollView) { - + // Adjust for looping if let model = model as? CarouselModel, model.loop == true { @@ -455,7 +454,7 @@ extension Carousel: UIScrollViewDelegate { } else { targetContentOffset.pointee = scrollView.contentOffset } - + // Cap the index. let lastCellIndex = collectionView(collectionView, numberOfItemsInSection: 0) - 1 goTo(min(max(cellToSwipeTo, 0), lastCellIndex), animated: true) diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h index 869bb098..9fec90f5 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h @@ -20,9 +20,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)defaultLogActionForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; - (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; -- (void)trackAdobeAnalytics:(nullable NSDictionary *)analyticsData; - - @end NS_ASSUME_NONNULL_END diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m index 4c99b1af..0c694cce 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m @@ -19,9 +19,5 @@ - (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { return nil; } -- (void)trackAnalyticsAction:(nullable NSDictionary *)analyticsData{ - -} - @end From b62bf0e00e9693527cc091012a82464d72f7292a Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 16 Jun 2020 20:56:33 +0530 Subject: [PATCH 4/8] removed spaces --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 6dde83ce..61a32ffc 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -18,7 +18,7 @@ public protocol CarouselPageControlProtocol { open class Carousel: View { - + public let collectionView: CollectionView = { let layout = UICollectionViewFlowLayout() layout.scrollDirection = .horizontal @@ -26,7 +26,7 @@ open class Carousel: View { layout.minimumLineSpacing = 0 return CollectionView(frame: .zero, collectionViewLayout: layout) }() - + /// The current index of the collection view. Includes dummy cells when looping. public var currentIndex = 0 @@ -85,7 +85,7 @@ open class Carousel: View { open func layoutCollection() { collectionView.collectionViewLayout.invalidateLayout() showPeaking(false) - + // Go to current cell. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking logic. The dispatch is a sad way to ensure the collection view is ready to be scrolled. guard let model = model as? CarouselModel, (model.paging == true || model.loop == true) else { return } @@ -145,19 +145,19 @@ open class Carousel: View { collectionView.layer.borderWidth = (carouselModel.border ?? false) ? 1 : 0 backgroundColor = .white (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumLineSpacing = carouselModel.spacing ?? 0 - + itemWidthPercent = carouselModel.itemWidthPercent / 100.0 if let alignment = carouselModel.itemAlignment { itemAlignment = alignment } - + if let height = carouselModel.height { collectionViewHeight?.constant = height } registerCells(with: carouselModel, delegateObject: delegateObject) prepareMolecules(with: carouselModel) - + setupPagingMolecule(carouselModel.pagingMolecule, delegateObject: delegateObject) pageIndex = carouselModel.index @@ -185,7 +185,7 @@ open class Carousel: View { if carouselModel?.loop ?? false && newMolecules.count > 1 { // Sets up the row data with buffer cells on each side (for illusion of endless scroll... also has one more buffer cell on each side in case we can peek that cell). loop = true - + molecules?.insert(contentsOf: newMolecules.suffix(2), at: 0) molecules?.append(contentsOf: newMolecules.prefix(2)) } @@ -385,7 +385,7 @@ extension Carousel: UIScrollViewDelegate { } open func scrollViewDidScroll(_ scrollView: UIScrollView) { - + // Adjust for looping if let model = model as? CarouselModel, model.loop == true { @@ -454,7 +454,7 @@ extension Carousel: UIScrollViewDelegate { } else { targetContentOffset.pointee = scrollView.contentOffset } - + // Cap the index. let lastCellIndex = collectionView(collectionView, numberOfItemsInSection: 0) - 1 goTo(min(max(cellToSwipeTo, 0), lastCellIndex), animated: true) From 82fbf6dc8edffdd24729dc5f4201e865fa613b01 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Thu, 18 Jun 2020 08:26:12 +0530 Subject: [PATCH 5/8] Scott feedback implemented --- MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift | 4 ++-- MVMCoreUI/Atomic/Organisms/Carousel.swift | 7 ++----- .../ModelProtocols/CarouselItemModelProtocol.swift | 7 ++++--- MVMCoreUI/Utility/MVMCoreUIConstants.h | 4 ---- MVMCoreUI/Utility/MVMCoreUIConstants.m | 4 ---- 5 files changed, 8 insertions(+), 18 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift index 9165cec7..5103b440 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class CarouselItemModel: MoleculeCollectionItemModel, CarouselItemModelProtocol { - public var analyticsData: [String : String]? + public var analyticsData: JSONValueDictionary? //-------------------------------------------------- // MARK: - Properties @@ -41,7 +41,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([String:String].self, forKey: .analyticsData) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) try super.init(from: decoder) } diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 61a32ffc..40ed5e63 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -302,11 +302,8 @@ open class Carousel: View { } func trackSwipeActionAnalyticsforIndex(_ index : Int){ guard let itemModel = molecules?[index], - var analyticsData = itemModel.analyticsData, - let viewcontrollerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } - analyticsData[KeyAdobeTrackerPageType] = viewcontrollerObject.loadObject??.pageType - analyticsData["ClassName"] = String(describing: type(of: viewcontrollerObject)) - MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: viewcontrollerObject, actionInformation: itemModel.toJSON(), additionalData: nil) + let viewControllerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } + MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: viewControllerObject, actionInformation: itemModel.toJSON(), additionalData: nil) } } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift index 2d8444b5..3501ce42 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift @@ -10,11 +10,12 @@ import Foundation public protocol CarouselItemModelProtocol: ContainerModelProtocol { - var analyticsData: [String:String]? { get } + var analyticsData: JSONValueDictionary? { get set } } public extension CarouselItemModelProtocol { - var analyticsData: [String:String]? { - get { return nil} + var analyticsData: JSONValueDictionary? { + get { return nil } + set{ analyticsData = newValue } } } diff --git a/MVMCoreUI/Utility/MVMCoreUIConstants.h b/MVMCoreUI/Utility/MVMCoreUIConstants.h index c70f9e84..4c0a3553 100644 --- a/MVMCoreUI/Utility/MVMCoreUIConstants.h +++ b/MVMCoreUI/Utility/MVMCoreUIConstants.h @@ -82,7 +82,3 @@ typedef NS_ENUM(NSInteger, CoreUIErrorCode) { #pragma mark - Apple Design Guidelines extern CGFloat const MinimumTappableArea; - -#pragma mark - Adobe Action Tracking - -extern NSString * const KeyAdobeTrackerPageType; diff --git a/MVMCoreUI/Utility/MVMCoreUIConstants.m b/MVMCoreUI/Utility/MVMCoreUIConstants.m index 34e3dc8c..5f5a9a45 100644 --- a/MVMCoreUI/Utility/MVMCoreUIConstants.m +++ b/MVMCoreUI/Utility/MVMCoreUIConstants.m @@ -74,7 +74,3 @@ NSString * const KeyHandScroll = @"hand_scroll"; #pragma mark - Apple Design Guidelines CGFloat const MinimumTappableArea = 44.0f; - -#pragma mark - Adobe Action Tracking - -NSString * const KeyAdobeTrackerPageType = @"vzwi.mvmapp.PageType"; From b68e0dd80c6ecbf8c5de149551c9af1b8c38b087 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Thu, 18 Jun 2020 16:01:08 +0530 Subject: [PATCH 6/8] duplicate tracking fixed --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 40ed5e63..c6166d39 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -68,6 +68,8 @@ open class Carousel: View { private var size: CGFloat? + private var isTrackedAnalytics: Bool = false + // Updates the model and index. public func updateModelIndex() { (model as? CarouselModel)?.index = pageIndex @@ -165,7 +167,10 @@ open class Carousel: View { collectionView.reloadData() // track analyticsData + if(!isTrackedAnalytics){ trackSwipeActionAnalyticsforIndex(pageIndex) + isTrackedAnalytics = true + } } //-------------------------------------------------- From 57c3ed3c12b2a1d27dc5a753b89e4f6a77e06926 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Fri, 19 Jun 2020 19:13:25 +0530 Subject: [PATCH 7/8] spaces removed --- MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift | 3 +-- MVMCoreUI/Atomic/Organisms/Carousel.swift | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift index 5103b440..1b9ce0dc 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift @@ -10,8 +10,6 @@ import Foundation @objcMembers public class CarouselItemModel: MoleculeCollectionItemModel, CarouselItemModelProtocol { - public var analyticsData: JSONValueDictionary? - //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- @@ -22,6 +20,7 @@ import Foundation public var peakingUI: Bool? public var peakingArrowColor: Color? + public var analyticsData: JSONValueDictionary? //-------------------------------------------------- // MARK: - Keys diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index c6166d39..740cdb9a 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -165,7 +165,6 @@ open class Carousel: View { pageIndex = carouselModel.index pagingView?.currentIndex = carouselModel.index collectionView.reloadData() - // track analyticsData if(!isTrackedAnalytics){ trackSwipeActionAnalyticsforIndex(pageIndex) @@ -305,9 +304,10 @@ open class Carousel: View { cell.accessibilityElementsHidden = true } } + func trackSwipeActionAnalyticsforIndex(_ index : Int){ guard let itemModel = molecules?[index], - let viewControllerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } + let viewControllerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: viewControllerObject, actionInformation: itemModel.toJSON(), additionalData: nil) } } From 7c48a25832208ab5d12f3ae190f1670a5a258617 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Mon, 22 Jun 2020 22:13:32 +0530 Subject: [PATCH 8/8] removed logic for tracking for first time --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 7 ------- .../ModelProtocols/CarouselItemModelProtocol.swift | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 740cdb9a..808c370e 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -68,8 +68,6 @@ open class Carousel: View { private var size: CGFloat? - private var isTrackedAnalytics: Bool = false - // Updates the model and index. public func updateModelIndex() { (model as? CarouselModel)?.index = pageIndex @@ -165,11 +163,6 @@ open class Carousel: View { pageIndex = carouselModel.index pagingView?.currentIndex = carouselModel.index collectionView.reloadData() - // track analyticsData - if(!isTrackedAnalytics){ - trackSwipeActionAnalyticsforIndex(pageIndex) - isTrackedAnalytics = true - } } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift index 3501ce42..c2ade02d 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift @@ -16,6 +16,6 @@ public extension CarouselItemModelProtocol { var analyticsData: JSONValueDictionary? { get { return nil } - set{ analyticsData = newValue } + set { analyticsData = newValue } } }