From 78ca4984f1081c70ce8ca34ee04ef730ef16a886 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 16 Jun 2020 09:51:59 +0530 Subject: [PATCH 01/11] 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 02/11] 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 03/11] 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 04/11] 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 05/11] 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 06/11] 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 07/11] 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 e7ce1daa3be8c1e68e0a7372ff302204cfd78b99 Mon Sep 17 00:00:00 2001 From: "Khan, Arshad" Date: Sat, 20 Jun 2020 16:27:18 +0530 Subject: [PATCH 08/11] empty multi progress bar fix. If data usage is empty, then empty grey colour bar should be shown. --- MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift b/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift index 2671fc0d..28cb5bf8 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift @@ -63,7 +63,7 @@ import UIKit addSubview(stack) NSLayoutConstraint.constraintPinSubview(toSuperview: stack) stack.backgroundColor = backgroundColor - stack.contentView.backgroundColor = .mvmWhite + stack.contentView.backgroundColor = .mvmCoolGray3 stack.model = StackModel(molecules: [], axis: .horizontal, spacing: 2) stack.stackModel?.horizontalAlignment = .leading From 206017443e4ba3b6c857f9dc886234b9412fb142 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 22 Jun 2020 10:21:27 -0400 Subject: [PATCH 09/11] back button change --- .../NavigationBar/NavigationItemModel.swift | 6 +++--- .../NavigationItemModelProtocol.swift | 2 +- MVMCoreUI/Containers/NavigationController.swift | 16 +++++++++------- .../MVMCoreUISplitViewController+Extension.swift | 14 ++++++++------ 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift index c0ee897c..d7d677fa 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift @@ -18,7 +18,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt public var backgroundColor: Color? public var tintColor: Color public var line: LineModel? - public var alwaysShowBackButton = false + public var alwaysShowBackButton: Bool? public var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? = NavigationImageButtonModel(with: "nav_back", action: ActionBackModel()) public var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? public var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? @@ -52,7 +52,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .white) tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) ?? LineModel(type: .standard) - alwaysShowBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysShowBackButton) ?? false + alwaysShowBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysShowBackButton) if let backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol) = try typeContainer.decodeModelIfPresent(codingKey: .backButton) { self.backButton = backButton } @@ -68,7 +68,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encode(tintColor, forKey: .tintColor) try container.encodeIfPresent(line, forKey: .line) - try container.encode(alwaysShowBackButton, forKey: .alwaysShowBackButton) + try container.encodeIfPresent(alwaysShowBackButton, forKey: .alwaysShowBackButton) try container.encodeModelIfPresent(backButton, forKey: .backButton) try container.encodeModelsIfPresent(additionalLeftButtons, forKey: .additionalLeftButtons) try container.encodeModelsIfPresent(additionalRightButtons, forKey: .additionalRightButtons) diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift index 30db2aa6..084509e0 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift @@ -14,7 +14,7 @@ public protocol NavigationItemModelProtocol { var backgroundColor: Color? { get set } var tintColor: Color { get set } var line: LineModel? { get set } - var alwaysShowBackButton: Bool { get set } + var alwaysShowBackButton: Bool? { get set } var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? { get set } var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } diff --git a/MVMCoreUI/Containers/NavigationController.swift b/MVMCoreUI/Containers/NavigationController.swift index 12d70634..2803792f 100644 --- a/MVMCoreUI/Containers/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController.swift @@ -47,13 +47,15 @@ import UIKit public static func setNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject var leftItems: [UIBarButtonItem] = [] - if let backButtonModel = navigationItemModel.backButton, - navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton { - leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) - } - if let leftItemModels = navigationItemModel.additionalLeftButtons { - for item in leftItemModels { - leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + if navigationItemModel.alwaysShowBackButton != false { + if let backButtonModel = navigationItemModel.backButton, + navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton ?? false { + leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + } + if let leftItemModels = navigationItemModel.additionalLeftButtons { + for item in leftItemModels { + leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + } } } viewController.navigationItem.leftBarButtonItems = leftItems.count > 0 ? leftItems : nil diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index bfbe19ac..e62efa29 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -48,13 +48,15 @@ public extension MVMCoreUISplitViewController { let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject // Add back button first. - if let backButtonModel = navigationItemModel?.backButton { - if navigationController.viewControllers.count > 1 || navigationItemModel!.alwaysShowBackButton { - leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + if navigationItemModel?.alwaysShowBackButton != false { + if let backButtonModel = navigationItemModel?.backButton { + if navigationController.viewControllers.count > 1 || navigationItemModel!.alwaysShowBackButton ?? false { + leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + } + } else if let backButton = backButton, + navigationController.viewControllers.count > 1 { + leftItems.append(backButton) } - } else if let backButton = backButton, - navigationController.viewControllers.count > 1 { - leftItems.append(backButton) } // Add the panel button after the back button. From b3a9fcb1ab816e822ca154d6e65ece63f30b52e9 Mon Sep 17 00:00:00 2001 From: "Khan, Arshad" Date: Mon, 22 Jun 2020 21:47:23 +0530 Subject: [PATCH 10/11] added review feedback --- MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift b/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift index 28cb5bf8..945229c7 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift @@ -63,7 +63,7 @@ import UIKit addSubview(stack) NSLayoutConstraint.constraintPinSubview(toSuperview: stack) stack.backgroundColor = backgroundColor - stack.contentView.backgroundColor = .mvmCoolGray3 + stack.contentView.backgroundColor = .clear stack.model = StackModel(molecules: [], axis: .horizontal, spacing: 2) stack.stackModel?.horizontalAlignment = .leading @@ -111,7 +111,6 @@ import UIKit roundedCorners = multiProgressModel.roundedCorners ?? false thicknessConstraint?.constant = multiProgressModel.thickness ?? defaultHeight - stack.model?.backgroundColor = model.backgroundColor set(with: multiProgressModel.progressList, delegateObject, additionalData) } From 7c48a25832208ab5d12f3ae190f1670a5a258617 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Mon, 22 Jun 2020 22:13:32 +0530 Subject: [PATCH 11/11] 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 } } }