Merge branch 'feature/develop_mvp_3' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/VDS_Button

This commit is contained in:
Sumanth Nadigadda 2022-04-10 23:08:17 +05:30
commit 6138328383
30 changed files with 224 additions and 111 deletions

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 48;
objectVersion = 52;
objects = {
/* Begin PBXBuildFile section */
@ -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,6 +273,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 */; };
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 */; };
@ -731,6 +733,7 @@
32D2609524C19E2100B56344 /* LockupsPlanSMLXLModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockupsPlanSMLXLModel.swift; sourceTree = "<group>"; };
32F8804524765C6E00C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableNumberedListAllTextAndLinksModel.swift; sourceTree = "<group>"; };
32F8804724765C8400C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableNumberedListAllTextAndLinks.swift; sourceTree = "<group>"; };
4457904D27ECE989002B1E1E /* UIImageRenderingMode+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImageRenderingMode+Extension.swift"; sourceTree = "<group>"; };
522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = "<group>"; };
522679C023FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinksModel.swift; sourceTree = "<group>"; };
52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinks.swift; sourceTree = "<group>"; };
@ -858,6 +861,7 @@
AAE7270D24AC8B9300A3ED0E /* HeadersH2CaretLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2CaretLink.swift; sourceTree = "<group>"; };
AAE96FA125341F6A0037A989 /* ListStoreLocatorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListStoreLocatorModel.swift; sourceTree = "<group>"; };
AAE96FA425341F7D0037A989 /* ListStoreLocator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListStoreLocator.swift; sourceTree = "<group>"; };
AFE4A1D027DFB5EE00C458D0 /* VDSColorTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSColorTokens.xcframework; path = ../SharedFrameworks/VDSColorTokens.xcframework; sourceTree = "<group>"; };
AFE4A1D527DFBB6F00C458D0 /* UINavigationController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extension.swift"; sourceTree = "<group>"; };
BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionViewLeftAlignedLayout.swift; sourceTree = "<group>"; };
BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMediumModel.swift; sourceTree = "<group>"; };
@ -1183,6 +1187,7 @@
buildActionMask = 2147483647;
files = (
D29DF0E621E4F3C7003B2FB9 /* MVMCore.framework in Frameworks */,
AFE4A1D127DFB5EE00C458D0 /* VDSColorTokens.xcframework in Frameworks */,
9455B19C234F8A0400A574DB /* MVMAnimationFramework.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -1560,6 +1565,7 @@
D2ED27E6254B0CE600A1C293 /* UIAlertActionStyle+Codable.swift */,
D2ED27E7254B0CE600A1C293 /* UIAlertControllerStyle+Extension.swift */,
D2E0FFF726AF68530085D696 /* UITableViewRowAnimation+Extension.swift */,
4457904D27ECE989002B1E1E /* UIImageRenderingMode+Extension.swift */,
);
path = Extensions;
sourceTree = "<group>";
@ -2013,6 +2019,7 @@
D29DF0E421E4F3C7003B2FB9 /* Frameworks */ = {
isa = PBXGroup;
children = (
AFE4A1D027DFB5EE00C458D0 /* VDSColorTokens.xcframework */,
D29DF0E521E4F3C7003B2FB9 /* MVMCore.framework */,
9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */,
);
@ -2915,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 */,
@ -3280,7 +3288,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 = "";
@ -3303,7 +3312,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)";
@ -3330,7 +3343,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)";

View File

@ -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) {

View File

@ -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)
}
}

View File

@ -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]?) {

View File

@ -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)

View File

@ -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

View File

@ -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? {

View File

@ -7,7 +7,7 @@
//
import UIKit
import VDSColorTokens
@objcMembers public class LineModel: MoleculeModelProtocol {
//--------------------------------------------------
@ -30,15 +30,15 @@ import UIKit
/**
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 UIKit
//--------------------------------------------------
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
@ -57,10 +57,13 @@ import UIKit
private var _backgroundColor: Color?
public var backgroundColor: Color? {
get {
if inverted { return backgroundColor_inverted }
if let backgroundColor = _backgroundColor { return backgroundColor }
if type == .standard { return Color(uiColor: .mvmCoolGray3) }
return Color(uiColor: .mvmBlack)
if inverted {
if type == .secondary { return Color(uiColor: VDSColor.paletteGray20) }
return Color(uiColor: VDSColor.elementsPrimaryOndark)
}
if type == .secondary { return Color(uiColor: VDSColor.paletteGray85) }
return Color(uiColor: VDSColor.elementsPrimaryOnlight)
}
set {
_backgroundColor = newValue
@ -87,7 +90,6 @@ import UIKit
}
}
public var backgroundColor_inverted: Color = Color(uiColor: .mvmWhite)
public var inverted: Bool = false
// Use this to show vertical line
@ -144,10 +146,6 @@ 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)
@ -160,7 +158,6 @@ import UIKit
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(useVerticalLine, forKey: .useVerticalLine)
try container.encodeIfPresent(_thickness, forKey: .thickness)
}

View File

@ -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)
}
}

View File

@ -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()
}

View File

@ -42,7 +42,7 @@
bottomPadding = PaddingDefaultVerticalSpacing3
}
if line == nil {
line = LineModel(type: .thin)
line = LineModel(type: .primary)
}
}

View File

@ -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,16 +49,20 @@
}
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.
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)
}

View File

@ -7,6 +7,7 @@
//
import Foundation
import VDSColorTokens
open class TabBarModel: MoleculeModelProtocol {
public static var identifier: String = "tabBar"
@ -17,8 +18,8 @@ open class TabBarModel: MoleculeModelProtocol {
get {
if let backgroundColor = _backgroundColor { return backgroundColor }
if let style = style,
style == .dark { return Color(uiColor: .mvmBlack) }
return Color(uiColor: .mvmWhite)
style == .dark { return Color(uiColor: VDSColor.backgroundPrimaryDark) }
return Color(uiColor: VDSColor.backgroundPrimaryLight)
}
set {
_backgroundColor = newValue
@ -30,8 +31,8 @@ open class TabBarModel: MoleculeModelProtocol {
get {
if let selectedColor = _selectedColor { return selectedColor }
if let style = style,
style == .dark { return Color(uiColor: .mvmWhite) }
return Color(uiColor: .mvmBlack)
style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) }
return Color(uiColor: VDSColor.elementsPrimaryOnlight)
}
set {
_selectedColor = newValue
@ -41,15 +42,17 @@ open class TabBarModel: MoleculeModelProtocol {
private var _unSelectedColor: Color?
open var unSelectedColor: Color {
get {
if let unselectedColor = _unSelectedColor { return unselectedColor }
return Color(uiColor: .mvmCoolGray6)
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?
open var style: NavigationItemStyle? = .dark
// Must be capped to 0...(tabs.count - 1)
open var selectedTab: Int = 0
@ -83,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 {

View File

@ -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)
}
@ -168,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
}
@ -331,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 = tabsModel?.unselectedColor.uiColor ?? .mvmCoolGray6
label.textColor = tabsModel.unselectedColor.uiColor
}
updateAccessibility(indexPath: indexPath, selected: selected, tabsModel: tabsModel)
}

View File

@ -7,6 +7,7 @@
//
import UIKit
import VDSColorTokens
open class TabsModel: MoleculeModelProtocol {
public static var identifier: String = "tabs"
@ -19,8 +20,8 @@ open class TabsModel: MoleculeModelProtocol {
get {
if let backgroundColor = _backgroundColor { return backgroundColor }
if let style = style,
style == .dark { return Color(uiColor: .mvmBlack) }
return Color(uiColor: .mvmWhite)
style == .dark { return Color(uiColor: VDSColor.backgroundPrimaryDark) }
return Color(uiColor: VDSColor.backgroundPrimaryLight)
}
set {
_backgroundColor = newValue
@ -32,8 +33,8 @@ open class TabsModel: MoleculeModelProtocol {
get {
if let selectedColor = _selectedColor { return selectedColor }
if let style = style,
style == .dark { return Color(uiColor: .mvmWhite) }
return Color(uiColor: .mvmBlack)
style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) }
return Color(uiColor: VDSColor.elementsPrimaryOnlight)
}
set {
_selectedColor = newValue
@ -44,7 +45,9 @@ open class TabsModel: MoleculeModelProtocol {
open var unselectedColor: Color {
get {
if let unselectedColor = _unselectedColor { return unselectedColor }
return Color(uiColor: .mvmCoolGray6)
if let style = style,
style == .dark { return Color(uiColor: VDSColor.elementsSecondaryOndark) }
return Color(uiColor: VDSColor.elementsSecondaryOnlight)
}
set {
_unselectedColor = newValue
@ -56,8 +59,8 @@ open class TabsModel: MoleculeModelProtocol {
get {
if let selectedBarColor = _selectedBarColor { return selectedBarColor }
if let style = style,
style == .dark { return Color(uiColor: .mvmWhite) }
return Color(uiColor: .mvmRed)
style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) }
return Color(uiColor: VDSColor.paletteRed)
}
set {
_selectedBarColor = newValue

View File

@ -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 = .automatic
//--------------------------------------------------
// MARK: - Initializer
@ -37,6 +40,7 @@ public class NavigationImageButtonModel: NavigationButtonModelProtocol, Molecule
case accessibilityIdentifier
case moleculeName
case accessibilityText
case imageRenderingMode
}
//--------------------------------------------------
@ -49,6 +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)
if let mode = try typeContainer.decodeIfPresent(UIImage.RenderingMode.self, forKey: .imageRenderingMode) {
imageRenderingMode = mode
}
}
open func encode(to encoder: Encoder) throws {
@ -58,6 +65,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)
}
//--------------------------------------------------
@ -66,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 {

View File

@ -6,6 +6,8 @@
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import VDSColorTokens
public enum NavigationItemStyle: String, Codable {
case light
case dark
@ -22,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?
@ -31,8 +33,8 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
get {
if let backgroundColor = _backgroundColor { return backgroundColor }
if let style = style,
style == .dark { return Color(uiColor: .mvmBlack) }
return Color(uiColor: .mvmWhite)
style == .dark { return Color(uiColor: VDSColor.backgroundPrimaryDark) }
return Color(uiColor: VDSColor.backgroundPrimaryLight)
}
set {
_backgroundColor = newValue
@ -44,8 +46,8 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
get {
if let tintColor = _tintColor { return tintColor }
if let style = style,
style == .dark { return Color(uiColor: .mvmWhite) }
return Color(uiColor: .mvmBlack)
style == .dark { return Color(uiColor: VDSColor.elementsPrimaryOndark) }
return Color(uiColor: VDSColor.elementsPrimaryOnlight)
}
set {
_tintColor = newValue
@ -113,6 +115,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
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 {

View File

@ -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?
@ -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)
@ -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.
@ -244,8 +246,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)
}

View File

@ -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)

View File

@ -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)
}
@ -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)
}

View File

@ -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 = {
@ -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 }
@ -218,7 +223,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
@ -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

View File

@ -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)
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

View File

@ -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
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

View File

@ -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
}
}