From 41031856e5baad17bb99b05e05e093845e4f2f51 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Mon, 14 Mar 2022 13:44:41 -0400 Subject: [PATCH 01/18] vds color tokens library --- MVMCoreUI.xcodeproj/project.pbxproj | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 8d19a539..ebb38987 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 48; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ @@ -272,6 +272,7 @@ AAE7270E24AC8B9300A3ED0E /* HeadersH2CaretLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE7270D24AC8B9300A3ED0E /* HeadersH2CaretLink.swift */; }; AAE96FA225341F6A0037A989 /* ListStoreLocatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE96FA125341F6A0037A989 /* ListStoreLocatorModel.swift */; }; AAE96FA525341F7D0037A989 /* ListStoreLocator.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE96FA425341F7D0037A989 /* ListStoreLocator.swift */; }; + AFE4A1D127DFB5EE00C458D0 /* VDSColorTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = AFE4A1D027DFB5EE00C458D0 /* VDSColorTokens.xcframework */; }; BB105859248DEFF70069D008 /* UICollectionViewLeftAlignedLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */; }; BB1D17E0244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */; }; BB1D17E2244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */; }; @@ -857,6 +858,7 @@ AAE7270D24AC8B9300A3ED0E /* HeadersH2CaretLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2CaretLink.swift; sourceTree = ""; }; AAE96FA125341F6A0037A989 /* ListStoreLocatorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListStoreLocatorModel.swift; sourceTree = ""; }; AAE96FA425341F7D0037A989 /* ListStoreLocator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListStoreLocator.swift; sourceTree = ""; }; + AFE4A1D027DFB5EE00C458D0 /* VDSColorTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSColorTokens.xcframework; path = ../SharedFrameworks/VDSColorTokens.xcframework; sourceTree = ""; }; BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionViewLeftAlignedLayout.swift; sourceTree = ""; }; BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMediumModel.swift; sourceTree = ""; }; BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMedium.swift; sourceTree = ""; }; @@ -1181,6 +1183,7 @@ buildActionMask = 2147483647; files = ( D29DF0E621E4F3C7003B2FB9 /* MVMCore.framework in Frameworks */, + AFE4A1D127DFB5EE00C458D0 /* VDSColorTokens.xcframework in Frameworks */, 9455B19C234F8A0400A574DB /* MVMAnimationFramework.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2002,6 +2005,7 @@ D29DF0E421E4F3C7003B2FB9 /* Frameworks */ = { isa = PBXGroup; children = ( + AFE4A1D027DFB5EE00C458D0 /* VDSColorTokens.xcframework */, D29DF0E521E4F3C7003B2FB9 /* MVMCore.framework */, 9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */, ); @@ -3268,7 +3272,8 @@ MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -3291,7 +3296,11 @@ INFOPLIST_FILE = MVMCoreUI/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MARKETING_VERSION = 2.0; PRODUCT_BUNDLE_IDENTIFIER = com.vzw.MVMCoreUI; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -3318,7 +3327,11 @@ INFOPLIST_FILE = MVMCoreUI/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); MARKETING_VERSION = 2.0; PRODUCT_BUNDLE_IDENTIFIER = com.vzw.MVMCoreUI; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; From 9ce71945ae2c619c8d61a3e49216a5588bbd4131 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Tue, 15 Mar 2022 16:36:06 -0400 Subject: [PATCH 02/18] merge --- MVMCoreUI/Atomic/Atoms/Views/LineModel.swift | 50 +++- .../HorizontalCombinationViews/TabBar.swift | 7 +- .../TabBarModel.swift | 74 ++++-- .../HorizontalCombinationViews/Tabs.swift | 21 +- .../TabsModel.swift | 96 ++++++-- .../NavigationBar/NavigationItemModel.swift | 76 +++++-- .../NavigationController.swift.orig | 213 ++++++++++++++++++ ...UISplitViewController+Extension.swift.orig | 168 ++++++++++++++ MVMCoreUI/Styles/Styler.swift | 4 +- 9 files changed, 635 insertions(+), 74 deletions(-) create mode 100644 MVMCoreUI/Containers/NavigationController/NavigationController.swift.orig create mode 100644 MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift.orig diff --git a/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift b/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift index 0f67b3f0..f463c0f9 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift @@ -7,7 +7,7 @@ // import UIKit - +import VDSColorTokens @objcMembers public class LineModel: MoleculeModelProtocol { //-------------------------------------------------- @@ -54,8 +54,42 @@ import UIKit //TODO: use color insted of backgroundColor. Needs server changes // public var color: Color? - public var backgroundColor: Color? - public var backgroundColor_inverted: Color = Color(uiColor: .mvmWhite) + private var _backgroundColor: Color? + public var backgroundColor: Color? { + get { + if let backgroundColor = _backgroundColor { return backgroundColor } + if inverted { + if type == .standard { return Color(uiColor: VDSColor.interactiveDisabledOndark) } + return Color(uiColor: VDSColor.elementsPrimaryOndark) + } + if type == .standard { return Color(uiColor: VDSColor.interactiveDisabledOnlight) } + return Color(uiColor: VDSColor.elementsPrimaryOnlight) + } + set { + _backgroundColor = newValue + } + } + + private var _thickness: CGFloat? + public var thickness: CGFloat { + get { + if let thickness = _thickness { return thickness } + switch type { + case .heavy: + return 4 + case .medium: + return 2 + case .none: + return 0 + default: + return 1 + } + } + set { + _thickness = newValue + } + } + public var inverted: Bool = false // Use this to show vertical line @@ -90,6 +124,7 @@ import UIKit case frequency case inverted case useVerticalLine + case thickness } //-------------------------------------------------- @@ -111,12 +146,9 @@ import UIKit self.inverted = inverted } - if let backgroundColor_inverted = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor_inverted) { - self.backgroundColor_inverted = backgroundColor_inverted - } - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) useVerticalLine = try typeContainer.decodeIfPresent(Bool.self, forKey: .useVerticalLine) + _thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness) } public func encode(to encoder: Encoder) throws { @@ -125,8 +157,8 @@ import UIKit try container.encode(type, forKey: .type) try container.encode(inverted, forKey: .inverted) try container.encodeIfPresent(frequency, forKey: .frequency) - try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) - try container.encodeIfPresent(backgroundColor_inverted, forKey: .backgroundColor_inverted) + try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(useVerticalLine, forKey: .useVerticalLine) + try container.encodeIfPresent(_thickness, forKey: .thickness) } } diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index c4df44c0..dbea90d7 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -5,7 +5,7 @@ // Created by Scott Pfeil on 5/28/20. // Copyright © 2020 Verizon Wireless. All rights reserved. // - +import VDSColorTokens @objcMembers open class TabBar: UITabBar, MoleculeViewProtocol, TabBarProtocol, UITabBarDelegate { @@ -21,7 +21,6 @@ delegate = self translatesAutoresizingMaskIntoConstraints = false line.addLine(to: self, edge: .top, useMargin: false) - line.backgroundColor = .mvmCoolGray3 set(with: model, delegateObject, additionalData) } @@ -50,6 +49,10 @@ } setItems(tabs, animated: false) selectedItem = tabs[model.selectedTab] + + guard let lineModel = line.lineModel else { return } + lineModel.inverted = model.style == .dark + line.set(with: lineModel, delegateObject, additionalData) } /// Sets the item colors. diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift index fc3e9449..beeb6149 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift @@ -7,16 +7,55 @@ // import Foundation +import VDSColorTokens -public class TabBarModel: MoleculeModelProtocol { +open class TabBarModel: MoleculeModelProtocol { public static var identifier: String = "tabBar" - public var backgroundColor: Color? = Color(uiColor: .white) - public var tabs: [TabBarItemModel] - public var selectedColor = Color(uiColor: .mvmBlack) - public var unSelectedColor = Color(uiColor: .mvmCoolGray6) + open var tabs: [TabBarItemModel] + + private var _backgroundColor: Color? + open var backgroundColor: Color? { + get { + if let backgroundColor = _backgroundColor { return backgroundColor } + if let style = style, + style == .dark { return Color(uiColor: VDSColor.backgroundPrimaryDark) } + return Color(uiColor: VDSColor.backgroundPrimaryLight) + } + set { + _backgroundColor = newValue + } + } + + private var _selectedColor: Color? + open var selectedColor: Color { + get { + if let selectedColor = _selectedColor { return selectedColor } + if let style = style, + style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) } + return Color(uiColor: VDSColor.elementsPrimaryOnlight) + } + set { + _selectedColor = newValue + } + } + + private var _unSelectedColor: Color? + open var unSelectedColor: Color { + get { + if let unSelectedColor = _unSelectedColor { return unSelectedColor } + if let style = style, + style == .dark { return Color(uiColor: VDSColor.elementsSecondaryOndark) } + return Color(uiColor: VDSColor.elementsSecondaryOnlight) + } + set { + _unSelectedColor = newValue + } + } + + open var style: NavigationItemStyle? // Must be capped to 0...(tabs.count - 1) - public var selectedTab: Int = 0 + open var selectedTab: Int = 0 private enum CodingKeys: String, CodingKey { case moleculeName @@ -25,6 +64,7 @@ public class TabBarModel: MoleculeModelProtocol { case selectedColor case unSelectedColor case selectedTab + case style } public init(with tabs: [TabBarItemModel]) { @@ -46,24 +86,26 @@ public class TabBarModel: MoleculeModelProtocol { if let index = try typeContainer.decodeIfPresent(Int.self, forKey: .selectedTab) { selectedTab = index } + style = try typeContainer.decodeIfPresent(NavigationItemStyle.self, forKey: .style) ?? .dark } - public func encode(to encoder: Encoder) throws { + open func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) try container.encode(tabs, forKey: .tabs) - try container.encode(backgroundColor, forKey: .backgroundColor) - try container.encode(selectedColor, forKey: .selectedColor) - try container.encode(unSelectedColor, forKey: .unSelectedColor) + try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor) + try container.encodeIfPresent(_selectedColor, forKey: .selectedColor) + try container.encodeIfPresent(_unSelectedColor, forKey: .unSelectedColor) try container.encode(selectedTab, forKey: .selectedTab) + try container.encodeIfPresent(style, forKey: .style) } } -public class TabBarItemModel: Codable { - var title: String? - var image: String - var action: ActionModelProtocol - var accessibilityText: String? +open class TabBarItemModel: Codable { + open var title: String? + open var image: String + open var action: ActionModelProtocol + open var accessibilityText: String? private enum CodingKeys: String, CodingKey { case title @@ -86,7 +128,7 @@ public class TabBarItemModel: Codable { accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) } - public func encode(to encoder: Encoder) throws { + open func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(title, forKey: .title) try container.encode(image, forKey: .image) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift index 290ced62..4e424549 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift @@ -7,6 +7,7 @@ // import UIKit +import VDSColorTokens @objc public protocol TabsDelegate { func shouldSelectItem(_ indexPath: IndexPath, tabs: Tabs) -> Bool @@ -66,7 +67,7 @@ import UIKit open override func setupView() { super.setupView() - backgroundColor = .white + backgroundColor = VDSColor.backgroundPrimaryLight addSubview(bottomLine) setupCollectionView() setupSelectionLine() @@ -94,7 +95,7 @@ import UIKit bottomScrollView.delegate = self addSubview(bottomScrollView) bottomScrollView.addSubview(bottomContentView) - selectionLine.backgroundColor = .mvmRed + selectionLine.backgroundColor = VDSColor.paletteRed bottomContentView.addSubview(selectionLine) bringSubviewToFront(bottomScrollView) } @@ -153,8 +154,7 @@ import UIKit self.delegateObject = delegateObject self.additionalData = additionalData selectedIndex = tabsModel?.selectedIndex ?? 0 - // TODO: Commented out until we have model support for bar color. Should also do unselected color. - //selectionLine.backgroundColor = tabsModel?.selectedColor.uiColor + selectionLine.backgroundColor = tabsModel?.selectedBarColor.uiColor reloadData() } } @@ -169,10 +169,10 @@ extension Tabs: UICollectionViewDataSource { } public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - guard let labelModel = tabsModel?.tabs[indexPath.row].label, let cell = collectionView.dequeueReusableCell(withReuseIdentifier: TabCellId, for: indexPath) as? TabItemCell else { + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: TabCellId, for: indexPath) as? TabItemCell else { return UICollectionViewCell() } - cell.updateCell(labelModel: labelModel, indexPath: indexPath, delegateObject: delegateObject, additionalData: additionalData, selected: indexPath.row == selectedIndex, tabsModel: tabsModel) + cell.updateCell(indexPath: indexPath, delegateObject: delegateObject, additionalData: additionalData, selected: indexPath.row == selectedIndex, tabsModel: tabsModel) updateView(collectionView.bounds.width) return cell } @@ -332,13 +332,14 @@ extension Tabs { label.updateView(size) } - public func updateCell(labelModel: LabelModel, indexPath: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, selected: Bool, tabsModel: TabsModel?) { + public func updateCell(indexPath: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, selected: Bool, tabsModel: TabsModel?) { + guard let tabsModel = tabsModel else { return } label.reset() - label.set(with: labelModel, delegateObject, additionalData) + label.set(with: tabsModel.tabs[indexPath.row].label, delegateObject, additionalData) if selected { - label.textColor = tabsModel?.selectedColor.uiColor ?? .black + label.textColor = tabsModel.selectedColor.uiColor } else { - label.textColor = .mvmCoolGray6 + label.textColor = tabsModel.unselectedColor.uiColor } updateAccessibility(indexPath: indexPath, selected: selected, tabsModel: tabsModel) } diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift index 64f8df4d..6e154895 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift @@ -7,22 +7,78 @@ // import UIKit +import VDSColorTokens -public class TabsModel: MoleculeModelProtocol { +open class TabsModel: MoleculeModelProtocol { public static var identifier: String = "tabs" - public var backgroundColor: Color? - public var tabs: [TabItemModel] - public var selectedColor = Color(uiColor: .black) + open var tabs: [TabItemModel] + + open var style: NavigationItemStyle? + + private var _backgroundColor: Color? + open var backgroundColor: Color? { + get { + if let backgroundColor = _backgroundColor { return backgroundColor } + if let style = style, + style == .dark { return Color(uiColor: VDSColor.backgroundPrimaryDark) } + return Color(uiColor: VDSColor.backgroundPrimaryLight) + } + set { + _backgroundColor = newValue + } + } + + private var _selectedColor: Color? + open var selectedColor: Color { + get { + if let selectedColor = _selectedColor { return selectedColor } + if let style = style, + style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) } + return Color(uiColor: VDSColor.elementsPrimaryOnlight) + } + set { + _selectedColor = newValue + } + } + + private var _unselectedColor: Color? + open var unselectedColor: Color { + get { + if let unselectedColor = _unselectedColor { return unselectedColor } + if let style = style, + style == .dark { return Color(uiColor: VDSColor.elementsSecondaryOndark) } + return Color(uiColor: VDSColor.elementsSecondaryOnlight) + } + set { + _unselectedColor = newValue + } + } + + private var _selectedBarColor: Color? + open var selectedBarColor: Color { + get { + if let selectedBarColor = _selectedBarColor { return selectedBarColor } + if let style = style, + style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) } + return Color(uiColor: VDSColor.paletteRed) + } + set { + _selectedBarColor = newValue + } + } // Must be capped to 0...(tabs.count - 1) - public var selectedIndex: Int = 0 + open var selectedIndex: Int = 0 private enum CodingKeys: String, CodingKey { + case moleculeName case tabs case backgroundColor case selectedColor + case unselectedColor + case selectedBarColor case selectedIndex - case moleculeName + case style } public init(with tabs: [TabItemModel]) { @@ -33,31 +89,35 @@ public class TabsModel: MoleculeModelProtocol { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) tabs = try typeContainer.decode([TabItemModel].self, forKey: .tabs) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedColor) { - selectedColor = color - } + _selectedColor = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedColor) + _unselectedColor = try typeContainer.decodeIfPresent(Color.self, forKey: .unselectedColor) + _selectedBarColor = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedBarColor) + style = try typeContainer.decodeIfPresent(NavigationItemStyle.self, forKey: .style) if let index = try typeContainer.decodeIfPresent(Int.self, forKey: .selectedIndex) { selectedIndex = index } } - public func encode(to encoder: Encoder) throws { + open func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) try container.encode(tabs, forKey: .tabs) - try container.encode(backgroundColor, forKey: .backgroundColor) - try container.encode(selectedColor, forKey: .selectedColor) + try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor) + try container.encodeIfPresent(_selectedColor, forKey: .selectedColor) + try container.encodeIfPresent(_unselectedColor, forKey: .unselectedColor) + try container.encodeIfPresent(_selectedBarColor, forKey: .selectedBarColor) try container.encode(selectedIndex, forKey: .selectedIndex) + try container.encodeIfPresent(style, forKey: .style) } } -public class TabItemModel: Codable { - public var label: LabelModel - public var action: ActionModelProtocol? +open class TabItemModel: Codable { + open var label: LabelModel + open var action: ActionModelProtocol? - init(label: LabelModel) { + public init(label: LabelModel) { self.label = label } @@ -66,7 +126,7 @@ public class TabItemModel: Codable { case action } - func setDefaults() { + open func setDefaults() { if label.textAlignment == nil { label.textAlignment = .center } @@ -85,7 +145,7 @@ public class TabItemModel: Codable { setDefaults() } - public func encode(to encoder: Encoder) throws { + open func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeModel(label, forKey: .label) try container.encodeModelIfPresent(action, forKey: .action) diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift index d8126508..c2e1ccc6 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift @@ -6,6 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // +import VDSColorTokens + +public enum NavigationItemStyle: String, Codable { + case light + case dark +} open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtocol { //-------------------------------------------------- @@ -14,12 +20,39 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc open class var identifier: String { "navigationBar" } + private let defaultHidesSystemBackButton = true + open var title: String? - open var hidden: Bool - open var backgroundColor: Color? - open var tintColor: Color - open var line: LineModel? + open var hidden = false + open var line: LineModel? = LineModel(type: .standard) open var hidesSystemBackButton = true + open var style: NavigationItemStyle? + + private var _backgroundColor: Color? + open var backgroundColor: Color? { + get { + if let backgroundColor = _backgroundColor { return backgroundColor } + if let style = style, + style == .dark { return Color(uiColor: VDSColor.backgroundPrimaryDark) } + return Color(uiColor: VDSColor.backgroundPrimaryLight) + } + set { + _backgroundColor = newValue + } + } + + private var _tintColor: Color? + open var tintColor: Color { + get { + if let tintColor = _tintColor { return tintColor } + if let style = style, + style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) } + return Color(uiColor: VDSColor.elementsPrimaryOnlight) + } + set { + _tintColor = newValue + } + } /// If true, we add the button in the backButton property. If false we do not add the button. If nil, we add the button if the controller is not the bottom of the stack open var alwaysShowBackButton: Bool? @@ -28,17 +61,13 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc open var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? open var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? open var titleView: MoleculeModelProtocol? + open var titleOffset: UIOffset? //-------------------------------------------------- // MARK: - Initializer //-------------------------------------------------- - public init() { - hidden = false - backgroundColor = Color(uiColor: .mvmWhite) - tintColor = Color(uiColor: .mvmBlack) - line = LineModel(type: .standard) - } + public init() {} //-------------------------------------------------- // MARK: - Keys @@ -57,6 +86,8 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc case additionalLeftButtons case additionalRightButtons case titleView + case style + case titleOffset } //-------------------------------------------------- @@ -66,16 +97,25 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) title = try typeContainer.decodeIfPresent(String.self, forKey: .title) - hidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidden) ?? false - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .mvmWhite) - tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .mvmBlack) - line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) ?? LineModel(type: .standard) - hidesSystemBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidesSystemBackButton) ?? true + if let hidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidden) { + self.hidden = hidden + } + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + _tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) + if let line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) { + self.line = line + } + if let hidesSystemBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidesSystemBackButton) { + self.hidesSystemBackButton = hidesSystemBackButton + } alwaysShowBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysShowBackButton) backButton = try typeContainer.decodeModelIfPresent(codingKey: .backButton) additionalLeftButtons = try typeContainer.decodeModelsIfPresent(codingKey: .additionalLeftButtons) additionalRightButtons = try typeContainer.decodeModelsIfPresent(codingKey: .additionalRightButtons) titleView = try typeContainer.decodeModelIfPresent(codingKey: .titleView) + style = try typeContainer.decodeIfPresent(NavigationItemStyle.self, forKey: .style) + titleOffset = try typeContainer.decodeIfPresent(UIOffset.self, forKey: .titleOffset) ?? UIOffset(horizontal: -CGFloat.greatestFiniteMagnitude, vertical: 0) + line?.inverted = style == .dark } open func encode(to encoder: Encoder) throws { @@ -83,8 +123,8 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc try container.encode(moleculeName, forKey: .moleculeName) try container.encodeIfPresent(title, forKey: .title) try container.encode(hidden, forKey: .hidden) - try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) - try container.encode(tintColor, forKey: .tintColor) + try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor) + try container.encodeIfPresent(_tintColor, forKey: .tintColor) try container.encodeIfPresent(line, forKey: .line) try container.encode(hidesSystemBackButton, forKey: .hidesSystemBackButton) try container.encodeIfPresent(alwaysShowBackButton, forKey: .alwaysShowBackButton) @@ -92,6 +132,8 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc try container.encodeModelsIfPresent(additionalLeftButtons, forKey: .additionalLeftButtons) try container.encodeModelsIfPresent(additionalRightButtons, forKey: .additionalRightButtons) try container.encodeModelIfPresent(titleView, forKey: .titleView) + try container.encodeIfPresent(style, forKey: .style) + try container.encodeIfPresent(titleOffset, forKey: .titleOffset) } } diff --git a/MVMCoreUI/Containers/NavigationController/NavigationController.swift.orig b/MVMCoreUI/Containers/NavigationController/NavigationController.swift.orig new file mode 100644 index 00000000..30357881 --- /dev/null +++ b/MVMCoreUI/Containers/NavigationController/NavigationController.swift.orig @@ -0,0 +1,213 @@ +// +// NavigationController.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 10/24/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +import UIKit + +@objcMembers open class NavigationController: UINavigationController, MVMCoreViewManagerViewControllerProtocol { + public weak var manager: (UIViewController & MVMCoreViewManagerProtocol)? + + /// Getter for the main navigation controller + public static func navigationController() -> Self? { + return MVMCoreActionUtility.initializerClassCheck(MVMCoreUISession.sharedGlobal()?.navigationController, classToVerify: self) as? Self + } + + /// Sets up the application with a navigation controller + public static func setupNavigationController() -> Self? { + let navigationController = self.init() + MVMCoreUISession.sharedGlobal()?.navigationController = navigationController + MVMCoreNavigationHandler.shared()?.viewControllerToPresentOn = navigationController + MVMCoreNavigationHandler.shared()?.navigationController = navigationController + MVMCoreNavigationHandler.shared()?.addDelegate(navigationController) + navigationController.setNavigationBarUI(with: NavigationItemModel()) + return navigationController + } + + /// Sets up the application with a navigation controller as the main container. + public static func setupNavigationControllerAsMainController() -> Self? { + guard let navigationController = setupNavigationController() else { return nil } + MVMCoreUISession.sharedGlobal()?.setup(asStandardLoadViewDelegate: navigationController) + return navigationController + } + +<<<<<<< HEAD:MVMCoreUI/Containers/NavigationController.swift + /// Convenience function for setting the navigation item. + public static func setNavigationItem(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { + viewController.navigationItem.title = navigationItemModel.title + viewController.navigationItem.accessibilityLabel = navigationItemModel.title + viewController.navigationItem.hidesBackButton = navigationItemModel.hidesSystemBackButton + viewController.navigationItem.leftItemsSupplementBackButton = !navigationItemModel.hidesSystemBackButton + setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) + setNavigationTitleView(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) + } + + /// Convenience function for setting the navigation buttons. + public static func setNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { + let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject + var leftItems: [UIBarButtonItem] = [] + if navigationItemModel.hidesSystemBackButton, + navigationItemModel.alwaysShowBackButton != false { + if let backButtonModel = navigationItemModel.backButton, + MVMCoreNavigationHandler.shared()?.getViewControllers(for: navigationController)?.count ?? 0 > 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 + + var rightItems: [UIBarButtonItem] = [] + if let rightItemModels = navigationItemModel.additionalRightButtons { + for item in rightItemModels { + rightItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + } + } + viewController.navigationItem.rightBarButtonItems = rightItems.count > 0 ? rightItems : nil + } + + static func getNavigationBarShadowImage(for navigationItemModel: NavigationItemModelProtocol) -> UIImage? { + guard let thickness = navigationItemModel.line?.thickness, + let backgroundColor = navigationItemModel.line?.backgroundColor else { return nil } + return backgroundColor.uiColor.image(CGSize(width: thickness, height: thickness)) + } + + /// Convenience function for setting the navigation bar ui, except for the buttons. + public static func setNavigationBarUI(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol) { + let navigationBar = navigationController.navigationBar + let font = MFStyler.fontBoldBodySmall(false) + let backgroundColor = navigationItemModel.backgroundColor?.uiColor + let tint = navigationItemModel.tintColor.uiColor + navigationBar.tintColor = tint + + let appearance = UINavigationBarAppearance() + appearance.configureWithOpaqueBackground() + appearance.titleTextAttributes = [NSAttributedString.Key.font: font, + NSAttributedString.Key.foregroundColor: tint]; + appearance.backgroundColor = backgroundColor + appearance.titleTextAttributes.updateValue(tint, forKey: .foregroundColor) + appearance.titlePositionAdjustment = navigationItemModel.titleOffset ?? .zero + appearance.shadowColor = navigationItemModel.line?.backgroundColor?.uiColor ?? .clear + appearance.shadowImage = getNavigationBarShadowImage(for: navigationItemModel)?.withRenderingMode(.alwaysTemplate) + navigationBar.standardAppearance = appearance + navigationBar.scrollEdgeAppearance = appearance + + navigationController.setNavigationBarHidden(navigationItemModel.hidden, animated: true) + } + + /// Convenience function for setting the navigation titleView. + public static func setNavigationTitleView(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { + let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject + if let titleViewModel = navigationItemModel?.titleView, let molecule = ModelRegistry.createMolecule(titleViewModel, delegateObject: delegate, additionalData: nil) { + viewController.navigationItem.titleView = molecule + } + } + +======= +>>>>>>> feature/develop_mvp_3:MVMCoreUI/Containers/NavigationController/NavigationController.swift + /// Convenience function to return the navigation model of the lowest controller traversing managers if applicable. + public func getNavigationModel(from viewController: UIViewController) -> NavigationItemModelProtocol? { + return (viewController as? PageProtocol)?.pageModel?.navigationBar + } + + /// Verifies the controller is the currently displayed controller. + public func isDisplayed(viewController: UIViewController) -> Bool { + guard let topViewController = topViewController, + viewController == MVMCoreUIUtility.getViewControllerTraversingManagers(topViewController) else { + return false + } + return true + } +} + +extension NavigationController: MVMCoreViewManagerProtocol { + public func getCurrentViewController() -> UIViewController? { + guard let topViewController = topViewController else { return nil } + return MVMCoreUIUtility.getViewControllerTraversingManagers(topViewController) + } + + public func containsPage(withPageType pageType: String?) -> Bool { + for controller in viewControllers { + if let manager = controller as? MVMCoreViewManagerProtocol, + manager.containsPage(withPageType: pageType) { + return true + } else if let controller = controller as? MVMCoreViewControllerProtocol, + controller.pageType == pageType { + return true + } + } + return false + } + + public func newDataReceived(in viewController: UIViewController) { + + if isDisplayed(viewController: viewController), + let topViewController = topViewController, + let model = getNavigationModel(from: viewController) { + setNavigationItem(with: model, for: topViewController) + setNavigationBarUI(with: model) + } + manager?.newDataReceived?(in: viewController) + } + + public func willDisplay(_ viewController: UIViewController) { + if let topViewController = topViewController, + let model = getNavigationModel(from: viewController) { + setNavigationItem(with: model, for: topViewController) + } + manager?.willDisplay?(viewController) + } + + public func displayedViewController(_ viewController: UIViewController) { + if isDisplayed(viewController: viewController), + let model = getNavigationModel(from: viewController) { + setNavigationBarUI(with: model) + } + manager?.displayedViewController?(viewController) + } +} + +extension NavigationController: MVMCorePresentationDelegateProtocol { + public func navigationController(_ navigationController: UINavigationController, prepareDisplayFor viewController: UIViewController) { + guard self == navigationController, + let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController), + let model = getNavigationModel(from: newViewController) else { return } + setNavigationItem(with: model, for: viewController) + } + + public func navigationController(_ navigationController: UINavigationController, willDisplay viewController: UIViewController) { + guard self == navigationController, + let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController) else { return } + if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) { + MVMCoreViewManagerViewControllerProtocolHelper.helpSetManager(self, viewController: controller) + } + manager?.willDisplay?(newViewController) + } + + public func navigationController(_ navigationController: UINavigationController, displayedViewController viewController: UIViewController) { + guard self == navigationController, + let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController) else { return } + if let model = getNavigationModel(from: newViewController) { + setNavigationBarUI(with: model) + } + manager?.displayedViewController?(newViewController) + if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) { + controller.viewControllerReady?(inManager: self) + } + } +} + +extension UIColor { + func image(_ size: CGSize = CGSize(width: 1, height: 1)) -> UIImage { + return UIGraphicsImageRenderer(size: size).image { rendererContext in + self.setFill() + rendererContext.fill(CGRect(origin: .zero, size: size)) + } + } +} diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift.orig b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift.orig new file mode 100644 index 00000000..49279b8e --- /dev/null +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift.orig @@ -0,0 +1,168 @@ +// +// MVMCoreUISplitViewController+Extension.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 6/18/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +import UIKit + +// Navigation bar update functions +public extension MVMCoreUISplitViewController { + + /// Convenience function. Sets the navigation and split view properties for the view controller. Panel access is determined if view controller is a detail view protocol. + func setNavigationBar(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol) { + guard navigationController == self.navigationController, + viewController == getCurrentDetailViewController() else { + /// Not the split view navigation controller, skip split functions. + return + } + + setLeftPanelIsAccessible((viewController as? MVMCoreUIDetailViewProtocol)?.isLeftPanelAccessible?() ?? false, for: viewController, updateNavigationButtons: false) + setRightPanelIsAccessible((viewController as? MVMCoreUIDetailViewProtocol)?.isRightPanelAccessible?() ?? false, for: viewController, updateNavigationButtons: false) + + setLeftNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) + setRightNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) + + setNavigationIconColor(navigationItemModel.tintColor.uiColor) + } + + /// Sets the left navigation items for the view controller based on model and splitview. + func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { + guard let topViewController = navigationController.topViewController else { return } + + var leftItems: [UIBarButtonItem] = [] + let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject + + // Add back button first. + if navigationItemModel?.hidesSystemBackButton == true { + var showBackButton: Bool + if let forceBackButton = navigationItemModel?.alwaysShowBackButton { + showBackButton = forceBackButton + } else { + showBackButton = MVMCoreNavigationHandler.shared()?.getViewControllers(for: navigationController)?.count ?? 0 > 1 + } + if showBackButton { + if let backButtonModel = navigationItemModel?.backButton { + leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + } else if let backButton = backButton { + // Default to legacy if we have default back button. + leftItems.append(backButton) + } + } + } + + // Add the panel button after the back button. + if let panelButton = leftPanelButton, + leftPanelIsAccessible, + !leftPanelStaysExtended() { + leftItems.append(panelButton) + } + + // Add other model buttons + if let leftItemModels = navigationItemModel?.additionalLeftButtons { + for item in leftItemModels { + leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + } + } + + // Add any buttons added by the splitview. + if let additionalLeftButtons = additionalLeftButtons(for: viewController) { + leftItems.append(contentsOf: additionalLeftButtons) + } + + topViewController.navigationItem.setLeftBarButtonItems(leftItems.count > 0 ? leftItems : nil, animated: !DisableAnimations.boolValue) + } + + /// Sets the right navigation items for the view controller based on model and splitview. + func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { + guard let topViewController = navigationController.topViewController else { return } + + let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject + var rightItems: [UIBarButtonItem] = [] + + // Add the panel button first. + if let panelButton = rightPanelButton, + rightPanelIsAccessible, + !rightPanelStaysExtended() { + rightItems.append(panelButton) + } + + // Add other model buttons + if let rightItemModels = navigationItemModel?.additionalRightButtons { + for item in rightItemModels { + rightItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + } + } + + // Add any buttons added by the splitview. + if let additionalRightButtons = additionalRightButtons(for: viewController) { + rightItems.append(contentsOf: additionalRightButtons) + } + + topViewController.navigationItem.setRightBarButtonItems(rightItems.count > 0 ? rightItems : nil, animated: !DisableAnimations.boolValue) + } + + @objc func navigationBarModelExists() -> Bool { + // Legacy Navigation + guard let currentViewController = getCurrentDetailViewController(), + let _ = navigationController?.getNavigationModel(from: currentViewController) else { return false } + return true + } + + /// Convenience function to update the navigation bar if the controller is the current lowest controller. + @objc func updateNavigationBarFor(viewController: UIViewController) { + guard let navigationController = navigationController, + navigationController.isDisplayed(viewController: viewController), + let model = navigationController.getNavigationModel(from: viewController) else { return } +<<<<<<< HEAD + set(for: viewController, navigationController: navigationController, navigationItemModel: model) + guard !(topAlertView?.overridingStatusBar() ?? false) else { return } + setStatusBarForCurrentViewController() + } + + /// Returns the bar style for the background color. Light if on a dark background, otherwise default. + func getStatusBarStyle(for backgroundColor: UIColor?) -> UIStatusBarStyle { + var greyScale: CGFloat = 0 + if backgroundColor?.getWhite(&greyScale, alpha: nil) == true, + greyScale < 0.5 { return .lightContent } + return .default + } + + /// Updates the status bar background color and style. + @objc func setStatusBarForCurrentViewController() { + let viewController = getCurrentViewController() as? MVMCoreUIDetailViewProtocol + let backgroundColor = viewController?.defaultStatusBarBackgroundColor?() ?? + navigationController?.navigationBar.standardAppearance.backgroundColor ?? + statusBarView?.backgroundColor + + let style = viewController?.defaultStatusBarStyle?() ?? + getStatusBarStyle(for: backgroundColor) + + setStatusBarBackgroundColor(backgroundColor, style: style) +======= + setNavigationBar(for: viewController, navigationController: navigationController, navigationItemModel: model) +>>>>>>> feature/develop_mvp_3 + } +} + +extension MVMCoreUISplitViewController: MVMCoreViewManagerProtocol { + public func getCurrentViewController() -> UIViewController? { + navigationController?.getCurrentViewController() + } + + public func containsPage(withPageType pageType: String?) -> Bool { + navigationController?.containsPage(withPageType: pageType) ?? false + } + + public func displayedViewController(_ viewController: UIViewController) { + setupPanels() + updateNavigationBarFor(viewController: viewController) + } + + public func newDataReceived(in viewController: UIViewController) { + updateNavigationBarFor(viewController: viewController) + } +} diff --git a/MVMCoreUI/Styles/Styler.swift b/MVMCoreUI/Styles/Styler.swift index 77402295..4da119fc 100644 --- a/MVMCoreUI/Styles/Styler.swift +++ b/MVMCoreUI/Styles/Styler.swift @@ -156,10 +156,10 @@ open class Styler { } } else { if isBold() { - return size >= 15 ? MFFonts.mfFontDSBold(size) : MFFonts.mfFontTXBold(size) + return size >= 13 ? MFFonts.mfFontDSBold(size) : MFFonts.mfFontTXBold(size) } else { - return size >= 15 ? MFFonts.mfFontDSRegular(size) : MFFonts.mfFontTXRegular(size) + return size >= 13 ? MFFonts.mfFontDSRegular(size) : MFFonts.mfFontTXRegular(size) } } } From 21ee88c5f429121c0455a778f205012c68dc50b4 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Tue, 15 Mar 2022 16:57:21 -0400 Subject: [PATCH 03/18] remove --- .../NavigationController.swift.orig | 213 ------------------ ...UISplitViewController+Extension.swift.orig | 168 -------------- 2 files changed, 381 deletions(-) delete mode 100644 MVMCoreUI/Containers/NavigationController/NavigationController.swift.orig delete mode 100644 MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift.orig diff --git a/MVMCoreUI/Containers/NavigationController/NavigationController.swift.orig b/MVMCoreUI/Containers/NavigationController/NavigationController.swift.orig deleted file mode 100644 index 30357881..00000000 --- a/MVMCoreUI/Containers/NavigationController/NavigationController.swift.orig +++ /dev/null @@ -1,213 +0,0 @@ -// -// NavigationController.swift -// MVMCoreUI -// -// Created by Scott Pfeil on 10/24/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import UIKit - -@objcMembers open class NavigationController: UINavigationController, MVMCoreViewManagerViewControllerProtocol { - public weak var manager: (UIViewController & MVMCoreViewManagerProtocol)? - - /// Getter for the main navigation controller - public static func navigationController() -> Self? { - return MVMCoreActionUtility.initializerClassCheck(MVMCoreUISession.sharedGlobal()?.navigationController, classToVerify: self) as? Self - } - - /// Sets up the application with a navigation controller - public static func setupNavigationController() -> Self? { - let navigationController = self.init() - MVMCoreUISession.sharedGlobal()?.navigationController = navigationController - MVMCoreNavigationHandler.shared()?.viewControllerToPresentOn = navigationController - MVMCoreNavigationHandler.shared()?.navigationController = navigationController - MVMCoreNavigationHandler.shared()?.addDelegate(navigationController) - navigationController.setNavigationBarUI(with: NavigationItemModel()) - return navigationController - } - - /// Sets up the application with a navigation controller as the main container. - public static func setupNavigationControllerAsMainController() -> Self? { - guard let navigationController = setupNavigationController() else { return nil } - MVMCoreUISession.sharedGlobal()?.setup(asStandardLoadViewDelegate: navigationController) - return navigationController - } - -<<<<<<< HEAD:MVMCoreUI/Containers/NavigationController.swift - /// Convenience function for setting the navigation item. - public static func setNavigationItem(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { - viewController.navigationItem.title = navigationItemModel.title - viewController.navigationItem.accessibilityLabel = navigationItemModel.title - viewController.navigationItem.hidesBackButton = navigationItemModel.hidesSystemBackButton - viewController.navigationItem.leftItemsSupplementBackButton = !navigationItemModel.hidesSystemBackButton - setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) - setNavigationTitleView(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) - } - - /// Convenience function for setting the navigation buttons. - public static func setNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { - let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject - var leftItems: [UIBarButtonItem] = [] - if navigationItemModel.hidesSystemBackButton, - navigationItemModel.alwaysShowBackButton != false { - if let backButtonModel = navigationItemModel.backButton, - MVMCoreNavigationHandler.shared()?.getViewControllers(for: navigationController)?.count ?? 0 > 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 - - var rightItems: [UIBarButtonItem] = [] - if let rightItemModels = navigationItemModel.additionalRightButtons { - for item in rightItemModels { - rightItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) - } - } - viewController.navigationItem.rightBarButtonItems = rightItems.count > 0 ? rightItems : nil - } - - static func getNavigationBarShadowImage(for navigationItemModel: NavigationItemModelProtocol) -> UIImage? { - guard let thickness = navigationItemModel.line?.thickness, - let backgroundColor = navigationItemModel.line?.backgroundColor else { return nil } - return backgroundColor.uiColor.image(CGSize(width: thickness, height: thickness)) - } - - /// Convenience function for setting the navigation bar ui, except for the buttons. - public static func setNavigationBarUI(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol) { - let navigationBar = navigationController.navigationBar - let font = MFStyler.fontBoldBodySmall(false) - let backgroundColor = navigationItemModel.backgroundColor?.uiColor - let tint = navigationItemModel.tintColor.uiColor - navigationBar.tintColor = tint - - let appearance = UINavigationBarAppearance() - appearance.configureWithOpaqueBackground() - appearance.titleTextAttributes = [NSAttributedString.Key.font: font, - NSAttributedString.Key.foregroundColor: tint]; - appearance.backgroundColor = backgroundColor - appearance.titleTextAttributes.updateValue(tint, forKey: .foregroundColor) - appearance.titlePositionAdjustment = navigationItemModel.titleOffset ?? .zero - appearance.shadowColor = navigationItemModel.line?.backgroundColor?.uiColor ?? .clear - appearance.shadowImage = getNavigationBarShadowImage(for: navigationItemModel)?.withRenderingMode(.alwaysTemplate) - navigationBar.standardAppearance = appearance - navigationBar.scrollEdgeAppearance = appearance - - navigationController.setNavigationBarHidden(navigationItemModel.hidden, animated: true) - } - - /// Convenience function for setting the navigation titleView. - public static func setNavigationTitleView(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { - let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject - if let titleViewModel = navigationItemModel?.titleView, let molecule = ModelRegistry.createMolecule(titleViewModel, delegateObject: delegate, additionalData: nil) { - viewController.navigationItem.titleView = molecule - } - } - -======= ->>>>>>> feature/develop_mvp_3:MVMCoreUI/Containers/NavigationController/NavigationController.swift - /// Convenience function to return the navigation model of the lowest controller traversing managers if applicable. - public func getNavigationModel(from viewController: UIViewController) -> NavigationItemModelProtocol? { - return (viewController as? PageProtocol)?.pageModel?.navigationBar - } - - /// Verifies the controller is the currently displayed controller. - public func isDisplayed(viewController: UIViewController) -> Bool { - guard let topViewController = topViewController, - viewController == MVMCoreUIUtility.getViewControllerTraversingManagers(topViewController) else { - return false - } - return true - } -} - -extension NavigationController: MVMCoreViewManagerProtocol { - public func getCurrentViewController() -> UIViewController? { - guard let topViewController = topViewController else { return nil } - return MVMCoreUIUtility.getViewControllerTraversingManagers(topViewController) - } - - public func containsPage(withPageType pageType: String?) -> Bool { - for controller in viewControllers { - if let manager = controller as? MVMCoreViewManagerProtocol, - manager.containsPage(withPageType: pageType) { - return true - } else if let controller = controller as? MVMCoreViewControllerProtocol, - controller.pageType == pageType { - return true - } - } - return false - } - - public func newDataReceived(in viewController: UIViewController) { - - if isDisplayed(viewController: viewController), - let topViewController = topViewController, - let model = getNavigationModel(from: viewController) { - setNavigationItem(with: model, for: topViewController) - setNavigationBarUI(with: model) - } - manager?.newDataReceived?(in: viewController) - } - - public func willDisplay(_ viewController: UIViewController) { - if let topViewController = topViewController, - let model = getNavigationModel(from: viewController) { - setNavigationItem(with: model, for: topViewController) - } - manager?.willDisplay?(viewController) - } - - public func displayedViewController(_ viewController: UIViewController) { - if isDisplayed(viewController: viewController), - let model = getNavigationModel(from: viewController) { - setNavigationBarUI(with: model) - } - manager?.displayedViewController?(viewController) - } -} - -extension NavigationController: MVMCorePresentationDelegateProtocol { - public func navigationController(_ navigationController: UINavigationController, prepareDisplayFor viewController: UIViewController) { - guard self == navigationController, - let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController), - let model = getNavigationModel(from: newViewController) else { return } - setNavigationItem(with: model, for: viewController) - } - - public func navigationController(_ navigationController: UINavigationController, willDisplay viewController: UIViewController) { - guard self == navigationController, - let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController) else { return } - if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) { - MVMCoreViewManagerViewControllerProtocolHelper.helpSetManager(self, viewController: controller) - } - manager?.willDisplay?(newViewController) - } - - public func navigationController(_ navigationController: UINavigationController, displayedViewController viewController: UIViewController) { - guard self == navigationController, - let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController) else { return } - if let model = getNavigationModel(from: newViewController) { - setNavigationBarUI(with: model) - } - manager?.displayedViewController?(newViewController) - if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) { - controller.viewControllerReady?(inManager: self) - } - } -} - -extension UIColor { - func image(_ size: CGSize = CGSize(width: 1, height: 1)) -> UIImage { - return UIGraphicsImageRenderer(size: size).image { rendererContext in - self.setFill() - rendererContext.fill(CGRect(origin: .zero, size: size)) - } - } -} diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift.orig b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift.orig deleted file mode 100644 index 49279b8e..00000000 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift.orig +++ /dev/null @@ -1,168 +0,0 @@ -// -// MVMCoreUISplitViewController+Extension.swift -// MVMCoreUI -// -// Created by Scott Pfeil on 6/18/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation -import UIKit - -// Navigation bar update functions -public extension MVMCoreUISplitViewController { - - /// Convenience function. Sets the navigation and split view properties for the view controller. Panel access is determined if view controller is a detail view protocol. - func setNavigationBar(for viewController: UIViewController, navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol) { - guard navigationController == self.navigationController, - viewController == getCurrentDetailViewController() else { - /// Not the split view navigation controller, skip split functions. - return - } - - setLeftPanelIsAccessible((viewController as? MVMCoreUIDetailViewProtocol)?.isLeftPanelAccessible?() ?? false, for: viewController, updateNavigationButtons: false) - setRightPanelIsAccessible((viewController as? MVMCoreUIDetailViewProtocol)?.isRightPanelAccessible?() ?? false, for: viewController, updateNavigationButtons: false) - - setLeftNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) - setRightNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) - - setNavigationIconColor(navigationItemModel.tintColor.uiColor) - } - - /// Sets the left navigation items for the view controller based on model and splitview. - func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { - guard let topViewController = navigationController.topViewController else { return } - - var leftItems: [UIBarButtonItem] = [] - let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject - - // Add back button first. - if navigationItemModel?.hidesSystemBackButton == true { - var showBackButton: Bool - if let forceBackButton = navigationItemModel?.alwaysShowBackButton { - showBackButton = forceBackButton - } else { - showBackButton = MVMCoreNavigationHandler.shared()?.getViewControllers(for: navigationController)?.count ?? 0 > 1 - } - if showBackButton { - if let backButtonModel = navigationItemModel?.backButton { - leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) - } else if let backButton = backButton { - // Default to legacy if we have default back button. - leftItems.append(backButton) - } - } - } - - // Add the panel button after the back button. - if let panelButton = leftPanelButton, - leftPanelIsAccessible, - !leftPanelStaysExtended() { - leftItems.append(panelButton) - } - - // Add other model buttons - if let leftItemModels = navigationItemModel?.additionalLeftButtons { - for item in leftItemModels { - leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) - } - } - - // Add any buttons added by the splitview. - if let additionalLeftButtons = additionalLeftButtons(for: viewController) { - leftItems.append(contentsOf: additionalLeftButtons) - } - - topViewController.navigationItem.setLeftBarButtonItems(leftItems.count > 0 ? leftItems : nil, animated: !DisableAnimations.boolValue) - } - - /// Sets the right navigation items for the view controller based on model and splitview. - func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { - guard let topViewController = navigationController.topViewController else { return } - - let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject - var rightItems: [UIBarButtonItem] = [] - - // Add the panel button first. - if let panelButton = rightPanelButton, - rightPanelIsAccessible, - !rightPanelStaysExtended() { - rightItems.append(panelButton) - } - - // Add other model buttons - if let rightItemModels = navigationItemModel?.additionalRightButtons { - for item in rightItemModels { - rightItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) - } - } - - // Add any buttons added by the splitview. - if let additionalRightButtons = additionalRightButtons(for: viewController) { - rightItems.append(contentsOf: additionalRightButtons) - } - - topViewController.navigationItem.setRightBarButtonItems(rightItems.count > 0 ? rightItems : nil, animated: !DisableAnimations.boolValue) - } - - @objc func navigationBarModelExists() -> Bool { - // Legacy Navigation - guard let currentViewController = getCurrentDetailViewController(), - let _ = navigationController?.getNavigationModel(from: currentViewController) else { return false } - return true - } - - /// Convenience function to update the navigation bar if the controller is the current lowest controller. - @objc func updateNavigationBarFor(viewController: UIViewController) { - guard let navigationController = navigationController, - navigationController.isDisplayed(viewController: viewController), - let model = navigationController.getNavigationModel(from: viewController) else { return } -<<<<<<< HEAD - set(for: viewController, navigationController: navigationController, navigationItemModel: model) - guard !(topAlertView?.overridingStatusBar() ?? false) else { return } - setStatusBarForCurrentViewController() - } - - /// Returns the bar style for the background color. Light if on a dark background, otherwise default. - func getStatusBarStyle(for backgroundColor: UIColor?) -> UIStatusBarStyle { - var greyScale: CGFloat = 0 - if backgroundColor?.getWhite(&greyScale, alpha: nil) == true, - greyScale < 0.5 { return .lightContent } - return .default - } - - /// Updates the status bar background color and style. - @objc func setStatusBarForCurrentViewController() { - let viewController = getCurrentViewController() as? MVMCoreUIDetailViewProtocol - let backgroundColor = viewController?.defaultStatusBarBackgroundColor?() ?? - navigationController?.navigationBar.standardAppearance.backgroundColor ?? - statusBarView?.backgroundColor - - let style = viewController?.defaultStatusBarStyle?() ?? - getStatusBarStyle(for: backgroundColor) - - setStatusBarBackgroundColor(backgroundColor, style: style) -======= - setNavigationBar(for: viewController, navigationController: navigationController, navigationItemModel: model) ->>>>>>> feature/develop_mvp_3 - } -} - -extension MVMCoreUISplitViewController: MVMCoreViewManagerProtocol { - public func getCurrentViewController() -> UIViewController? { - navigationController?.getCurrentViewController() - } - - public func containsPage(withPageType pageType: String?) -> Bool { - navigationController?.containsPage(withPageType: pageType) ?? false - } - - public func displayedViewController(_ viewController: UIViewController) { - setupPanels() - updateNavigationBarFor(viewController: viewController) - } - - public func newDataReceived(in viewController: UIViewController) { - updateNavigationBarFor(viewController: viewController) - } -} From 3dabba57df7a63da41cbf6e0e49b01fc22dd3bfa Mon Sep 17 00:00:00 2001 From: "Bruce, Matt R" Date: Mon, 21 Mar 2022 13:13:40 +0000 Subject: [PATCH 04/18] Fixed Crash on securetext in TextEntryField --- .../Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift | 4 ++++ .../Atomic/Atoms/FormFields/TextFields/TextEntryField.swift | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift index a0de9d1f..2e098ad9 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift @@ -249,6 +249,10 @@ import UIKit //-------------------------------------------------- // MARK: - Methods //-------------------------------------------------- + public override func showErrorView(_ show: Bool) { + //do nothing since you should show the error view + //within a digitEntryField + } @objc public func setAsSecureTextEntry(_ secureEntry: Bool) { diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryField.swift index 89e17169..d081b717 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextEntryField.swift @@ -84,7 +84,7 @@ import UIKit textField.accessibilityValue = nil } - if textField.isSecureTextEntry { + if !textField.isSecureTextEntry { showErrorView(error) } @@ -294,8 +294,7 @@ import UIKit resignFirstResponder() } - private func showErrorView(_ show: Bool) { - + open func showErrorView(_ show: Bool) { if show { entryFieldContainer.addSubview(errorImage) From bf70c6b15b4cae3f494e931bb97231795f4d9eeb Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Wed, 23 Mar 2022 11:29:44 -0400 Subject: [PATCH 05/18] Fixes subnav titles for legacy controllers. --- MVMCoreUI/Managers/SubNav/SubNavManagerController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift index c33d0238..ae733fa6 100644 --- a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift +++ b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift @@ -208,7 +208,7 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, } /// Handles when the controller has committed to be changed. - private func commitTo(controller: UIViewController) { + open func commitTo(controller: UIViewController) { guard let index = index, index != tabs.selectedIndex else { return } viewController = controller From 5a331429342b0d6c416c77182813e27ca4b59596 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Fri, 25 Mar 2022 01:20:22 +0530 Subject: [PATCH 06/18] Changes to read imageRenderingMode parameter from model sent from server. --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++- .../UIImageRenderingMode+Extension.swift | 59 +++++++++++++++++++ .../Buttons/ImageBarButtonItem.swift | 7 ++- .../Buttons/NavigationImageButtonModel.swift | 6 ++ 4 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 MVMCoreUI/Atomic/Extensions/UIImageRenderingMode+Extension.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index a6588ea8..1c042443 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -145,6 +145,7 @@ 32D2609724C19E2100B56344 /* LockupsPlanSMLXLModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32D2609524C19E2100B56344 /* LockupsPlanSMLXLModel.swift */; }; 32F8804624765C6E00C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32F8804524765C6E00C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinksModel.swift */; }; 32F8804824765C8400C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32F8804724765C8400C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinks.swift */; }; + 4457904E27ECE989002B1E1E /* UIImageRenderingMode+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4457904D27ECE989002B1E1E /* UIImageRenderingMode+Extension.swift */; }; 522679C123FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */; }; 522679C223FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679C023FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */; }; 52267A0723FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */; }; @@ -272,8 +273,8 @@ AAE7270E24AC8B9300A3ED0E /* HeadersH2CaretLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE7270D24AC8B9300A3ED0E /* HeadersH2CaretLink.swift */; }; AAE96FA225341F6A0037A989 /* ListStoreLocatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE96FA125341F6A0037A989 /* ListStoreLocatorModel.swift */; }; AAE96FA525341F7D0037A989 /* ListStoreLocator.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE96FA425341F7D0037A989 /* ListStoreLocator.swift */; }; - AFE4A1D627DFBB6F00C458D0 /* UINavigationController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFE4A1D527DFBB6F00C458D0 /* UINavigationController+Extension.swift */; }; AFE4A1D127DFB5EE00C458D0 /* VDSColorTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = AFE4A1D027DFB5EE00C458D0 /* VDSColorTokens.xcframework */; }; + AFE4A1D627DFBB6F00C458D0 /* UINavigationController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFE4A1D527DFBB6F00C458D0 /* UINavigationController+Extension.swift */; }; BB105859248DEFF70069D008 /* UICollectionViewLeftAlignedLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */; }; BB1D17E0244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */; }; BB1D17E2244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */; }; @@ -732,6 +733,7 @@ 32D2609524C19E2100B56344 /* LockupsPlanSMLXLModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockupsPlanSMLXLModel.swift; sourceTree = ""; }; 32F8804524765C6E00C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableNumberedListAllTextAndLinksModel.swift; sourceTree = ""; }; 32F8804724765C8400C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableNumberedListAllTextAndLinks.swift; sourceTree = ""; }; + 4457904D27ECE989002B1E1E /* UIImageRenderingMode+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImageRenderingMode+Extension.swift"; sourceTree = ""; }; 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = ""; }; 522679C023FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinksModel.swift; sourceTree = ""; }; 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinks.swift; sourceTree = ""; }; @@ -859,8 +861,8 @@ AAE7270D24AC8B9300A3ED0E /* HeadersH2CaretLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2CaretLink.swift; sourceTree = ""; }; AAE96FA125341F6A0037A989 /* ListStoreLocatorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListStoreLocatorModel.swift; sourceTree = ""; }; AAE96FA425341F7D0037A989 /* ListStoreLocator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListStoreLocator.swift; sourceTree = ""; }; - AFE4A1D527DFBB6F00C458D0 /* UINavigationController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extension.swift"; sourceTree = ""; }; AFE4A1D027DFB5EE00C458D0 /* VDSColorTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSColorTokens.xcframework; path = ../SharedFrameworks/VDSColorTokens.xcframework; sourceTree = ""; }; + AFE4A1D527DFBB6F00C458D0 /* UINavigationController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extension.swift"; sourceTree = ""; }; BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionViewLeftAlignedLayout.swift; sourceTree = ""; }; BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMediumModel.swift; sourceTree = ""; }; BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMedium.swift; sourceTree = ""; }; @@ -1563,6 +1565,7 @@ D2ED27E6254B0CE600A1C293 /* UIAlertActionStyle+Codable.swift */, D2ED27E7254B0CE600A1C293 /* UIAlertControllerStyle+Extension.swift */, D2E0FFF726AF68530085D696 /* UITableViewRowAnimation+Extension.swift */, + 4457904D27ECE989002B1E1E /* UIImageRenderingMode+Extension.swift */, ); path = Extensions; sourceTree = ""; @@ -2919,6 +2922,7 @@ C6FA7D5323C77A4A00A3614A /* StringAndMoleculeStack.swift in Sources */, 32F8804624765C6E00C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinksModel.swift in Sources */, 011D958524042432000E3791 /* RulesProtocol.swift in Sources */, + 4457904E27ECE989002B1E1E /* UIImageRenderingMode+Extension.swift in Sources */, D23118B325124E18001C8440 /* Notification.swift in Sources */, AA9972502475309F00FC7472 /* ListLeftVariableIconAllTextLinksModel.swift in Sources */, AA69AAF62445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Extensions/UIImageRenderingMode+Extension.swift b/MVMCoreUI/Atomic/Extensions/UIImageRenderingMode+Extension.swift new file mode 100644 index 00000000..21a1cea2 --- /dev/null +++ b/MVMCoreUI/Atomic/Extensions/UIImageRenderingMode+Extension.swift @@ -0,0 +1,59 @@ +// +// UIImageRenderingMode+Extension.swift +// MVMCoreUI +// +// Created by Nadigadda, Sumanth on 24/03/22. +// Copyright © 2022 Verizon Wireless. All rights reserved. +// + +import Foundation +import UIKit + +enum RenderingModeError: Error { + case notAnRenderingMode +} + +extension UIImage.RenderingMode: RawRepresentable { + + init?(rawValue: String) { + switch rawValue { + case "alwaysOriginal": + self = .alwaysOriginal + case "alwaysTemplate": + self = .alwaysTemplate + case "automatic": + self = .automatic + default: + return nil + } + } + + var rawValueString: String { + switch self { + case .alwaysOriginal: + return "alwaysOriginal" + case .alwaysTemplate: + return "alwaysTemplate" + case .automatic: + return "automatic" + @unknown default: + return "" + } + } +} + +extension UIImage.RenderingMode: Codable { + public init(from decoder: Decoder) throws { + let typeContainer = try decoder.singleValueContainer() + let string = try typeContainer.decode(String.self) + guard let renderingMode = UIImage.RenderingMode(rawValue: string) else { + throw RenderingModeError.notAnRenderingMode + } + self = renderingMode + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode(rawValueString) + } +} diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift index 50676cbc..634a6f6b 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift @@ -12,16 +12,17 @@ // MARK: - Initializers //-------------------------------------------------- - public static func create(with image: UIImage?) -> Self { + public static func create(with image: UIImage?, renderingMode: UIImage.RenderingMode = .alwaysTemplate) -> Self { let actionObject = ActionDelegate() - let button = self.init(image: image, style: .plain, target: actionObject, action: #selector(actionObject.callActionBlock)) + let button = self.init(image: image?.withRenderingMode(renderingMode), style: .plain, target: actionObject, action: #selector(actionObject.callActionBlock)) button.actionDelegate = actionObject return button } /// Creates the item with the passed in action. public static func create(with image: UIImage?, model: MoleculeModelProtocol & NavigationButtonModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Self { - let button = create(with: image) + let imageModel = model as? NavigationImageButtonModel + let button = create(with: image, renderingMode: imageModel?.imageRenderingMode ?? .alwaysTemplate) button.set(with: model, delegateObject: delegateObject, additionalData: additionalData) return button } diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/NavigationImageButtonModel.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/NavigationImageButtonModel.swift index 8ba75d1a..64000dc9 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/NavigationImageButtonModel.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/NavigationImageButtonModel.swift @@ -5,6 +5,8 @@ // Created by Scott Pfeil on 5/18/20. // +import UIKit + public class NavigationImageButtonModel: NavigationButtonModelProtocol, MoleculeModelProtocol { //-------------------------------------------------- @@ -17,6 +19,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule public var image: String public var action: ActionModelProtocol public var accessibilityText: String? + public var imageRenderingMode: UIImage.RenderingMode? //-------------------------------------------------- // MARK: - Initializer @@ -37,6 +40,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule case accessibilityIdentifier case moleculeName case accessibilityText + case imageRenderingMode } //-------------------------------------------------- @@ -49,6 +53,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule image = try typeContainer.decode(String.self, forKey: .image) action = try typeContainer.decodeModel(codingKey: .action) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) + imageRenderingMode = try typeContainer.decodeIfPresent(UIImage.RenderingMode.self, forKey: .imageRenderingMode) } open func encode(to encoder: Encoder) throws { @@ -58,6 +63,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule try container.encode(moleculeName, forKey: .moleculeName) try container.encodeModel(action, forKey: .action) try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText) + try container.encodeIfPresent(imageRenderingMode, forKey: .imageRenderingMode) } //-------------------------------------------------- From ced4728ca0ecb133cd4b5d2a0daa3f47fe70b5a5 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Thu, 24 Mar 2022 18:59:40 -0400 Subject: [PATCH 07/18] move navigation bar setter to pre-animation for smoothness --- .../NavigationController.swift | 17 ++++++----------- ...MVMCoreUISplitViewController+Extension.swift | 2 +- .../SubNav/SubNavManagerController.swift | 9 +++++++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/MVMCoreUI/Containers/NavigationController/NavigationController.swift b/MVMCoreUI/Containers/NavigationController/NavigationController.swift index 03c10595..644dee73 100644 --- a/MVMCoreUI/Containers/NavigationController/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController/NavigationController.swift @@ -69,7 +69,6 @@ extension NavigationController: MVMCoreViewManagerProtocol { } public func newDataReceived(in viewController: UIViewController) { - if isDisplayed(viewController: viewController), let topViewController = topViewController, let model = getNavigationModel(from: viewController) { @@ -81,44 +80,40 @@ extension NavigationController: MVMCoreViewManagerProtocol { public func willDisplay(_ viewController: UIViewController) { if let topViewController = topViewController, + isDisplayed(viewController: viewController), let model = getNavigationModel(from: viewController) { setNavigationItem(with: model, for: topViewController) + setNavigationBarUI(with: model) } manager?.willDisplay?(viewController) } public func displayedViewController(_ viewController: UIViewController) { - if isDisplayed(viewController: viewController), - let model = getNavigationModel(from: viewController) { - setNavigationBarUI(with: model) - } manager?.displayedViewController?(viewController) } } extension NavigationController: MVMCorePresentationDelegateProtocol { public func navigationController(_ navigationController: UINavigationController, prepareDisplayFor viewController: UIViewController) { + if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) { + MVMCoreViewManagerViewControllerProtocolHelper.helpSetManager(self, viewController: controller) + } guard self == navigationController, let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController), let model = getNavigationModel(from: newViewController) else { return } setNavigationItem(with: model, for: viewController) + setNavigationBarUI(with: model) } public func navigationController(_ navigationController: UINavigationController, willDisplay viewController: UIViewController) { guard self == navigationController, let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController) else { return } - if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) { - MVMCoreViewManagerViewControllerProtocolHelper.helpSetManager(self, viewController: controller) - } manager?.willDisplay?(newViewController) } public func navigationController(_ navigationController: UINavigationController, displayedViewController viewController: UIViewController) { guard self == navigationController, let newViewController = MVMCoreUIUtility.getViewControllerTraversingManagers(viewController) else { return } - if let model = getNavigationModel(from: newViewController) { - setNavigationBarUI(with: model) - } manager?.displayedViewController?(newViewController) if let controller = viewController as? (UIViewController & MVMCoreViewManagerViewControllerProtocol) { controller.viewControllerReady?(inManager: self) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index 76afeca8..d2ef03e6 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -153,7 +153,7 @@ extension MVMCoreUISplitViewController: MVMCoreViewManagerProtocol { navigationController?.containsPage(withPageType: pageType) ?? false } - public func displayedViewController(_ viewController: UIViewController) { + public func willDisplay(_ viewController: UIViewController) { setupPanels() updateNavigationBarFor(viewController: viewController) } diff --git a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift index c3be1868..adf11109 100644 --- a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift +++ b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift @@ -121,6 +121,11 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, (viewController as? MVMCoreViewManagerViewControllerProtocol)?.managerWillDisappear?(self) } + open override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + hideNavigationBarLine(true) + } + /// Hides/Shows the navigation bar for the page. open func hideNavigationBarLine(_ isHidden: Bool) { guard self == navigationController?.topViewController else { return } @@ -228,6 +233,7 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, } tabs.selectIndex(index, animated: true) self.index = nil + hideNavigationBarLine(true) } public func navigationController(_ navigationController: UINavigationController, willDisplay viewController: UIViewController) { @@ -262,7 +268,6 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, if let viewController = getCurrentViewController() { manager?.displayedViewController?(viewController) } - hideNavigationBarLine(true) } // MARK: - TabsDelegate @@ -314,11 +319,11 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, public func willDisplay(_ viewController: UIViewController) { manager?.willDisplay?(viewController) + hideNavigationBarLine(true) } public func displayedViewController(_ viewController: UIViewController) { manager?.displayedViewController?(viewController) - hideNavigationBarLine(true) } // MARK: - MVMCoreUISwipeNavigationProtocol From b498c4fb0f252167d7030e536918b65260d8e5e6 Mon Sep 17 00:00:00 2001 From: Nandhini Rajendran Date: Mon, 28 Mar 2022 20:56:24 +0530 Subject: [PATCH 08/18] Fix for entryField --- .../Item Dropdown/ItemDropdownEntryFieldModel.swift | 2 +- MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryField.swift | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/ItemDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/ItemDropdownEntryFieldModel.swift index 02fa342e..75d2c887 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/ItemDropdownEntryFieldModel.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/Dropdown Fields/Item Dropdown/ItemDropdownEntryFieldModel.swift @@ -58,6 +58,6 @@ try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(options, forKey: .options) - try container.encodeIfPresent(options, forKey: .selectedIndex) + try container.encodeIfPresent(selectedIndex, forKey: .selectedIndex) } } diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryField.swift index 4b84e8a1..c583638c 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryField.swift @@ -286,6 +286,7 @@ import UIKit entryFieldContainer.disableAllBorders = false feedbackLabel.text = nil entryFieldContainer.reset() + entryFieldModel?.updateUI = nil } open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { From 71a9b139d3e3486e5867a85d1f7aa5d65e71ec17 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Tue, 29 Mar 2022 18:58:15 +0530 Subject: [PATCH 09/18] Setting default status to Tab bar model. --- .../Molecules/HorizontalCombinationViews/TabBarModel.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift index 95e07a34..3b62210c 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBarModel.swift @@ -52,7 +52,7 @@ open class TabBarModel: MoleculeModelProtocol { } } - open var style: NavigationItemStyle? + open var style: NavigationItemStyle? = .dark // Must be capped to 0...(tabs.count - 1) open var selectedTab: Int = 0 @@ -86,7 +86,9 @@ open class TabBarModel: MoleculeModelProtocol { if let index = try typeContainer.decodeIfPresent(Int.self, forKey: .selectedTab) { selectedTab = index } - style = try typeContainer.decodeIfPresent(NavigationItemStyle.self, forKey: .style) + if let navStyle = try typeContainer.decodeIfPresent(NavigationItemStyle.self, forKey: .style) { + style = navStyle + } } open func encode(to encoder: Encoder) throws { From 2a17e95a60287433394d02d47b67f10f372af289 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Thu, 31 Mar 2022 12:56:13 -0400 Subject: [PATCH 10/18] rounded --- .../Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift index 381b8112..3995a3f7 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift @@ -38,6 +38,7 @@ open class BarsIndicatorView: CarouselIndicator { override func setupView() { super.setupView() isAccessibilityElement = true + layer.cornerRadius = 2 accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint") widthAnchor.constraint(equalToConstant: BarsIndicatorView.IndicatorBar.width).isActive = true accessibilityTraits = .button From 1beb6584b7f3033fb6badfe10919a3d0c10fb9f8 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Sat, 2 Apr 2022 00:59:51 +0530 Subject: [PATCH 11/18] Method to check style of current navigation bar. --- MVMCoreUI/Utility/MVMCoreUIUtility+Extension.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MVMCoreUI/Utility/MVMCoreUIUtility+Extension.swift b/MVMCoreUI/Utility/MVMCoreUIUtility+Extension.swift index aa54760a..ffb74ef9 100644 --- a/MVMCoreUI/Utility/MVMCoreUIUtility+Extension.swift +++ b/MVMCoreUI/Utility/MVMCoreUIUtility+Extension.swift @@ -56,4 +56,13 @@ public extension MVMCoreUIUtility { return findViews(by: type, views: queue) + matching } + + static func visibleNavigationBarStlye() -> NavigationItemStyle? { + if let vc = MVMCoreUIUtility.getCurrentVisibleController(), + let navController = NavigationController.navigationController(), + let navigationBar = navController.getNavigationModel(from: vc) as? NavigationItemModel { + return navigationBar.style + } + return nil + } } From 18f9449e425176986b9d705b6dad9251855fcd14 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Sun, 3 Apr 2022 00:47:52 +0530 Subject: [PATCH 12/18] Modifying line component as part of VDS for brand 3.0 --- MVMCoreUI/Atomic/Atoms/Views/Line.swift | 8 ++++---- MVMCoreUI/Atomic/Atoms/Views/LineModel.swift | 14 +++++++------- .../HeadersAndFooters/MoleculeSectionHeader.swift | 4 ++-- .../MoleculeSectionHeaderModel.swift | 2 +- .../NavigationBar/NavigationItemModel.swift | 2 +- MVMCoreUI/BaseClasses/TableViewCell.swift | 10 +++++----- .../Managers/SubNav/SubNavManagerController.swift | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Line.swift b/MVMCoreUI/Atomic/Atoms/Views/Line.swift index 76016292..d4c4d26d 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Line.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Line.swift @@ -48,17 +48,17 @@ import UIKit public init() { super.init(frame: .zero) - model = LineModel(type: .standard) + model = LineModel(type: .secondary) } public override init(frame: CGRect) { super.init(frame: frame) - model = LineModel(type: .standard) + model = LineModel(type: .secondary) } public required init?(coder: NSCoder) { super.init(coder: coder) - model = LineModel(type: .standard) + model = LineModel(type: .secondary) } public required init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { @@ -106,7 +106,7 @@ import UIKit } open override func reset() { - setStyle(.standard) + setStyle(.secondary) } public override static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift b/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift index f463c0f9..b5b562eb 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift @@ -30,15 +30,15 @@ import VDSColorTokens /** The style of the line: - - standard (1 height, silver) - - thin (1 height, black) + - secondary (1 height, silver) + - primary (1 height, black) - medium (2 height, black) - heavy (4 height, black) - none (hidden) */ public enum Style: String, Codable { - case standard - case thin + case secondary + case primary case medium case heavy case none @@ -49,7 +49,7 @@ import VDSColorTokens //-------------------------------------------------- public static var identifier: String = "line" - public var type: Style = .standard + public var type: Style = .secondary public var frequency: Frequency? = .allExceptTop //TODO: use color insted of backgroundColor. Needs server changes @@ -59,10 +59,10 @@ import VDSColorTokens get { if let backgroundColor = _backgroundColor { return backgroundColor } if inverted { - if type == .standard { return Color(uiColor: VDSColor.interactiveDisabledOndark) } + if type == .secondary { return Color(uiColor: VDSColor.paletteGray20) } return Color(uiColor: VDSColor.elementsPrimaryOndark) } - if type == .standard { return Color(uiColor: VDSColor.interactiveDisabledOnlight) } + if type == .secondary { return Color(uiColor: VDSColor.paletteGray85) } return Color(uiColor: VDSColor.elementsPrimaryOnlight) } set { diff --git a/MVMCoreUI/Atomic/Molecules/HeadersAndFooters/MoleculeSectionHeader.swift b/MVMCoreUI/Atomic/Molecules/HeadersAndFooters/MoleculeSectionHeader.swift index ee80ca46..27bee7b3 100644 --- a/MVMCoreUI/Atomic/Molecules/HeadersAndFooters/MoleculeSectionHeader.swift +++ b/MVMCoreUI/Atomic/Molecules/HeadersAndFooters/MoleculeSectionHeader.swift @@ -22,7 +22,7 @@ import Foundation public override func setupView() { super.setupView() - line.setStyle(.thin) + line.setStyle(.primary) contentView.addSubview(line) NSLayoutConstraint.pinViewBottom(toSuperview: line, useMargins: false, constant: 0).isActive = true NSLayoutConstraint.pinViewLeft(toSuperview: line, useMargins: true, constant: 0).isActive = true @@ -51,7 +51,7 @@ import Foundation open override func reset() { super.reset() - line.setStyle(.thin) + line.setStyle(.primary) molecule?.reset() } diff --git a/MVMCoreUI/Atomic/Molecules/HeadersAndFooters/MoleculeSectionHeaderModel.swift b/MVMCoreUI/Atomic/Molecules/HeadersAndFooters/MoleculeSectionHeaderModel.swift index 18360b30..47db5cbf 100644 --- a/MVMCoreUI/Atomic/Molecules/HeadersAndFooters/MoleculeSectionHeaderModel.swift +++ b/MVMCoreUI/Atomic/Molecules/HeadersAndFooters/MoleculeSectionHeaderModel.swift @@ -42,7 +42,7 @@ bottomPadding = PaddingDefaultVerticalSpacing3 } if line == nil { - line = LineModel(type: .thin) + line = LineModel(type: .primary) } } diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift index c2e1ccc6..523f6ea1 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift @@ -24,7 +24,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc open var title: String? open var hidden = false - open var line: LineModel? = LineModel(type: .standard) + open var line: LineModel? = LineModel(type: .secondary) open var hidesSystemBackButton = true open var style: NavigationItemStyle? diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index d0bb9c7e..551f7572 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -42,13 +42,13 @@ import UIKit switch style { case .standard?: topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.standard) + bottomSeparatorView?.setStyle(.secondary) case .shortDivider?: topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.thin) + bottomSeparatorView?.setStyle(.primary) case .tallDivider?: topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.thin) + bottomSeparatorView?.setStyle(.primary) case .sectionFooter?: topSeparatorView?.setStyle(.none) bottomSeparatorView?.setStyle(.none) @@ -244,8 +244,8 @@ import UIKit topSeparatorView?.set(with: model, delegateObject, additionalData) bottomSeparatorView?.set(with: model, delegateObject, additionalData) } else { - topSeparatorView?.setStyle(.standard) - bottomSeparatorView?.setStyle(.standard) + topSeparatorView?.setStyle(.secondary) + bottomSeparatorView?.setStyle(.secondary) } setSeparatorFrequency(model?.frequency ?? .allExceptTop, indexPath: indexPath) } diff --git a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift index d594dead..b3a142ba 100644 --- a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift +++ b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift @@ -34,7 +34,7 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, }() public lazy var line: Line = { - return Line(model: LineModel(type: .standard), delegateObjectIVar, nil) + return Line(model: LineModel(type: .secondary), delegateObjectIVar, nil) }() public lazy var subNavigationController: UINavigationController = { From 0c54273066624b53de1c55a13e85ff765b2c5800 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Sun, 3 Apr 2022 01:10:16 +0530 Subject: [PATCH 13/18] Setting default image rendering mode to automatic in image bar button --- .../Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift index 634a6f6b..5fa7c195 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift @@ -12,7 +12,7 @@ // MARK: - Initializers //-------------------------------------------------- - public static func create(with image: UIImage?, renderingMode: UIImage.RenderingMode = .alwaysTemplate) -> Self { + public static func create(with image: UIImage?, renderingMode: UIImage.RenderingMode = .automatic) -> Self { let actionObject = ActionDelegate() let button = self.init(image: image?.withRenderingMode(renderingMode), style: .plain, target: actionObject, action: #selector(actionObject.callActionBlock)) button.actionDelegate = actionObject From d10332b372be19e115739c2b0a619992483aee58 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Mon, 4 Apr 2022 22:24:50 +0530 Subject: [PATCH 14/18] modifying image rendering changes in navigation bar --- .../NavigationBar/Buttons/ImageBarButtonItem.swift | 7 +++---- .../Buttons/NavigationImageButtonModel.swift | 8 +++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift index 5fa7c195..50676cbc 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/ImageBarButtonItem.swift @@ -12,17 +12,16 @@ // MARK: - Initializers //-------------------------------------------------- - public static func create(with image: UIImage?, renderingMode: UIImage.RenderingMode = .automatic) -> Self { + public static func create(with image: UIImage?) -> Self { let actionObject = ActionDelegate() - let button = self.init(image: image?.withRenderingMode(renderingMode), style: .plain, target: actionObject, action: #selector(actionObject.callActionBlock)) + let button = self.init(image: image, style: .plain, target: actionObject, action: #selector(actionObject.callActionBlock)) button.actionDelegate = actionObject return button } /// Creates the item with the passed in action. public static func create(with image: UIImage?, model: MoleculeModelProtocol & NavigationButtonModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Self { - let imageModel = model as? NavigationImageButtonModel - let button = create(with: image, renderingMode: imageModel?.imageRenderingMode ?? .alwaysTemplate) + let button = create(with: image) button.set(with: model, delegateObject: delegateObject, additionalData: additionalData) return button } diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/NavigationImageButtonModel.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/NavigationImageButtonModel.swift index 64000dc9..f0b0bbc0 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/NavigationImageButtonModel.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/Buttons/NavigationImageButtonModel.swift @@ -19,7 +19,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule public var image: String public var action: ActionModelProtocol public var accessibilityText: String? - public var imageRenderingMode: UIImage.RenderingMode? + public var imageRenderingMode: UIImage.RenderingMode = .automatic //-------------------------------------------------- // MARK: - Initializer @@ -53,7 +53,9 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule image = try typeContainer.decode(String.self, forKey: .image) action = try typeContainer.decodeModel(codingKey: .action) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) - imageRenderingMode = try typeContainer.decodeIfPresent(UIImage.RenderingMode.self, forKey: .imageRenderingMode) + if let mode = try typeContainer.decodeIfPresent(UIImage.RenderingMode.self, forKey: .imageRenderingMode) { + imageRenderingMode = mode + } } open func encode(to encoder: Encoder) throws { @@ -72,7 +74,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule /// Convenience function that creates a BarButtonItem for the model. public func createNavigationItemButton(delegateObject: MVMCoreUIDelegateObject? = nil, additionalData: [AnyHashable: Any]? = nil) -> UIBarButtonItem { - let uiImage = MVMCoreCache.shared()?.getImageFromRegisteredBundles(image) + let uiImage = MVMCoreCache.shared()?.getImageFromRegisteredBundles(image)?.withRenderingMode(imageRenderingMode) let buttonItem = ImageBarButtonItem.create(with: uiImage, model: self, delegateObject: delegateObject, additionalData: additionalData) buttonItem.accessibilityIdentifier = accessibilityIdentifier ?? image if let accessibilityString = accessibilityText { From 7840cb674f2faf0c044f79428f4afe150a92462f Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Tue, 5 Apr 2022 01:59:55 +0530 Subject: [PATCH 15/18] Adding new back button image for navigation bar --- .../Media.xcassets/nav_back.imageset/Back-1.png | Bin 636 -> 0 bytes .../Media.xcassets/nav_back.imageset/Back-2.png | Bin 906 -> 0 bytes .../Media.xcassets/nav_back.imageset/Back.png | Bin 366 -> 0 bytes .../nav_back.imageset/Contents.json | 12 ++++++------ .../Media.xcassets/nav_back.imageset/nav_back.png | Bin 0 -> 220 bytes .../nav_back.imageset/nav_back@2x.png | Bin 0 -> 302 bytes .../nav_back.imageset/nav_back@3x.png | Bin 0 -> 394 bytes 7 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/Back-1.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/Back-2.png delete mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/Back.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/nav_back.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/nav_back@2x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/nav_back@3x.png diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/Back-1.png b/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/Back-1.png deleted file mode 100644 index 3fae0595ffb9eb65dc865fdc3f8c1d716ca794e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 636 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC#^NA%Cx&(BWL^R}E~ycoX}-P; zT0k}j17mw80}DtA5K93u0|WB{Mh0de%?J`(zyy~ySip>6gB0F2&*1?od*kA+Bp9tg-bQN(tvG2e{9<}EckK%V6$bK?0N>~0&=h|sr-j%f# zSB;NZ8=nhJU7U6BhStKGH0G5>T{8K)3-Z6T?waT$StBP|bE%JO@4? z1L7ZhH9n`#jd$7i`S}mEDL;*Vus(UH|550}wYxhR>Ra=-NpqPpFM0pR6sX$j!2L(j z6I^^9Us~6<=TB8&FEToCU;Cgx%MbS&=}9XLHU4g?Jha_=0<)#igZWb*v@`wT-pA~D zg<(qFtvwH|RZld&;r{Ucho0z6iD-Efd$*3H|t)AMBC#Z}~g^Hi7kB zifzsuE9)0$s<;7Z{Y@fCHZ2?6IcGj!AfjY<##W9TXJYiDgBcS5T2#-2avi#n!rZ64^pUJuggLar+3HYR-XJ;EIr%L_GPQrdVA~ZN0)ty(QgCAyr-+5%Q~lo FCID&k1FHZ4 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/Back-2.png b/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/Back-2.png deleted file mode 100644 index 48ad21763e95d2cb5187c0ef17aa1bb90918901e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 906 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY1|&n@ZgvM!jKx9jP7LeL$-D$|Tv8)E(|mmy zw18|52FCVG1{RPKAeI7R1_tH@j10^`nh_+nfC(<^v49!D1}U6i==Pq0f$58#6uo^_3F;jbqOAehybx4_*0AX-@wuxn;X{tzM;-{o2LKxWgxPY3RJ1Z;y}varonA z<8npm(l_@7%umZ*4s4v^wwFzD|5oP*`Ewe+2ygU`RcCLoZ0VKKW^6cCMv7x`LB9xVrfzP%EFrA1FK-a#Om*>ALpK-qL#hI@i@fG#NI zJ2%7XTol6|*Bhm3ditv$n=m}!J-BmG-)1R>^_=HIOXpNE>`}6~ex)$X(&GBn!Z4-> zs!IC=qW>
  • *JZN5NwI)xv4a4=fMvT-~>shv7WOxgA#Lf*5R6ExunZe8upg<$+DW z@kpkI<1Fbxvgw8la*A&rTk9>q5ZC)7f4ghyud|X)2fUC#&L3-&y=!QdSusmJjA%mNf^<-*oxOX)MiouV%}iDXSIN zI;#5Kn$4zpIai)Z*nGKk`$o2v)!XOkPqZsKoA{9_`lg}Maz`P)>}H8ete4!^RVo{$ zaj!UcGIK)9UeyZcCH*nQ5l2pj?U*<5vI1v*=>$KJzI#re7%h1x6;y~c+Aa@NsC_c) z@MJrlmGOSfDtCImDJku{p7u2kXxPo_1@Btsuz6OP-@2(h^SGz{&SzpNHr*S7&z$-a zkZ&RqCA*}iWKKyb|EBc(SPLaxVb%Gn9uJqQwJ&a}8r#l9xGCxUy>>@?DE?toj@_o|`zD>^VRH18GV=+3A6h!~ZcnlL zro1O1tNYSBsY{GbKYXU=dWrs)yJxW7HM5*GlU+XI)h1ufWPin$^*MpJVx4Xs62CT~ zTBOKYSt3?`;u`(mlf;#d&5N}Uj$HG)U(GjWJ6GnTT{k_2ufL6&wL{M0l1g<7pG%Kz iIcJIWm(-2*>viq_uGRltP}O4s@~fw-pUXO@geCwLQ+o9P diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/Contents.json index 753f15c2..56ae55a3 100644 --- a/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/Contents.json +++ b/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/Contents.json @@ -1,23 +1,23 @@ { "images" : [ { + "filename" : "nav_back.png", "idiom" : "universal", - "filename" : "Back.png", "scale" : "1x" }, { + "filename" : "nav_back@2x.png", "idiom" : "universal", - "filename" : "Back-1.png", "scale" : "2x" }, { + "filename" : "nav_back@3x.png", "idiom" : "universal", - "filename" : "Back-2.png", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/nav_back.png b/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/nav_back.png new file mode 100644 index 0000000000000000000000000000000000000000..895fade7109e9e7ea5b937adaa25e3a8111788aa GIT binary patch literal 220 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9GG!XV7ZFl!D-1!HlL zyA#8@b22Z19F}xPUq=Rpjs4tz5?O)#LQfaRkP61PQ}1#%81S^5pKp7W_s)SmJHzfC z@im!b!`T$NPUJ27^&pP&Eha2Kq$hW$?OVyhGHJ$lg@7~m32}4JxNcp=bkA7EyH?Q6 zIl=!*W5<*UInHi23w8zyC&X8L`^+T7wA=HFOSW>>(eEm}Gx@D;FDkRIS9!t+w4A}y L)z4*}Q$iB}lgCHV literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/nav_back@2x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/nav_back@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..e699cb47470c1e6084ce5374ae7d6d3f49ed5612 GIT binary patch literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC&H|6fVg?2=RS;(M3{v?36l5$8 za(7}_cTVOdki(Mh=%-{4AGgf7Ut8`G{k`18yk^Hgs|7Zn<zopr0GEVw6#xJL literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/nav_back@3x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/nav_back.imageset/nav_back@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..96e839ed04085187d59f599dc2a822c227b6b3b7 GIT binary patch literal 394 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY1|&n@ZgvM!oCO|{#S9FJ79h;%I?XTvD9BhG zE))=%ok5&U^q~kv+SntXN@y&9@qGMHa$DL zqvV;ZeWKs6>I+R;F_-=cgn6=`%!pz zM7Mp!6{R5jC`2g;1xdL-lK9Yh$wr9%WWA=KrWP7HtNgabI7a6KdyFq5!-1 Date: Tue, 5 Apr 2022 21:55:45 +0530 Subject: [PATCH 16/18] Changing bottom tab bar font size. --- .../Atomic/Molecules/HorizontalCombinationViews/TabBar.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index dbea90d7..e7096069 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -58,11 +58,11 @@ import VDSColorTokens /// Sets the item colors. private func set(tabItemAppearance: UITabBarItemAppearance, model: TabBarModel) { tabItemAppearance.normal.iconColor = model.unSelectedColor.uiColor - tabItemAppearance.normal.titleTextAttributes = [NSAttributedString.Key.foregroundColor: model.unSelectedColor.uiColor, NSAttributedString.Key.font: MFFonts.mfFontTXRegular(8)] + tabItemAppearance.normal.titleTextAttributes = [NSAttributedString.Key.foregroundColor: model.unSelectedColor.uiColor, NSAttributedString.Key.font: MFFonts.mfFontTXRegular(10)] tabItemAppearance.normal.titlePositionAdjustment = UIOffset(horizontal: 0, vertical: -3) tabItemAppearance.selected.iconColor = model.selectedColor.uiColor - tabItemAppearance.selected.titleTextAttributes = [NSAttributedString.Key.foregroundColor: model.selectedColor.uiColor, NSAttributedString.Key.font: MFFonts.mfFontTXRegular(8)] + tabItemAppearance.selected.titleTextAttributes = [NSAttributedString.Key.foregroundColor: model.selectedColor.uiColor, NSAttributedString.Key.font: MFFonts.mfFontTXRegular(10)] tabItemAppearance.selected.titlePositionAdjustment = UIOffset(horizontal: 0, vertical: -3) } From 7d027341cb21f9cc1ec7165f47a4d3c636f313a8 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Thu, 7 Apr 2022 01:24:38 +0530 Subject: [PATCH 17/18] updating the accessory view from cart view to pealing arrow. --- MVMCoreUI/BaseClasses/TableViewCell.swift | 30 ++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index 551f7572..a80969ba 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -19,7 +19,7 @@ import UIKit public let containerHelper = ContainerHelper() // For the accessory view convenience. - private var caretView: CaretView? + private var caretView: UIImageView? private var caretViewWidthSizeObject: MFSizeObject? private var caretViewHeightSizeObject: MFSizeObject? @@ -185,20 +185,22 @@ import UIKit @objc public func addCaretViewAccessory() { guard accessoryView == nil else { return } + + let peakingImageView = UIImageView(image: MVMCoreUIUtility.imageNamed("peakingRightArrow")?.withRenderingMode(.alwaysTemplate)) - let caret = CaretView(lineWidth: 1) - caret.translatesAutoresizingMaskIntoConstraints = true - caret.isAccessibilityElement = true - caret.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint") - caret.accessibilityTraits = .button - caret.size = .small(.vertical) - if let size = caret.size?.dimensions() { - caret.frame = CGRect(origin: .zero, size: size) - caretViewWidthSizeObject = MFSizeObject(standardSize: size.width, standardiPadPortraitSize: 9) - caretViewHeightSizeObject = MFSizeObject(standardSize: size.height, standardiPadPortraitSize: 16) - } - caretView = caret - accessoryView = caret + peakingImageView.translatesAutoresizingMaskIntoConstraints = true + peakingImageView.alpha = 0 + peakingImageView.tintColor = .black + peakingImageView.isAccessibilityElement = true + peakingImageView.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint") + peakingImageView.accessibilityTraits = .button + let accessorySize = CGRect(origin: .zero, size: CGSize(width: 13.3, height: 13.3)) + peakingImageView.frame = accessorySize + caretViewWidthSizeObject = MFSizeObject(standardSize: accessorySize.width, standardiPadPortraitSize: 16.6) + caretViewHeightSizeObject = MFSizeObject(standardSize: accessorySize.height, standardiPadPortraitSize: 16.6) + caretView = peakingImageView + + accessoryView = peakingImageView } /// NOTE: Should only be called when displayed or about to be displayed. From c691b6add612d3e3ebb095293e67f4a6feebea7d Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Thu, 7 Apr 2022 23:33:55 +0530 Subject: [PATCH 18/18] Changes to swap store buttons with shop cart button in navigation bar --- .../MVMCoreUISplitViewController+Extension.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index d2ef03e6..12935302 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -90,6 +90,11 @@ public extension MVMCoreUISplitViewController { rightItems.append(panelButton) } + // Add any buttons added by the splitview. + if let additionalRightButtons = additionalRightButtons(for: viewController) { + rightItems.append(contentsOf: additionalRightButtons) + } + // Add other model buttons if let rightItemModels = navigationItemModel?.additionalRightButtons { for item in rightItemModels { @@ -97,11 +102,6 @@ public extension MVMCoreUISplitViewController { } } - // Add any buttons added by the splitview. - if let additionalRightButtons = additionalRightButtons(for: viewController) { - rightItems.append(contentsOf: additionalRightButtons) - } - topViewController.navigationItem.setRightBarButtonItems(rightItems.count > 0 ? rightItems : nil, animated: !DisableAnimations.boolValue) }