Merge branch 'release/7_8_0' into bugfix/smoothing_navigation_changes

This commit is contained in:
Pfeil, Scott Robert 2020-06-29 11:02:42 -04:00
commit 197543e145
8 changed files with 42 additions and 19 deletions

View File

@ -63,7 +63,7 @@ import UIKit
addSubview(stack) addSubview(stack)
NSLayoutConstraint.constraintPinSubview(toSuperview: stack) NSLayoutConstraint.constraintPinSubview(toSuperview: stack)
stack.backgroundColor = backgroundColor stack.backgroundColor = backgroundColor
stack.contentView.backgroundColor = .mvmWhite stack.contentView.backgroundColor = .clear
stack.model = StackModel(molecules: [], axis: .horizontal, spacing: 2) stack.model = StackModel(molecules: [], axis: .horizontal, spacing: 2)
stack.stackModel?.horizontalAlignment = .leading stack.stackModel?.horizontalAlignment = .leading
@ -111,7 +111,6 @@ import UIKit
roundedCorners = multiProgressModel.roundedCorners ?? false roundedCorners = multiProgressModel.roundedCorners ?? false
thicknessConstraint?.constant = multiProgressModel.thickness ?? defaultHeight thicknessConstraint?.constant = multiProgressModel.thickness ?? defaultHeight
stack.model?.backgroundColor = model.backgroundColor
set(with: multiProgressModel.progressList, delegateObject, additionalData) set(with: multiProgressModel.progressList, delegateObject, additionalData)
} }

View File

@ -20,6 +20,7 @@ import Foundation
public var peakingUI: Bool? public var peakingUI: Bool?
public var peakingArrowColor: Color? public var peakingArrowColor: Color?
public var analyticsData: JSONValueDictionary?
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Keys // MARK: - Keys
@ -28,6 +29,7 @@ import Foundation
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case peakingUI case peakingUI
case peakingArrowColor case peakingArrowColor
case analyticsData
} }
//-------------------------------------------------- //--------------------------------------------------
@ -38,6 +40,7 @@ import Foundation
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
peakingUI = try typeContainer.decodeIfPresent(Bool.self, forKey: .peakingUI) peakingUI = try typeContainer.decodeIfPresent(Bool.self, forKey: .peakingUI)
peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor) peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
try super.init(from: decoder) try super.init(from: decoder)
} }
@ -46,5 +49,6 @@ import Foundation
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(peakingUI, forKey: .peakingUI) try container.encodeIfPresent(peakingUI, forKey: .peakingUI)
try container.encodeIfPresent(peakingArrowColor, forKey: .peakingArrowColor) try container.encodeIfPresent(peakingArrowColor, forKey: .peakingArrowColor)
try container.encodeIfPresent(analyticsData, forKey: .analyticsData)
} }
} }

View File

@ -18,7 +18,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt
public var backgroundColor: Color? public var backgroundColor: Color?
public var tintColor: Color public var tintColor: Color
public var line: LineModel? 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 backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? = NavigationImageButtonModel(with: "nav_back", action: ActionBackModel())
public var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? public var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
public var additionalRightButtons: [(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) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .white)
tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black) tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black)
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) ?? LineModel(type: .standard) 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) { if let backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol) = try typeContainer.decodeModelIfPresent(codingKey: .backButton) {
self.backButton = backButton self.backButton = backButton
} }
@ -68,7 +68,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(tintColor, forKey: .tintColor) try container.encode(tintColor, forKey: .tintColor)
try container.encodeIfPresent(line, forKey: .line) 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.encodeModelIfPresent(backButton, forKey: .backButton)
try container.encodeModelsIfPresent(additionalLeftButtons, forKey: .additionalLeftButtons) try container.encodeModelsIfPresent(additionalLeftButtons, forKey: .additionalLeftButtons)
try container.encodeModelsIfPresent(additionalRightButtons, forKey: .additionalRightButtons) try container.encodeModelsIfPresent(additionalRightButtons, forKey: .additionalRightButtons)

View File

@ -297,6 +297,12 @@ open class Carousel: View {
cell.accessibilityElementsHidden = true cell.accessibilityElementsHidden = true
} }
} }
func trackSwipeActionAnalyticsforIndex(_ index : Int){
guard let itemModel = molecules?[index],
let viewControllerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return }
MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: viewControllerObject, actionInformation: itemModel.toJSON(), additionalData: nil)
}
} }
extension Carousel: UICollectionViewDelegateFlowLayout { extension Carousel: UICollectionViewDelegateFlowLayout {
@ -454,5 +460,7 @@ extension Carousel: UIScrollViewDelegate {
// Cycle to other end if on buffer cell. // Cycle to other end if on buffer cell.
pagingView?.currentIndex = pageIndex pagingView?.currentIndex = pageIndex
showPeaking(true) showPeaking(true)
// track analyticsData
trackSwipeActionAnalyticsforIndex(pageIndex)
} }
} }

View File

@ -10,4 +10,12 @@ import Foundation
public protocol CarouselItemModelProtocol: ContainerModelProtocol { public protocol CarouselItemModelProtocol: ContainerModelProtocol {
var analyticsData: JSONValueDictionary? { get set }
}
public extension CarouselItemModelProtocol {
var analyticsData: JSONValueDictionary? {
get { return nil }
set { analyticsData = newValue }
}
} }

View File

@ -14,7 +14,7 @@ public protocol NavigationItemModelProtocol {
var backgroundColor: Color? { get set } var backgroundColor: Color? { get set }
var tintColor: Color { get set } var tintColor: Color { get set }
var line: LineModel? { get set } var line: LineModel? { get set }
var alwaysShowBackButton: Bool { get set } var alwaysShowBackButton: Bool? { get set }
var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? { get set } var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? { get set }
var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set }
var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set }

View File

@ -55,13 +55,15 @@ import UIKit
public static func setNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { public static func setNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) {
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
var leftItems: [UIBarButtonItem] = [] var leftItems: [UIBarButtonItem] = []
if let backButtonModel = navigationItemModel.backButton, if navigationItemModel.alwaysShowBackButton != false {
navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton { if let backButtonModel = navigationItemModel.backButton,
leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton ?? false {
} leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil))
if let leftItemModels = navigationItemModel.additionalLeftButtons { }
for item in leftItemModels { if let leftItemModels = navigationItemModel.additionalLeftButtons {
leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) for item in leftItemModels {
leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil))
}
} }
} }
viewController.navigationItem.leftBarButtonItems = leftItems.count > 0 ? leftItems : nil viewController.navigationItem.leftBarButtonItems = leftItems.count > 0 ? leftItems : nil

View File

@ -48,13 +48,15 @@ public extension MVMCoreUISplitViewController {
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
// Add back button first. // Add back button first.
if let backButtonModel = navigationItemModel?.backButton { if navigationItemModel?.alwaysShowBackButton != false {
if navigationController.viewControllers.count > 1 || navigationItemModel!.alwaysShowBackButton { if let backButtonModel = navigationItemModel?.backButton {
leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) 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. // Add the panel button after the back button.