From 78ca4984f1081c70ce8ca34ee04ef730ef16a886 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 16 Jun 2020 09:51:59 +0530 Subject: [PATCH 01/22] 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/22] 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/22] 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/22] 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/22] 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/22] 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/22] 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/22] 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/22] 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/22] 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/22] 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 } } } From b1c1734a19890e05d67ae2367c8054ba0679f0d3 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 24 Jun 2020 12:57:04 +0530 Subject: [PATCH 12/22] 21518(iOS - Headers - H2 - Link) initial commit. Added model and molecule class files. --- MVMCoreUI.xcodeproj/project.pbxproj | 12 +++- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + .../Headers/H2/HeadersH2Link.swift | 59 ++++++++++++++++ .../Headers/H2/HeadersH2LinkModel.swift | 68 +++++++++++++++++++ 4 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 6c80ccd2..43982c8b 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -211,6 +211,8 @@ AA633B3324989ED500731E80 /* HeadersH2PricingTwoRows.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */; }; AA69AAF62445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA69AAF52445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift */; }; AA69AAF82445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA69AAF72445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift */; }; + AA71AD3E24A32FCE00ACA76F /* HeadersH2LinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA71AD3D24A32FCE00ACA76F /* HeadersH2LinkModel.swift */; }; + AA71AD4024A32FE700ACA76F /* HeadersH2Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA71AD3F24A32FE700ACA76F /* HeadersH2Link.swift */; }; AA7F32AB246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA7F32AA246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift */; }; AA7F32AD246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA7F32AC246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift */; }; AA85236C244435A20059CC1E /* RadioSwatchCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA85236B244435A20059CC1E /* RadioSwatchCollectionViewCell.swift */; }; @@ -665,6 +667,8 @@ AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2PricingTwoRows.swift; sourceTree = ""; }; AA69AAF52445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxBodyText.swift; sourceTree = ""; }; AA69AAF72445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxBodyTextModel.swift; sourceTree = ""; }; + AA71AD3D24A32FCE00ACA76F /* HeadersH2LinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2LinkModel.swift; sourceTree = ""; }; + AA71AD3F24A32FE700ACA76F /* HeadersH2Link.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2Link.swift; sourceTree = ""; }; AA7F32AA246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAllTextAndLinksModel.swift; sourceTree = ""; }; AA7F32AC246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAllTextAndLinks.swift; sourceTree = ""; }; AA85236B244435A20059CC1E /* RadioSwatchCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchCollectionViewCell.swift; sourceTree = ""; }; @@ -1502,7 +1506,7 @@ children = ( AA104AC824472DC7004D2810 /* HeadersH1ButtonModel.swift */, AA104AC624472DB0004D2810 /* HeadersH1Button.swift */, - AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */, + AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */, AA104AD9244734DB004D2810 /* HeadersH1LandingPageHeader.swift */, ); path = H1; @@ -1517,8 +1521,10 @@ AA26850B244840AE00CE34CC /* HeadersH2TinyButton.swift */, AA104B1B24474A76004D2810 /* HeadersH2ButtonsModel.swift */, AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */, - AA633B3024989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift */, + AA633B3024989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift */, AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */, + AA71AD3D24A32FCE00ACA76F /* HeadersH2LinkModel.swift */, + AA71AD3F24A32FE700ACA76F /* HeadersH2Link.swift */, ); path = H2; sourceTree = ""; @@ -2143,6 +2149,7 @@ 01004F3022721C3800991ECC /* RadioButton.swift in Sources */, D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */, D236E5B7242007C500C38625 /* MVMControllerModelProtocol.swift in Sources */, + AA71AD4024A32FE700ACA76F /* HeadersH2Link.swift in Sources */, D29DF11721E6805F003B2FB9 /* UIColor+MFConvenience.m in Sources */, D2B18B7F2360913400A9AEDC /* Control.swift in Sources */, D253BB8A24574CC5002DE544 /* StackModel.swift in Sources */, @@ -2398,6 +2405,7 @@ 8D070BB2241B56AD0099AC56 /* ListRightVariableTotalData.swift in Sources */, D264FAA5243F66A500D98315 /* CollectionTemplateItemProtocol.swift in Sources */, D29DF11D21E684A9003B2FB9 /* MVMCoreUISplitViewController.m in Sources */, + AA71AD3E24A32FCE00ACA76F /* HeadersH2LinkModel.swift in Sources */, 8DD1E36E243B3CFB00D8F2DF /* ListThreeColumnInternationalDataModel.swift in Sources */, D243859923A16B1800332775 /* Container.swift in Sources */, D2C521A923EDE79E00CA2634 /* ViewController.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index c6bb77bb..b5209bfb 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -210,6 +210,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2TinyButton.self, viewModelClass: HeadersH2TinyButtonModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Buttons.self, viewModelClass: HeadersH2ButtonsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2PricingTwoRows.self, viewModelClass: HeadersH2PricingTwoRowsModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Link.self, viewModelClass: HeadersH2LinkModel.self) // Device Items MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexButtonMedium.self, viewModelClass: ListDeviceComplexButtonMediumModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift new file mode 100644 index 00000000..4b0334e7 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift @@ -0,0 +1,59 @@ +// +// HeadersH2Link.swift +// MVMCoreUI +// +// Created by Lekshmi S on 24/06/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class HeadersH2Link: HeaderView { + //-------------------------------------------------- + // MARK: - Outlets + //-------------------------------------------------- + public let headlineBody = HeadlineBody() + public let link = Link() + public let stack: Stack + + //------------------------------------------------------- + // MARK: - Initializers + //------------------------------------------------------- + public override init(frame: CGRect) { + stack = Stack.createStack(with: [headlineBody, link], spacing: PaddingHorizontalBetweenRelatedItems) + super.init(frame: frame) + } + + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //------------------------------------------------------- + // MARK: - Lifecycle + //------------------------------------------------------- + open override func setupView() { + super.setupView() + headlineBody.stylePageHeader() + addMolecule(stack) + stack.restack() + } + + //---------------------------------------------------- + // MARK: - Molecule + //------------------------------------------------------ + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? HeadersH2LinkModel else { return } + headlineBody.set(with: model.headlineBody, delegateObject, additionalData) + link.set(with: model.link, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 121 + } + + open override func reset() { + super.reset() + headlineBody.stylePageHeader() + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift new file mode 100644 index 00000000..5793eedf --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift @@ -0,0 +1,68 @@ +// +// HeadersH2LinkModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 24/06/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class HeadersH2LinkModel: HeaderModel, MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public static var identifier: String = "headerH2Link" + public var headlineBody: HeadlineBodyModel + public var link: LinkModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + + public init(headlineBody: HeadlineBodyModel, link: LinkModel) { + self.headlineBody = headlineBody + self.link = link + super.init() + } + + //-------------------------------------------------- + // MARK: - Methods + //-------------------------------------------------- + + public override func setDefaults() { + super.setDefaults() + topPadding = PaddingDefaultVerticalSpacing3 + bottomPadding = PaddingDefaultVerticalSpacing3 + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + + private enum CodingKeys: String, CodingKey { + case moleculeName + case headlineBody + case link + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) + link = try typeContainer.decode(LinkModel.self, forKey: .link) + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(headlineBody, forKey: .headlineBody) + try container.encode(link, forKey: .link) + } +} From e2f2fb428681eaf602bb926d619bbb75b4e3d67e Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 25 Jun 2020 10:01:19 -0400 Subject: [PATCH 13/22] New right variable Toggle fixes --- MVMCoreUI.xcodeproj/project.pbxproj | 12 +- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 10 +- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + ...stRightVariableToggleAllTextAndLinks.swift | 112 ++++++++++++++++++ ...htVariableToggleAllTextAndLinksModel.swift | 58 +++++++++ 5 files changed, 190 insertions(+), 3 deletions(-) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 6c80ccd2..676d554f 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -290,6 +290,8 @@ D224799B231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D224799A231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift */; }; D22D8393241C27B100D3DF69 /* TemplateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22D8392241C27B100D3DF69 /* TemplateModel.swift */; }; D22D8395241FB41200D3DF69 /* UIStackView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22D8394241FB41200D3DF69 /* UIStackView+Extension.swift */; }; + D2351C7A24A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2351C7924A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift */; }; + D2351C7C24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2351C7B24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift */; }; D236E5B4241FEB1000C38625 /* ListTwoColumnPriceDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = D236E5B2241FEB1000C38625 /* ListTwoColumnPriceDescription.swift */; }; D236E5B5241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D236E5B3241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift */; }; D236E5B7242007C500C38625 /* MVMControllerModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D236E5B6242007C500C38625 /* MVMControllerModelProtocol.swift */; }; @@ -744,6 +746,8 @@ D224799A231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccordionMoleculeTableViewCell.swift; sourceTree = ""; }; D22D8392241C27B100D3DF69 /* TemplateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateModel.swift; sourceTree = ""; }; D22D8394241FB41200D3DF69 /* UIStackView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+Extension.swift"; sourceTree = ""; }; + D2351C7924A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableToggleAllTextAndLinksModel.swift; sourceTree = ""; }; + D2351C7B24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableToggleAllTextAndLinks.swift; sourceTree = ""; }; D236E5B2241FEB1000C38625 /* ListTwoColumnPriceDescription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDescription.swift; sourceTree = ""; }; D236E5B3241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDescriptionModel.swift; sourceTree = ""; }; D236E5B6242007C500C38625 /* MVMControllerModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMControllerModelProtocol.swift; sourceTree = ""; }; @@ -1152,6 +1156,8 @@ 8D8067D22444473A00203BE8 /* ListRightVariablePriceChangeAllTextAndLinks.swift */, C7F8012223E846C300396FBD /* ListRVWheelModel.swift */, C7F8012023E8303200396FBD /* ListRVWheel.swift */, + D2351C7924A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift */, + D2351C7B24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift */, ); path = RightVariable; sourceTree = ""; @@ -1502,7 +1508,7 @@ children = ( AA104AC824472DC7004D2810 /* HeadersH1ButtonModel.swift */, AA104AC624472DB0004D2810 /* HeadersH1Button.swift */, - AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */, + AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */, AA104AD9244734DB004D2810 /* HeadersH1LandingPageHeader.swift */, ); path = H1; @@ -1517,7 +1523,7 @@ AA26850B244840AE00CE34CC /* HeadersH2TinyButton.swift */, AA104B1B24474A76004D2810 /* HeadersH2ButtonsModel.swift */, AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */, - AA633B3024989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift */, + AA633B3024989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift */, AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */, ); path = H2; @@ -2310,6 +2316,7 @@ BB55B51D244482C1002001AD /* ListRightVariablePriceChangeBodyText.swift in Sources */, 017BEB382360C6AC0024EF95 /* RadioButtonLabel.swift in Sources */, D28A837923C7D5BC00DFE4FC /* PageModelProtocol.swift in Sources */, + D2351C7C24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift in Sources */, 017BEB7B236763000024EF95 /* LineModel.swift in Sources */, D256E9932412880000360572 /* Header.swift in Sources */, 94C2D9A523872C350006CF46 /* LabelAttributeFontModel.swift in Sources */, @@ -2407,6 +2414,7 @@ AA26850E244840C300CE34CC /* HeadersH2TinyButtonModel.swift in Sources */, D260105F23D0BFFC00764D80 /* StackItem.swift in Sources */, 9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */, + D2351C7A24A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift in Sources */, 01EB369323609801006832FA /* HeaderModel.swift in Sources */, 8DE5BECF2456F7B100772E76 /* ListTwoColumnDropdownSelectors.swift in Sources */, D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 17fabef7..bfa5ba33 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -159,7 +159,6 @@ public typealias ActionBlockConfirmation = () -> (Bool) public override init(frame: CGRect) { super.init(frame: frame) - setupView() } public convenience override init() { @@ -305,6 +304,15 @@ public typealias ActionBlockConfirmation = () -> (Bool) isAnimated = isAnimatedState } + override open func accessibilityActivate() -> Bool { + // Hold state in case User wanted isAnimated to remain off. + let isAnimatedState = isAnimated + isAnimated = false + sendActions(for: .touchUpInside) + isAnimated = isAnimatedState + return true + } + //-------------------------------------------------- // MARK: - UIResponder //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index c6bb77bb..2ac82b23 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -180,6 +180,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableButtonAllTextAndLinks.self, viewModelClass: ListRightVariableButtonAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePriceChangeBodyText.self, viewModelClass: ListRightVariablePriceChangeBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePriceChangeAllTextAndLinks.self, viewModelClass: ListRightVariablePriceChangeAllTextAndLinksModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableToggleAllTextAndLinks.self, viewModelClass: ListRightVariableToggleAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextBodyText.self, viewModelClass: ListOneColumnFullWidthTextBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift new file mode 100644 index 00000000..9d5f6b84 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift @@ -0,0 +1,112 @@ +// +// ListRightVariableToggleAllTextAndLinks.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 6/25/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class ListRightVariableToggleAllTextAndLinks: TableViewCell { + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + + public let toggle = Toggle() + public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() + + //----------------------------------------------------- + // MARK: - Properties + //----------------------------------------------------- + + public var stack: Stack! + + //-------------------------------------------------- + // MARK: - Initializers + //-------------------------------------------------- + + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading)), + (view: toggle, model: StackItemModel(horizontalAlignment: .fill))], + axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + + //----------------------------------------------------- + // MARK: - Lifecycle + //----------------------------------------------------- + + override open func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + accessibilityHint = toggle.accessibilityHint + accessibilityTraits = toggle.accessibilityTraits + } + + //----------------------------------------------------- + // MARK: - Molecular + //----------------------------------------------------- + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListRightVariableToggleAllTextAndLinksModel else { return } + toggle.set(with: model.toggle, delegateObject, additionalData) + eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) + updateAccessibilityLabel() + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } + + //---------------------------------------------------- + // MARK: - Accessibility + //---------------------------------------------------- + + func getAccessibilityMessage() -> String? { + guard let toggleMessage = toggle.accessibilityLabel else { + return eyebrowHeadlineBodyLink.getAccessibilityMessage() + } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { + return toggleMessage + } + return label + ", " + toggleMessage + } + + func updateAccessibilityLabel() { + accessibilityValue = toggle.accessibilityValue + let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 + if !linkShowing && accessoryView == nil { + // Make whole cell focusable if one action + isAccessibilityElement = true + accessibilityLabel = getAccessibilityMessage() + } else { + // Make buttons focusable. + isAccessibilityElement = false + var elements: [Any] = [] + if let accessoryView = accessoryView { + accessoryView.accessibilityLabel = eyebrowHeadlineBodyLink.getAccessibilityMessage() + elements.append(accessoryView) + } else { + toggle.accessibilityLabel = getAccessibilityMessage() + } + elements.append(toggle) + + if linkShowing { + elements.append(eyebrowHeadlineBodyLink.link) + } + accessibilityElements = elements + } + } + + open override func accessibilityActivate() -> Bool { + return toggle.accessibilityActivate() + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift new file mode 100644 index 00000000..9fdc16ca --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift @@ -0,0 +1,58 @@ +// +// ListRightVariableToggleAllTextAndLinksModel.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 6/25/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListRightVariableToggleAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public static var identifier: String = "listRVTgl" + public var toggle: ToggleModel + public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + + public init(toggle: ToggleModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { + self.toggle = toggle + self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink + super.init() + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + + private enum CodingKeys: String, CodingKey { + case moleculeName + case toggle + case eyebrowHeadlineBodyLink + } + + //-------------------------------------------------- + // MARK: - codec + //-------------------------------------------------- + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + toggle = try typeContainer.decode(ToggleModel.self, forKey: .toggle) + eyebrowHeadlineBodyLink = try typeContainer.decode(EyebrowHeadlineBodyLinkModel.self, forKey: .eyebrowHeadlineBodyLink) + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(toggle, forKey: .toggle) + try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) + } +} From 6c5f80aa0b9681b252a42df782bf85769a432d4f Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 25 Jun 2020 10:18:59 -0400 Subject: [PATCH 14/22] list toggle accessibility fix --- .../ListRightVariableToggleAllTextAndLinks.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift index 9d5f6b84..ca2a3b92 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift @@ -107,6 +107,8 @@ import Foundation } open override func accessibilityActivate() -> Bool { - return toggle.accessibilityActivate() + let activate = toggle.accessibilityActivate() + accessibilityValue = toggle.accessibilityValue + return activate } } From 1e90e33b1e5c91decdf9c27b48561bacebd75300 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 10:54:51 -0400 Subject: [PATCH 15/22] fix enabled state for toggle --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 17fabef7..98619c8f 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -96,8 +96,8 @@ public typealias ActionBlockConfirmation = () -> (Bool) }, completion: nil) } else { - backgroundColor = isOn ? containerTintColor.on : containerTintColor.off - knobView.backgroundColor = isOn ? knobTintColor.on : knobTintColor.off + backgroundColor = isEnabled ? isOn ? containerTintColor.on : containerTintColor.off : disabledTintColor.container + knobView.backgroundColor = isEnabled ? isOn ? knobTintColor.on : knobTintColor.off : disabledTintColor.knob self.constrainKnob() } From 9d15c7c3dbaed3ca82485f499a3f39cf00d6396d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 25 Jun 2020 10:56:49 -0400 Subject: [PATCH 16/22] update hint for deactivated. --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 2 ++ .../ListRightVariableToggleAllTextAndLinks.swift | 4 ++-- .../SupportingFiles/Strings/en.lproj/Localizable.strings | 2 +- .../SupportingFiles/Strings/es-MX.lproj/Localizable.strings | 1 + .../SupportingFiles/Strings/es.lproj/Localizable.strings | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index bfa5ba33..d4e090aa 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -64,6 +64,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) changeStateNoAnimation(isEnabled ? isOn : false) backgroundColor = isEnabled ? (isOn ? containerTintColor.on : containerTintColor.off) : disabledTintColor.container knobView.backgroundColor = isEnabled ? (isOn ? knobTintColor.on : knobTintColor.off) : disabledTintColor.knob + accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: isEnabled ? "AccToggleHint" : "AccDisabled") } } @@ -306,6 +307,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) override open func accessibilityActivate() -> Bool { // Hold state in case User wanted isAnimated to remain off. + guard isUserInteractionEnabled == true else { return false } let isAnimatedState = isAnimated isAnimated = false sendActions(for: .touchUpInside) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift index ca2a3b92..a631616b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift @@ -46,8 +46,6 @@ import Foundation super.setupView() addMolecule(stack) stack.restack() - accessibilityHint = toggle.accessibilityHint - accessibilityTraits = toggle.accessibilityTraits } //----------------------------------------------------- @@ -81,6 +79,8 @@ import Foundation } func updateAccessibilityLabel() { + accessibilityHint = toggle.accessibilityHint + accessibilityTraits = toggle.accessibilityTraits accessibilityValue = toggle.accessibilityValue let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 if !linkShowing && accessoryView == nil { diff --git a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings index da55d597..74b907e3 100644 --- a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings @@ -9,7 +9,7 @@ // MARK: Accessibility "AccCloseButton" = "Close"; "swipe_to_select_with_action_hint" = "swipe up or down to select action, then double tap to select."; - +"AccDisabled" = "Disabled"; // MARK: Tab "AccTab" = ", tab"; diff --git a/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings index 0a9eadb9..b3b6298c 100644 --- a/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings @@ -8,6 +8,7 @@ // Accessibility "swipe_to_select_with_action_hint" = "deslízate hacia arriba o hacia abajo para seleccionar la acción, luego toca dos veces para seleccionar."; +"AccDisabled" = "desactivado"; "AccCloseButton" = "Cerrar"; // Tab diff --git a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings index bbc45f4a..8e0dbd02 100644 --- a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings @@ -8,6 +8,7 @@ // Accessibility "swipe_to_select_with_action_hint" = "deslízate hacia arriba o hacia abajo para seleccionar la acción, luego toca dos veces para seleccionar."; +"AccDisabled" = "desactivado"; "AccCloseButton" = "Cerrar"; // Tab From c8ac41fbadd74d61169240953fbdd0b53f28ae16 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 10:58:04 -0400 Subject: [PATCH 17/22] refactored --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 98619c8f..7407fa61 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -62,8 +62,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) didSet { isUserInteractionEnabled = isEnabled changeStateNoAnimation(isEnabled ? isOn : false) - backgroundColor = isEnabled ? (isOn ? containerTintColor.on : containerTintColor.off) : disabledTintColor.container - knobView.backgroundColor = isEnabled ? (isOn ? knobTintColor.on : knobTintColor.off) : disabledTintColor.knob + setToggleAppearanceFromState() } } @@ -96,8 +95,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) }, completion: nil) } else { - backgroundColor = isEnabled ? isOn ? containerTintColor.on : containerTintColor.off : disabledTintColor.container - knobView.backgroundColor = isEnabled ? isOn ? knobTintColor.on : knobTintColor.off : disabledTintColor.knob + setToggleAppearanceFromState() self.constrainKnob() } @@ -342,6 +340,12 @@ public typealias ActionBlockConfirmation = () -> (Bool) // MARK: - Animations //-------------------------------------------------- + public func setToggleAppearanceFromState() { + + backgroundColor = isEnabled ? isOn ? containerTintColor.on : containerTintColor.off : disabledTintColor.container + knobView.backgroundColor = isEnabled ? isOn ? knobTintColor.on : knobTintColor.off : disabledTintColor.knob + } + public func knobReformAnimation() { if isAnimated { From aaca9583351aa34296364b6ebdc4c891e8f3b845 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 25 Jun 2020 13:48:45 -0400 Subject: [PATCH 18/22] push code reduction --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 5be3ce31..2e50dfca 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -305,7 +305,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) override open func accessibilityActivate() -> Bool { // Hold state in case User wanted isAnimated to remain off. - guard isUserInteractionEnabled == true else { return false } + guard isUserInteractionEnabled else { return false } let isAnimatedState = isAnimated isAnimated = false sendActions(for: .touchUpInside) From eb193b16de0e51fd55d137ddcde323cc704cb758 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 17:35:59 -0400 Subject: [PATCH 19/22] dimension changes as per invision --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 17fabef7..ed2a015b 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -44,8 +44,8 @@ public typealias ActionBlockConfirmation = () -> (Bool) }() // Sizes are from InVision design specs. - static let containerSize = CGSize(width: 46, height: 24) - static let knobSize = CGSize(width: 22, height: 22) + static let containerSize = CGSize(width: 51, height: 31) + static let knobSize = CGSize(width: 28, height: 28) private var knobView: View = { let view = View() From 4da8eddd8dc7ba3964935ee4acfa8aac98928de9 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 17:57:42 -0400 Subject: [PATCH 20/22] corner radius --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index ed2a015b..597b50ae 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -50,7 +50,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) private var knobView: View = { let view = View() view.backgroundColor = .white - view.layer.cornerRadius = Toggle.getKnobHeight() / 2.0 + view.layer.cornerRadius = 14 return view }() @@ -205,9 +205,6 @@ public typealias ActionBlockConfirmation = () -> (Bool) knobHeightConstraint?.constant = Self.getKnobHeight() knobWidthConstraint?.constant = Self.getKnobWidth() - layer.cornerRadius = Self.getContainerHeight() / 2.0 - knobView.layer.cornerRadius = Self.getKnobHeight() / 2.0 - changeStateNoAnimation(isOn) } @@ -225,7 +222,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) widthConstraint = widthAnchor.constraint(equalToConstant: Self.containerSize.width) widthConstraint?.isActive = true - layer.cornerRadius = Self.containerSize.height / 2.0 + layer.cornerRadius = 15 backgroundColor = containerTintColor.off addSubview(knobView) From f2f26c60a24da68f16e5be92cdc4aa35e3516968 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 18:08:52 -0400 Subject: [PATCH 21/22] latest dimensions --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index ccf11073..02373958 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -50,7 +50,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) private var knobView: View = { let view = View() view.backgroundColor = .white - view.layer.cornerRadius = 14 + view.layer.cornerRadius = Toggle.getKnobHeight() / 2.0 return view }() @@ -142,14 +142,14 @@ public typealias ActionBlockConfirmation = () -> (Bool) private func constrainKnobOn() { - knobTrailingConstraint = trailingAnchor.constraint(equalTo: knobView.trailingAnchor, constant: 1) + knobTrailingConstraint = trailingAnchor.constraint(equalTo: knobView.trailingAnchor, constant: 2) knobLeadingConstraint = knobView.leadingAnchor.constraint(greaterThanOrEqualTo: leadingAnchor) } private func constrainKnobOff() { knobTrailingConstraint = trailingAnchor.constraint(greaterThanOrEqualTo: knobView.trailingAnchor) - knobLeadingConstraint = knobView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 1) + knobLeadingConstraint = knobView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 2) } //-------------------------------------------------- @@ -203,6 +203,9 @@ public typealias ActionBlockConfirmation = () -> (Bool) knobHeightConstraint?.constant = Self.getKnobHeight() knobWidthConstraint?.constant = Self.getKnobWidth() + layer.cornerRadius = Self.getContainerHeight() / 2.0 + knobView.layer.cornerRadius = Self.getKnobHeight() / 2.0 + changeStateNoAnimation(isOn) } @@ -220,7 +223,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) widthConstraint = widthAnchor.constraint(equalToConstant: Self.containerSize.width) widthConstraint?.isActive = true - layer.cornerRadius = 15 + layer.cornerRadius = Self.getContainerHeight() / 2.0 backgroundColor = containerTintColor.off addSubview(knobView) From aa23c9298773eb8326c889271e74373e808a4eae Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 29 Jun 2020 14:59:57 -0400 Subject: [PATCH 22/22] very minor cleaning --- .../DesignedComponents/Headers/H2/HeadersH2Link.swift | 2 +- .../Headers/H2/HeadersH2LinkModel.swift | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift index 4b0334e7..c5aaefc8 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift @@ -20,7 +20,7 @@ import Foundation // MARK: - Initializers //------------------------------------------------------- public override init(frame: CGRect) { - stack = Stack.createStack(with: [headlineBody, link], spacing: PaddingHorizontalBetweenRelatedItems) + stack = Stack.createStack(with: [headlineBody, link]) super.init(frame: frame) } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift index 5793eedf..66189f99 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift @@ -32,9 +32,13 @@ public class HeadersH2LinkModel: HeaderModel, MoleculeModelProtocol { //-------------------------------------------------- public override func setDefaults() { + if topPadding == nil { + topPadding = Padding.Component.VerticalMarginSpacing + } + if bottomPadding == nil { + bottomPadding = Padding.Component.VerticalMarginSpacing + } super.setDefaults() - topPadding = PaddingDefaultVerticalSpacing3 - bottomPadding = PaddingDefaultVerticalSpacing3 } //--------------------------------------------------