Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/two_button_remove_legacy

This commit is contained in:
Pfeil, Scott Robert 2020-02-04 10:46:17 -05:00
commit 2d400b045d
4 changed files with 11 additions and 18 deletions

View File

@ -6,11 +6,11 @@
// Copyright © 2019 Verizon Wireless. All rights reserved. // Copyright © 2019 Verizon Wireless. All rights reserved.
// //
import UIKit import UIKit
public typealias ColorHexTuple = (uiColor: UIColor, hex: String) public typealias ColorHexTuple = (uiColor: UIColor, hex: String)
extension UIColor { extension UIColor {
/// Dictionary to access brand approved colors by name. /// Dictionary to access brand approved colors by name.
@ -25,6 +25,7 @@ extension UIColor {
"coolGray1": (.mvmCoolGray1, "#F6F6F6"), "coolGray1": (.mvmCoolGray1, "#F6F6F6"),
"coolGray3": (.mvmCoolGray3, "#D8DADA"), "coolGray3": (.mvmCoolGray3, "#D8DADA"),
"coolGray6": (.mvmCoolGray6, "#747676"), "coolGray6": (.mvmCoolGray6, "#747676"),
"coolGray10": (.mvmCoolGray10, "#333333"),
"vzupGold": (.vzupGold, "#B89B56"), "vzupGold": (.vzupGold, "#B89B56"),
"vzupYellow1": (.vzupYellow1, "#F9D542"), "vzupYellow1": (.vzupYellow1, "#F9D542"),
"vzupYellow2": (.vzupYellow2, "#F4CA53"), "vzupYellow2": (.vzupYellow2, "#F4CA53"),
@ -67,6 +68,9 @@ extension UIColor {
/// HEX: #747676 /// HEX: #747676
public static let mvmCoolGray6 = UIColor.color8Bits(red: 116, green: 118, blue: 118) public static let mvmCoolGray6 = UIColor.color8Bits(red: 116, green: 118, blue: 118)
/// HEX: #333333
public static let mvmCoolGray10 = UIColor.grayscale(rgb: 51)
//-------------------------------------------------- //--------------------------------------------------
// MARK: - VZ UP Brand // MARK: - VZ UP Brand
//-------------------------------------------------- //--------------------------------------------------
@ -196,15 +200,4 @@ extension UIColor {
return nil return nil
} }
public class func getColorAndHexFromName(_ name: String) -> ColorHexTuple? {
for row in names {
if name == row.key {
return row.value
}
}
return nil
}
} }

View File

@ -56,7 +56,7 @@ public final class Color: Codable {
} }
init?(name: String) { init?(name: String) {
guard let colorTuple = UIColor.getColorAndHexFromName(name) else { return nil } guard let colorTuple = UIColor.names[name] else { return nil }
self.uiColor = colorTuple.uiColor self.uiColor = colorTuple.uiColor
self.hex = colorTuple.hex self.hex = colorTuple.hex
determineRGBA() determineRGBA()
@ -73,7 +73,7 @@ public final class Color: Codable {
if colorString.hasPrefix("#") { if colorString.hasPrefix("#") {
hex = colorString.replacingOccurrences(of: "#", with: "") hex = colorString.replacingOccurrences(of: "#", with: "")
} else { } else {
guard let hex = UIColor.getColorAndHexFromName(colorString)?.hex else { throw ColorError.badName(reason: "Check the spelling of your color.") } guard let hex = UIColor.names[colorString]?.hex else { throw ColorError.badName(reason: "Check the spelling of your color.") }
self.hex = hex.replacingOccurrences(of: "#", with: "") self.hex = hex.replacingOccurrences(of: "#", with: "")
name = colorString name = colorString
} }

View File

@ -370,7 +370,7 @@
return [self initWithPrimaryButtonMap:primaryButtonMap secondaryButtonMap:secondaryButtonMap actionDelegate:actionDelegate additionalData:additionalData buttonDelegate:buttonDelegate]; return [self initWithPrimaryButtonMap:primaryButtonMap secondaryButtonMap:secondaryButtonMap actionDelegate:actionDelegate additionalData:additionalData buttonDelegate:buttonDelegate];
} }
- (void)setupWithButtonMap:(nullable NSDictionary *)buttonMap delegate:(nullable DelegateObject *)delegateObject additionalData:(nullable NSDictionary *)additionalData { - (void)setupWithButtonMap:(nullable NSDictionary *)buttonMap delegateObject:(nullable DelegateObject *)delegateObject additionalData:(nullable NSDictionary *)additionalData {
NSObject<ButtonDelegateProtocol> *buttonDelegate = nil; NSObject<ButtonDelegateProtocol> *buttonDelegate = nil;
NSObject<MVMCoreActionDelegateProtocol> *actionDelegate = delegateObject.actionDelegate; NSObject<MVMCoreActionDelegateProtocol> *actionDelegate = delegateObject.actionDelegate;
if ([delegateObject isKindOfClass:[MVMCoreUIDelegateObject class]]) { if ([delegateObject isKindOfClass:[MVMCoreUIDelegateObject class]]) {

View File

@ -30,14 +30,14 @@ import Foundation
case screenHeading case screenHeading
case header case header
case footer case footer
case moleculeStack case stack
case isAtomicTabs case isAtomicTabs
} }
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self) let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
pageType = try typeContainer.decode(String.self, forKey: .pageType) pageType = try typeContainer.decode(String.self, forKey: .pageType)
moleculeStack = try typeContainer.decode(MoleculeStackModel.self, forKey: .moleculeStack) moleculeStack = try typeContainer.decode(MoleculeStackModel.self, forKey: .stack)
screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading) screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading)
isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs) isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs)
header = try typeContainer.decodeMoleculeIfPresent(codingKey: .header) header = try typeContainer.decodeMoleculeIfPresent(codingKey: .header)
@ -47,7 +47,7 @@ import Foundation
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(pageType, forKey: .pageType) try container.encode(pageType, forKey: .pageType)
try container.encode(moleculeStack, forKey: .moleculeStack) try container.encode(moleculeStack, forKey: .stack)
try container.encodeIfPresent(screenHeading, forKey: .screenHeading) try container.encodeIfPresent(screenHeading, forKey: .screenHeading)
try container.encodeIfPresent(isAtomicTabs, forKey: .isAtomicTabs) try container.encodeIfPresent(isAtomicTabs, forKey: .isAtomicTabs)
try container.encodeModelIfPresent(header, forKey: .header) try container.encodeModelIfPresent(header, forKey: .header)