From 2397dbe25033b38e0ab4eb5ab5bd6fc3145d7e3e Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 11 Jun 2020 11:34:01 -0400 Subject: [PATCH 01/42] collor asset folder --- MVMCoreUI.xcodeproj/project.pbxproj | 4 ++ MVMCoreUI/Categories/UIColor+Extension.swift | 72 +++++++++---------- .../Categories/colors.xcassets/Contents.json | 6 ++ .../blue.colorset/Contents.json | 20 ++++++ .../blue33.colorset/Contents.json | 20 ++++++ .../blue66.colorset/Contents.json | 20 ++++++ .../blueInverted.colorset/Contents.json | 20 ++++++ .../blueShade1.colorset/Contents.json | 20 ++++++ .../blueShade2.colorset/Contents.json | 20 ++++++ .../coolGray1.colorset/Contents.json | 20 ++++++ .../coolGray10.colorset/Contents.json | 20 ++++++ .../coolGray3.colorset/Contents.json | 20 ++++++ .../coolGray6.colorset/Contents.json | 20 ++++++ .../green.colorset/Contents.json | 20 ++++++ .../green33.colorset/Contents.json | 20 ++++++ .../green66.colorset/Contents.json | 20 ++++++ .../greenInverted.colorset/Contents.json | 20 ++++++ .../greenShade2.colorset/Contents.json | 20 ++++++ .../orange.colorset/Contents.json | 20 ++++++ .../orange33.colorset/Contents.json | 20 ++++++ .../orange66.colorset/Contents.json | 20 ++++++ .../orangeAA.colorset/Contents.json | 20 ++++++ .../orangeShade1.colorset/Contents.json | 20 ++++++ .../orangeShade2.colorset/Contents.json | 20 ++++++ .../pink.colorset/Contents.json | 20 ++++++ .../pink33.colorset/Contents.json | 20 ++++++ .../pink66.colorset/Contents.json | 20 ++++++ .../pinkShade1.colorset/Contents.json | 20 ++++++ .../pinkShade2.colorset/Contents.json | 20 ++++++ .../purple.colorset/Contents.json | 20 ++++++ .../purple33.colorset/Contents.json | 20 ++++++ .../purple66.colorset/Contents.json | 20 ++++++ .../purpleShade1.colorset/Contents.json | 20 ++++++ .../purpleShade2.colorset/Contents.json | 20 ++++++ .../red.colorset/Contents.json | 20 ++++++ .../upGold1.colorset/Contents.json | 20 ++++++ .../upGold2.colorset/Contents.json | 20 ++++++ .../upGold3.colorset/Contents.json | 20 ++++++ .../yellow.colorset/Contents.json | 20 ++++++ 39 files changed, 766 insertions(+), 36 deletions(-) create mode 100644 MVMCoreUI/Categories/colors.xcassets/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blue.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blue33.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blue66.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blueInverted.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blueShade1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blueShade2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/coolGray1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/coolGray10.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/coolGray3.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/coolGray6.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/green.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/green33.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/green66.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/greenInverted.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/greenShade2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orange.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orange33.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orange66.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orangeAA.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orangeShade1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orangeShade2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/pink.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/pink33.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/pink66.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/pinkShade1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/pinkShade2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/purple.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/purple33.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/purple66.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/purpleShade1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/purpleShade2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/red.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/upGold1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/upGold2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/upGold3.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/yellow.colorset/Contents.json diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 3af65c10..3a9c7efe 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -80,6 +80,7 @@ 0A6682B5243769C700AD3CA1 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682B3243769C700AD3CA1 /* TextView.swift */; }; 0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */; }; 0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */; }; + 0A6C1FC324927E2E00E64B52 /* colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0A6C1FC224927E2E00E64B52 /* colors.xcassets */; }; 0A775F2624893916009EFB58 /* ThreeHeadlineBodyLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A775F2524893916009EFB58 /* ThreeHeadlineBodyLink.swift */; }; 0A775F2824893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A775F2724893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift */; }; 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */; }; @@ -521,6 +522,7 @@ 0A6682B3243769C700AD3CA1 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = ""; }; 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleAnyRequiredModel.swift; sourceTree = ""; }; 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseDropdownEntryField.swift; sourceTree = ""; }; + 0A6C1FC224927E2E00E64B52 /* colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = colors.xcassets; path = MVMCoreUI/Categories/colors.xcassets; sourceTree = SOURCE_ROOT; }; 0A775F2524893916009EFB58 /* ThreeHeadlineBodyLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeHeadlineBodyLink.swift; sourceTree = ""; }; 0A775F2724893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeHeadlineBodyLinkModel.swift; sourceTree = ""; }; 0A7918F423F5E7EA00772FF4 /* ImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageView.swift; sourceTree = ""; }; @@ -1818,6 +1820,7 @@ D29DF26621E6A9E4003B2FB9 /* ThirdParty */, D29DF31521ECECC0003B2FB9 /* Fonts */, D29DF32D21EE8C3D003B2FB9 /* Media.xcassets */, + 0A6C1FC224927E2E00E64B52 /* colors.xcassets */, ); path = SupportingFiles; sourceTree = ""; @@ -2036,6 +2039,7 @@ files = ( 94CA227C24058534002D6750 /* VerizonNHGeTX-Bold.otf in Resources */, D29DF32C21EE8736003B2FB9 /* Localizable.strings in Resources */, + 0A6C1FC324927E2E00E64B52 /* colors.xcassets in Resources */, 94CA227D24058534002D6750 /* VerizonNHGeDS-Regular.otf in Resources */, D29DF32E21EE8C3D003B2FB9 /* Media.xcassets in Resources */, 94CA227E24058534002D6750 /* VerizonNHGeDS-Bold.otf in Resources */, diff --git a/MVMCoreUI/Categories/UIColor+Extension.swift b/MVMCoreUI/Categories/UIColor+Extension.swift index 7c82788c..e04a7d46 100644 --- a/MVMCoreUI/Categories/UIColor+Extension.swift +++ b/MVMCoreUI/Categories/UIColor+Extension.swift @@ -71,144 +71,144 @@ extension UIColor { //-------------------------------------------------- /// HEX: #D52B1E - public static let mvmRed = UIColor.color8Bits(red: 213, green: 43, blue: 30) + public static let mvmRed = UIColor(named: "red")! //-------------------------------------------------- // MARK: - Pink //-------------------------------------------------- /// HEX: #D90368 - public static let mvmPink = UIColor.color8Bits(red: 217, green: 3, blue: 104) + public static let mvmPink = UIColor(named: "pink")! /// HEX: #F2ABCD - public static let mvmPink33 = UIColor.color8Bits(red: 242, green: 171, blue: 205) + public static let mvmPink33 = UIColor(named: "pink33")! /// HEX: #E6589B - public static let mvmPink66 = UIColor.color8Bits(red: 230, green: 88, blue: 155) + public static let mvmPink66 = UIColor(named: "pink66")! /// HEX: #B31C63 - public static let mvmPinkShade1 = UIColor.color8Bits(red: 179, green: 28, blue: 99) + public static let mvmPinkShade1 = UIColor(named: "pinkShade1")! /// HEX: #830842 - public static let mvmPinkShade2 = UIColor.color8Bits(red: 131, green: 8, blue: 66) + public static let mvmPinkShade2 = UIColor(named: "pinkShade2")! //-------------------------------------------------- // MARK: - Purple //-------------------------------------------------- /// HEX: #8C00AC - public static let mvmPurple = UIColor.color8Bits(red: 140, green: 0, blue: 172) + public static let mvmPurple = UIColor(named: "purple")! /// HEX: #D9ABE4 - public static let mvmPurple33 = UIColor.color8Bits(red: 217, green: 171, blue: 228) + public static let mvmPurple33 = UIColor(named: "purple33")! /// HEX: #B356C8 - public static let mvmPurple66 = UIColor.color8Bits(red: 179, green: 86, blue: 200) + public static let mvmPurple66 = UIColor(named: "purple66")! /// HEX: #6C177F - public static let mvmPurpleShade1 = UIColor.color8Bits(red: 108, green: 23, blue: 127) + public static let mvmPurpleShade1 = UIColor(named: "purpleShade1")! /// HEX: #4A0E58 - public static let mvmPurpleShade2 = UIColor.color8Bits(red: 74, green: 14, blue: 88) + public static let mvmPurpleShade2 = UIColor(named: "purpleShade2")! //-------------------------------------------------- // MARK: - Orange //-------------------------------------------------- /// HEX: #ED7000 - public static let mvmOrange = UIColor.color8Bits(red: 237, green: 112, blue: 0) + public static let mvmOrange = UIColor(named: "orange")! /// HEX: #CC4D0F - public static let mvmOrangeAA = UIColor.color8Bits(red: 204, green: 77, blue: 15) + public static let mvmOrangeAA = UIColor(named: "orangeAA")! /// HEX: #F9D0AB - public static let mvmOrange33 = UIColor.color8Bits(red: 249, green: 208, blue: 171) + public static let mvmOrange33 = UIColor(named: "orange33")! /// HEX: #F3A157 - public static let mvmOrange66 = UIColor.color8Bits(red: 243, green: 161, blue: 87) + public static let mvmOrange66 = UIColor(named: "orange66")! /// HEX: #CB5F00 - public static let mvmOrangeShade1 = UIColor.color8Bits(red: 203, green: 95, blue: 0) + public static let mvmOrangeShade1 = UIColor(named: "orangeShade1")! /// HEX: #984700 - public static let mvmOrangeShade2 = UIColor.color8Bits(red: 152, green: 71, blue: 0) + public static let mvmOrangeShade2 = UIColor(named: "orangeShade2")! //-------------------------------------------------- // MARK: - Green //-------------------------------------------------- /// HEX: #008330 - public static let mvmGreen = UIColor.color8Bits(red: 0, green: 134, blue: 48) + public static let mvmGreen = UIColor(named: "green")! /// HEX: #ABE4BF - public static let mvmGreen33 = UIColor.color8Bits(red: 171, green: 228, blue: 191) + public static let mvmGreen33 = UIColor(named: "green33")! /// HEX: #57C880 - public static let mvmGreen66 = UIColor.color8Bits(red: 87, green: 200, blue: 128) + public static let mvmGreen66 = UIColor(named: "green66")! /// HEX: #0F5B25 - public static let mvmGreenShade2 = UIColor.color8Bits(red: 15, green: 91, blue: 37) + public static let mvmGreenShade2 = UIColor(named: "greenShade2")! /// HEX: #00AC3E - public static let mvmGreenInverted = UIColor.color8Bits(red: 0, green: 172, blue: 62) + public static let mvmGreenInverted = UIColor(named: "greenInverted")! //-------------------------------------------------- // MARK: - Blue //-------------------------------------------------- /// HEX: #0077B4 - public static let mvmBlue = UIColor.color8Bits(red: 0, green: 119, blue: 180) + public static let mvmBlue = UIColor(named: "blue")! /// HEX: #ABD8EF - public static let mvmBlue33 = UIColor.color8Bits(red: 171, green: 216, blue: 239) + public static let mvmBlue33 = UIColor(named: "blue33")! /// HEX: #57B1DF - public static let mvmBlue66 = UIColor.color8Bits(red: 87, green: 177, blue: 223) + public static let mvmBlue66 = UIColor(named: "blue66")! /// HEX: #136598 - public static let mvmBlueShade1 = UIColor.color8Bits(red: 19, green: 101, blue: 152) + public static let mvmBlueShade1 = UIColor(named: "blueShade1")! /// HEX: #0B4467 - public static let mvmBlueShade2 = UIColor.color8Bits(red: 11, green: 68, blue: 103) + public static let mvmBlueShade2 = UIColor(named: "blueShade2")! /// HEX: #0088CE - public static let mvmBlueInverted = UIColor.color8Bits(red: 0, green: 136, blue: 206) + public static let mvmBlueInverted = UIColor(named: "blueInverted")! //-------------------------------------------------- // MARK: - Yellow //-------------------------------------------------- /// HEX: #FFBC3D - public static let mvmYellow = UIColor.color8Bits(red: 255, green: 188, blue: 61) + public static let mvmYellow = UIColor(named: "yellow")! //-------------------------------------------------- // MARK: - Gray //-------------------------------------------------- /// HEX: #F6F6F6 - public static let mvmCoolGray1 = UIColor.grayscale(rgb: 246) + public static let mvmCoolGray1 = UIColor(named: "coolGray1")! /// HEX: #D8DADA - public static let mvmCoolGray3 = UIColor.color8Bits(red: 216, green: 218, blue: 218) + public static let mvmCoolGray3 = UIColor(named: "coolGray3")! /// HEX: #747676 - public static let mvmCoolGray6 = UIColor.color8Bits(red: 116, green: 118, blue: 118) + public static let mvmCoolGray6 = UIColor(named: "coolGray6")! /// HEX: #333333 - public static let mvmCoolGray10 = UIColor.grayscale(rgb: 51) + public static let mvmCoolGray10 = UIColor(named: "coolGray10")! //-------------------------------------------------- // MARK: - VZ UP Brand //-------------------------------------------------- /// HEX: #F9D542 - public static let vzupGold1 = UIColor.color8Bits(red: 249, green: 213, blue: 66) + public static let vzupGold1 = UIColor(named: "upGold1")! /// HEX: #F4CA53 - public static let vzupGold2 = UIColor.color8Bits(red: 244, green: 202, blue: 83) + public static let vzupGold2 = UIColor(named: "upGold2")! /// HEX: #CC9B2D - public static let vzupGold3 = UIColor.color8Bits(red: 204, green: 155, blue: 45) + public static let vzupGold3 = UIColor(named: "upGold3")! //-------------------------------------------------- // MARK: - Functions diff --git a/MVMCoreUI/Categories/colors.xcassets/Contents.json b/MVMCoreUI/Categories/colors.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blue.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blue.colorset/Contents.json new file mode 100644 index 00000000..8629132f --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blue.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x00", + "alpha" : "1.000", + "blue" : "0xB4", + "green" : "0x77" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blue33.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blue33.colorset/Contents.json new file mode 100644 index 00000000..834857fe --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blue33.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xAB", + "alpha" : "1.000", + "blue" : "0xEF", + "green" : "0xD8" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blue66.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blue66.colorset/Contents.json new file mode 100644 index 00000000..37fcdd6f --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blue66.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x57", + "alpha" : "1.000", + "blue" : "0xDF", + "green" : "0xB1" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blueInverted.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blueInverted.colorset/Contents.json new file mode 100644 index 00000000..ca54d6ce --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blueInverted.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x00", + "alpha" : "1.000", + "blue" : "0xCE", + "green" : "0x88" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blueShade1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blueShade1.colorset/Contents.json new file mode 100644 index 00000000..0153330a --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blueShade1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x13", + "alpha" : "1.000", + "blue" : "0x98", + "green" : "0x65" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blueShade2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blueShade2.colorset/Contents.json new file mode 100644 index 00000000..bae4fe1c --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blueShade2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x0B", + "alpha" : "1.000", + "blue" : "0x67", + "green" : "0x44" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/coolGray1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/coolGray1.colorset/Contents.json new file mode 100644 index 00000000..18db9a3d --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/coolGray1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF6", + "alpha" : "1.000", + "blue" : "0xF6", + "green" : "0xF6" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/coolGray10.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/coolGray10.colorset/Contents.json new file mode 100644 index 00000000..f9b0b98b --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/coolGray10.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x33", + "alpha" : "1.000", + "blue" : "0x33", + "green" : "0x33" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/coolGray3.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/coolGray3.colorset/Contents.json new file mode 100644 index 00000000..3082b216 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/coolGray3.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xD8", + "alpha" : "1.000", + "blue" : "0xDA", + "green" : "0xDA" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/coolGray6.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/coolGray6.colorset/Contents.json new file mode 100644 index 00000000..3c1ebf6d --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/coolGray6.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x74", + "alpha" : "1.000", + "blue" : "0x76", + "green" : "0x76" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/green.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/green.colorset/Contents.json new file mode 100644 index 00000000..40987eb7 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/green.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x00", + "alpha" : "1.000", + "blue" : "0x30", + "green" : "0x83" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/green33.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/green33.colorset/Contents.json new file mode 100644 index 00000000..63d79fa1 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/green33.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xAB", + "alpha" : "1.000", + "blue" : "0xBF", + "green" : "0xE4" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/green66.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/green66.colorset/Contents.json new file mode 100644 index 00000000..af8c1094 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/green66.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x57", + "alpha" : "1.000", + "blue" : "0x80", + "green" : "0xC8" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/greenInverted.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/greenInverted.colorset/Contents.json new file mode 100644 index 00000000..b2a48b0f --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/greenInverted.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x00", + "alpha" : "1.000", + "blue" : "0x3E", + "green" : "0xAC" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/greenShade2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/greenShade2.colorset/Contents.json new file mode 100644 index 00000000..00dc90da --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/greenShade2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x0F", + "alpha" : "1.000", + "blue" : "0x25", + "green" : "0x5B" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orange.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orange.colorset/Contents.json new file mode 100644 index 00000000..e5415e4b --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orange.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xED", + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x70" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orange33.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orange33.colorset/Contents.json new file mode 100644 index 00000000..4c9e04e4 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orange33.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF9", + "alpha" : "1.000", + "blue" : "0xAB", + "green" : "0xD0" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orange66.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orange66.colorset/Contents.json new file mode 100644 index 00000000..67424977 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orange66.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF3", + "alpha" : "1.000", + "blue" : "0x57", + "green" : "0xA1" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orangeAA.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orangeAA.colorset/Contents.json new file mode 100644 index 00000000..56f98a12 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orangeAA.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xCC", + "alpha" : "1.000", + "blue" : "0x0F", + "green" : "0x4D" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orangeShade1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orangeShade1.colorset/Contents.json new file mode 100644 index 00000000..6cf34c78 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orangeShade1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xCB", + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x5F" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orangeShade2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orangeShade2.colorset/Contents.json new file mode 100644 index 00000000..1fcbe3a4 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orangeShade2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x98", + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x47" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/pink.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/pink.colorset/Contents.json new file mode 100644 index 00000000..4cc87bd4 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/pink.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xD9", + "alpha" : "1.000", + "blue" : "0x68", + "green" : "0x03" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/pink33.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/pink33.colorset/Contents.json new file mode 100644 index 00000000..2d85dd8f --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/pink33.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF2", + "alpha" : "1.000", + "blue" : "0xCD", + "green" : "0xAB" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/pink66.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/pink66.colorset/Contents.json new file mode 100644 index 00000000..c05eef33 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/pink66.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xE6", + "alpha" : "1.000", + "blue" : "0x9B", + "green" : "0x58" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/pinkShade1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/pinkShade1.colorset/Contents.json new file mode 100644 index 00000000..59e8780d --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/pinkShade1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xB3", + "alpha" : "1.000", + "blue" : "0x63", + "green" : "0x1C" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/pinkShade2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/pinkShade2.colorset/Contents.json new file mode 100644 index 00000000..1dcdecbe --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/pinkShade2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x83", + "alpha" : "1.000", + "blue" : "0x42", + "green" : "0x08" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/purple.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/purple.colorset/Contents.json new file mode 100644 index 00000000..49d87c9e --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/purple.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x8C", + "alpha" : "1.000", + "blue" : "0xAC", + "green" : "0x00" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/purple33.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/purple33.colorset/Contents.json new file mode 100644 index 00000000..95cac70e --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/purple33.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xD9", + "alpha" : "1.000", + "blue" : "0xE4", + "green" : "0xAB" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/purple66.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/purple66.colorset/Contents.json new file mode 100644 index 00000000..95e75564 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/purple66.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xB3", + "alpha" : "1.000", + "blue" : "0xC8", + "green" : "0x56" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/purpleShade1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/purpleShade1.colorset/Contents.json new file mode 100644 index 00000000..689b7838 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/purpleShade1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x6C", + "alpha" : "1.000", + "blue" : "0x7F", + "green" : "0x17" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/purpleShade2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/purpleShade2.colorset/Contents.json new file mode 100644 index 00000000..d71ec372 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/purpleShade2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x4A", + "alpha" : "1.000", + "blue" : "0x58", + "green" : "0x0E" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/red.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/red.colorset/Contents.json new file mode 100644 index 00000000..536ccc9b --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/red.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xD5", + "alpha" : "1.000", + "blue" : "0x1E", + "green" : "0x2B" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/upGold1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/upGold1.colorset/Contents.json new file mode 100644 index 00000000..90ccb299 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/upGold1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF9", + "alpha" : "1.000", + "blue" : "0x42", + "green" : "0xD5" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/upGold2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/upGold2.colorset/Contents.json new file mode 100644 index 00000000..6389c7a8 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/upGold2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF4", + "alpha" : "1.000", + "blue" : "0x53", + "green" : "0xCA" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/upGold3.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/upGold3.colorset/Contents.json new file mode 100644 index 00000000..e25cb46f --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/upGold3.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xCC", + "alpha" : "1.000", + "blue" : "0x2D", + "green" : "0x9B" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/yellow.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/yellow.colorset/Contents.json new file mode 100644 index 00000000..5c00b5eb --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/yellow.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xFF", + "alpha" : "1.000", + "blue" : "0x3D", + "green" : "0xBC" + } + } + } + ] +} \ No newline at end of file From 78ca4984f1081c70ce8ca34ee04ef730ef16a886 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 16 Jun 2020 09:51:59 +0530 Subject: [PATCH 02/42] parsing analytics data --- .../Atomic/Molecules/Items/CarouselItemModel.swift | 5 +++++ MVMCoreUI/Atomic/Organisms/Carousel.swift | 12 ++++++++++++ .../ModelProtocols/CarouselItemModelProtocol.swift | 7 +++++++ 3 files changed, 24 insertions(+) diff --git a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift index 15a83552..9165cec7 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift @@ -10,6 +10,8 @@ import Foundation @objcMembers public class CarouselItemModel: MoleculeCollectionItemModel, CarouselItemModelProtocol { + public var analyticsData: [String : String]? + //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- @@ -28,6 +30,7 @@ import Foundation private enum CodingKeys: String, CodingKey { case peakingUI case peakingArrowColor + case analyticsData } //-------------------------------------------------- @@ -38,6 +41,7 @@ import Foundation let typeContainer = try decoder.container(keyedBy: CodingKeys.self) peakingUI = try typeContainer.decodeIfPresent(Bool.self, forKey: .peakingUI) peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor) + analyticsData = try typeContainer.decodeIfPresent([String:String].self, forKey: .analyticsData) try super.init(from: decoder) } @@ -46,5 +50,6 @@ import Foundation var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(peakingUI, forKey: .peakingUI) try container.encodeIfPresent(peakingArrowColor, forKey: .peakingArrowColor) + try container.encodeIfPresent(analyticsData, forKey: .analyticsData) } } diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index abc0e74b..baa62c88 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -163,6 +163,9 @@ open class Carousel: View { pageIndex = carouselModel.index pagingView?.currentIndex = carouselModel.index collectionView.reloadData() + + // track analyticsData + trackSwipeActionAnalyticsforIndex(pageIndex) } //-------------------------------------------------- @@ -297,6 +300,13 @@ open class Carousel: View { cell.accessibilityElementsHidden = true } } + func trackSwipeActionAnalyticsforIndex(_ index : Int){ + guard let itemModel = molecules?[index], + let analyticsData = itemModel.analyticsData, + let viewcontrollerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } + MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController:viewcontrollerObject, actionInformation: analyticsData, additionalData: analyticsData) + + } } extension Carousel: UICollectionViewDelegateFlowLayout { @@ -454,5 +464,7 @@ extension Carousel: UIScrollViewDelegate { // Cycle to other end if on buffer cell. pagingView?.currentIndex = pageIndex showPeaking(true) + // track analyticsData + trackSwipeActionAnalyticsforIndex(pageIndex) } } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift index 198cf80d..2d8444b5 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift @@ -10,4 +10,11 @@ import Foundation public protocol CarouselItemModelProtocol: ContainerModelProtocol { + var analyticsData: [String:String]? { get } +} +public extension CarouselItemModelProtocol { + + var analyticsData: [String:String]? { + get { return nil} + } } From 0e0de7a0fa58e75fb1c1c1a5378d4959578bb19b Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 16 Jun 2020 16:26:29 +0530 Subject: [PATCH 03/42] adobe tracking method added --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 6 ++++-- MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h | 3 +++ MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m | 4 ++++ MVMCoreUI/Utility/MVMCoreUIConstants.h | 4 ++++ MVMCoreUI/Utility/MVMCoreUIConstants.m | 4 ++++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index baa62c88..71f8c198 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -302,9 +302,11 @@ open class Carousel: View { } func trackSwipeActionAnalyticsforIndex(_ index : Int){ guard let itemModel = molecules?[index], - let analyticsData = itemModel.analyticsData, + var analyticsData = itemModel.analyticsData, let viewcontrollerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } - MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController:viewcontrollerObject, actionInformation: analyticsData, additionalData: analyticsData) + analyticsData[KeyAdobeTrackerPageType] = viewcontrollerObject.loadObject??.pageType + analyticsData["ClassName"] = String(describing: type(of: viewcontrollerObject)) + MVMCoreUILoggingHandler.shared()?.trackAdobeAnalytics(analyticsData) } } diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h index 9fec90f5..869bb098 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h @@ -20,6 +20,9 @@ NS_ASSUME_NONNULL_BEGIN - (void)defaultLogActionForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; - (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; +- (void)trackAdobeAnalytics:(nullable NSDictionary *)analyticsData; + + @end NS_ASSUME_NONNULL_END diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m index 0c694cce..4c99b1af 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m @@ -19,5 +19,9 @@ - (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { return nil; } +- (void)trackAnalyticsAction:(nullable NSDictionary *)analyticsData{ + +} + @end diff --git a/MVMCoreUI/Utility/MVMCoreUIConstants.h b/MVMCoreUI/Utility/MVMCoreUIConstants.h index 4c0a3553..c70f9e84 100644 --- a/MVMCoreUI/Utility/MVMCoreUIConstants.h +++ b/MVMCoreUI/Utility/MVMCoreUIConstants.h @@ -82,3 +82,7 @@ typedef NS_ENUM(NSInteger, CoreUIErrorCode) { #pragma mark - Apple Design Guidelines extern CGFloat const MinimumTappableArea; + +#pragma mark - Adobe Action Tracking + +extern NSString * const KeyAdobeTrackerPageType; diff --git a/MVMCoreUI/Utility/MVMCoreUIConstants.m b/MVMCoreUI/Utility/MVMCoreUIConstants.m index 5f5a9a45..34e3dc8c 100644 --- a/MVMCoreUI/Utility/MVMCoreUIConstants.m +++ b/MVMCoreUI/Utility/MVMCoreUIConstants.m @@ -74,3 +74,7 @@ NSString * const KeyHandScroll = @"hand_scroll"; #pragma mark - Apple Design Guidelines CGFloat const MinimumTappableArea = 44.0f; + +#pragma mark - Adobe Action Tracking + +NSString * const KeyAdobeTrackerPageType = @"vzwi.mvmapp.PageType"; From c5b4b5dfbf559e0d166842944b1b84b954cb6247 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 16 Jun 2020 20:53:21 +0530 Subject: [PATCH 04/42] removed new adobe method calling --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 21 +++++++++---------- .../OtherHandlers/MVMCoreUILoggingHandler.h | 3 --- .../OtherHandlers/MVMCoreUILoggingHandler.m | 4 ---- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 71f8c198..6dde83ce 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -18,7 +18,7 @@ public protocol CarouselPageControlProtocol { open class Carousel: View { - + public let collectionView: CollectionView = { let layout = UICollectionViewFlowLayout() layout.scrollDirection = .horizontal @@ -26,7 +26,7 @@ open class Carousel: View { layout.minimumLineSpacing = 0 return CollectionView(frame: .zero, collectionViewLayout: layout) }() - + /// The current index of the collection view. Includes dummy cells when looping. public var currentIndex = 0 @@ -85,7 +85,7 @@ open class Carousel: View { open func layoutCollection() { collectionView.collectionViewLayout.invalidateLayout() showPeaking(false) - + // Go to current cell. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking logic. The dispatch is a sad way to ensure the collection view is ready to be scrolled. guard let model = model as? CarouselModel, (model.paging == true || model.loop == true) else { return } @@ -145,19 +145,19 @@ open class Carousel: View { collectionView.layer.borderWidth = (carouselModel.border ?? false) ? 1 : 0 backgroundColor = .white (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumLineSpacing = carouselModel.spacing ?? 0 - + itemWidthPercent = carouselModel.itemWidthPercent / 100.0 if let alignment = carouselModel.itemAlignment { itemAlignment = alignment } - + if let height = carouselModel.height { collectionViewHeight?.constant = height } registerCells(with: carouselModel, delegateObject: delegateObject) prepareMolecules(with: carouselModel) - + setupPagingMolecule(carouselModel.pagingMolecule, delegateObject: delegateObject) pageIndex = carouselModel.index @@ -185,7 +185,7 @@ open class Carousel: View { if carouselModel?.loop ?? false && newMolecules.count > 1 { // Sets up the row data with buffer cells on each side (for illusion of endless scroll... also has one more buffer cell on each side in case we can peek that cell). loop = true - + molecules?.insert(contentsOf: newMolecules.suffix(2), at: 0) molecules?.append(contentsOf: newMolecules.prefix(2)) } @@ -306,8 +306,7 @@ open class Carousel: View { let viewcontrollerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } analyticsData[KeyAdobeTrackerPageType] = viewcontrollerObject.loadObject??.pageType analyticsData["ClassName"] = String(describing: type(of: viewcontrollerObject)) - MVMCoreUILoggingHandler.shared()?.trackAdobeAnalytics(analyticsData) - + MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: viewcontrollerObject, actionInformation: itemModel.toJSON(), additionalData: nil) } } @@ -386,7 +385,7 @@ extension Carousel: UIScrollViewDelegate { } open func scrollViewDidScroll(_ scrollView: UIScrollView) { - + // Adjust for looping if let model = model as? CarouselModel, model.loop == true { @@ -455,7 +454,7 @@ extension Carousel: UIScrollViewDelegate { } else { targetContentOffset.pointee = scrollView.contentOffset } - + // Cap the index. let lastCellIndex = collectionView(collectionView, numberOfItemsInSection: 0) - 1 goTo(min(max(cellToSwipeTo, 0), lastCellIndex), animated: true) diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h index 869bb098..9fec90f5 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h @@ -20,9 +20,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)defaultLogActionForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; - (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; -- (void)trackAdobeAnalytics:(nullable NSDictionary *)analyticsData; - - @end NS_ASSUME_NONNULL_END diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m index 4c99b1af..0c694cce 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m @@ -19,9 +19,5 @@ - (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { return nil; } -- (void)trackAnalyticsAction:(nullable NSDictionary *)analyticsData{ - -} - @end From b62bf0e00e9693527cc091012a82464d72f7292a Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Tue, 16 Jun 2020 20:56:33 +0530 Subject: [PATCH 05/42] removed spaces --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 6dde83ce..61a32ffc 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -18,7 +18,7 @@ public protocol CarouselPageControlProtocol { open class Carousel: View { - + public let collectionView: CollectionView = { let layout = UICollectionViewFlowLayout() layout.scrollDirection = .horizontal @@ -26,7 +26,7 @@ open class Carousel: View { layout.minimumLineSpacing = 0 return CollectionView(frame: .zero, collectionViewLayout: layout) }() - + /// The current index of the collection view. Includes dummy cells when looping. public var currentIndex = 0 @@ -85,7 +85,7 @@ open class Carousel: View { open func layoutCollection() { collectionView.collectionViewLayout.invalidateLayout() showPeaking(false) - + // Go to current cell. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking logic. The dispatch is a sad way to ensure the collection view is ready to be scrolled. guard let model = model as? CarouselModel, (model.paging == true || model.loop == true) else { return } @@ -145,19 +145,19 @@ open class Carousel: View { collectionView.layer.borderWidth = (carouselModel.border ?? false) ? 1 : 0 backgroundColor = .white (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumLineSpacing = carouselModel.spacing ?? 0 - + itemWidthPercent = carouselModel.itemWidthPercent / 100.0 if let alignment = carouselModel.itemAlignment { itemAlignment = alignment } - + if let height = carouselModel.height { collectionViewHeight?.constant = height } registerCells(with: carouselModel, delegateObject: delegateObject) prepareMolecules(with: carouselModel) - + setupPagingMolecule(carouselModel.pagingMolecule, delegateObject: delegateObject) pageIndex = carouselModel.index @@ -185,7 +185,7 @@ open class Carousel: View { if carouselModel?.loop ?? false && newMolecules.count > 1 { // Sets up the row data with buffer cells on each side (for illusion of endless scroll... also has one more buffer cell on each side in case we can peek that cell). loop = true - + molecules?.insert(contentsOf: newMolecules.suffix(2), at: 0) molecules?.append(contentsOf: newMolecules.prefix(2)) } @@ -385,7 +385,7 @@ extension Carousel: UIScrollViewDelegate { } open func scrollViewDidScroll(_ scrollView: UIScrollView) { - + // Adjust for looping if let model = model as? CarouselModel, model.loop == true { @@ -454,7 +454,7 @@ extension Carousel: UIScrollViewDelegate { } else { targetContentOffset.pointee = scrollView.contentOffset } - + // Cap the index. let lastCellIndex = collectionView(collectionView, numberOfItemsInSection: 0) - 1 goTo(min(max(cellToSwipeTo, 0), lastCellIndex), animated: true) From 82fbf6dc8edffdd24729dc5f4201e865fa613b01 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Thu, 18 Jun 2020 08:26:12 +0530 Subject: [PATCH 06/42] Scott feedback implemented --- MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift | 4 ++-- MVMCoreUI/Atomic/Organisms/Carousel.swift | 7 ++----- .../ModelProtocols/CarouselItemModelProtocol.swift | 7 ++++--- MVMCoreUI/Utility/MVMCoreUIConstants.h | 4 ---- MVMCoreUI/Utility/MVMCoreUIConstants.m | 4 ---- 5 files changed, 8 insertions(+), 18 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift index 9165cec7..5103b440 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift @@ -10,7 +10,7 @@ import Foundation @objcMembers public class CarouselItemModel: MoleculeCollectionItemModel, CarouselItemModelProtocol { - public var analyticsData: [String : String]? + public var analyticsData: JSONValueDictionary? //-------------------------------------------------- // MARK: - Properties @@ -41,7 +41,7 @@ import Foundation let typeContainer = try decoder.container(keyedBy: CodingKeys.self) peakingUI = try typeContainer.decodeIfPresent(Bool.self, forKey: .peakingUI) peakingArrowColor = try typeContainer.decodeIfPresent(Color.self, forKey: .peakingArrowColor) - analyticsData = try typeContainer.decodeIfPresent([String:String].self, forKey: .analyticsData) + analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData) try super.init(from: decoder) } diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 61a32ffc..40ed5e63 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -302,11 +302,8 @@ open class Carousel: View { } func trackSwipeActionAnalyticsforIndex(_ index : Int){ guard let itemModel = molecules?[index], - var analyticsData = itemModel.analyticsData, - let viewcontrollerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } - analyticsData[KeyAdobeTrackerPageType] = viewcontrollerObject.loadObject??.pageType - analyticsData["ClassName"] = String(describing: type(of: viewcontrollerObject)) - MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: viewcontrollerObject, actionInformation: itemModel.toJSON(), additionalData: nil) + let viewControllerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } + MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: viewControllerObject, actionInformation: itemModel.toJSON(), additionalData: nil) } } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift index 2d8444b5..3501ce42 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift @@ -10,11 +10,12 @@ import Foundation public protocol CarouselItemModelProtocol: ContainerModelProtocol { - var analyticsData: [String:String]? { get } + var analyticsData: JSONValueDictionary? { get set } } public extension CarouselItemModelProtocol { - var analyticsData: [String:String]? { - get { return nil} + var analyticsData: JSONValueDictionary? { + get { return nil } + set{ analyticsData = newValue } } } diff --git a/MVMCoreUI/Utility/MVMCoreUIConstants.h b/MVMCoreUI/Utility/MVMCoreUIConstants.h index c70f9e84..4c0a3553 100644 --- a/MVMCoreUI/Utility/MVMCoreUIConstants.h +++ b/MVMCoreUI/Utility/MVMCoreUIConstants.h @@ -82,7 +82,3 @@ typedef NS_ENUM(NSInteger, CoreUIErrorCode) { #pragma mark - Apple Design Guidelines extern CGFloat const MinimumTappableArea; - -#pragma mark - Adobe Action Tracking - -extern NSString * const KeyAdobeTrackerPageType; diff --git a/MVMCoreUI/Utility/MVMCoreUIConstants.m b/MVMCoreUI/Utility/MVMCoreUIConstants.m index 34e3dc8c..5f5a9a45 100644 --- a/MVMCoreUI/Utility/MVMCoreUIConstants.m +++ b/MVMCoreUI/Utility/MVMCoreUIConstants.m @@ -74,7 +74,3 @@ NSString * const KeyHandScroll = @"hand_scroll"; #pragma mark - Apple Design Guidelines CGFloat const MinimumTappableArea = 44.0f; - -#pragma mark - Adobe Action Tracking - -NSString * const KeyAdobeTrackerPageType = @"vzwi.mvmapp.PageType"; From b68e0dd80c6ecbf8c5de149551c9af1b8c38b087 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Thu, 18 Jun 2020 16:01:08 +0530 Subject: [PATCH 07/42] duplicate tracking fixed --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 40ed5e63..c6166d39 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -68,6 +68,8 @@ open class Carousel: View { private var size: CGFloat? + private var isTrackedAnalytics: Bool = false + // Updates the model and index. public func updateModelIndex() { (model as? CarouselModel)?.index = pageIndex @@ -165,7 +167,10 @@ open class Carousel: View { collectionView.reloadData() // track analyticsData + if(!isTrackedAnalytics){ trackSwipeActionAnalyticsforIndex(pageIndex) + isTrackedAnalytics = true + } } //-------------------------------------------------- From 57c3ed3c12b2a1d27dc5a753b89e4f6a77e06926 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Fri, 19 Jun 2020 19:13:25 +0530 Subject: [PATCH 08/42] spaces removed --- MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift | 3 +-- MVMCoreUI/Atomic/Organisms/Carousel.swift | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift index 5103b440..1b9ce0dc 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift @@ -10,8 +10,6 @@ import Foundation @objcMembers public class CarouselItemModel: MoleculeCollectionItemModel, CarouselItemModelProtocol { - public var analyticsData: JSONValueDictionary? - //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- @@ -22,6 +20,7 @@ import Foundation public var peakingUI: Bool? public var peakingArrowColor: Color? + public var analyticsData: JSONValueDictionary? //-------------------------------------------------- // MARK: - Keys diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index c6166d39..740cdb9a 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -165,7 +165,6 @@ open class Carousel: View { pageIndex = carouselModel.index pagingView?.currentIndex = carouselModel.index collectionView.reloadData() - // track analyticsData if(!isTrackedAnalytics){ trackSwipeActionAnalyticsforIndex(pageIndex) @@ -305,9 +304,10 @@ open class Carousel: View { cell.accessibilityElementsHidden = true } } + func trackSwipeActionAnalyticsforIndex(_ index : Int){ guard let itemModel = molecules?[index], - let viewControllerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } + let viewControllerObject = delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol else { return } MVMCoreUILoggingHandler.shared()?.defaultLogAction(forController: viewControllerObject, actionInformation: itemModel.toJSON(), additionalData: nil) } } From e7ce1daa3be8c1e68e0a7372ff302204cfd78b99 Mon Sep 17 00:00:00 2001 From: "Khan, Arshad" Date: Sat, 20 Jun 2020 16:27:18 +0530 Subject: [PATCH 09/42] empty multi progress bar fix. If data usage is empty, then empty grey colour bar should be shown. --- MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift b/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift index 2671fc0d..28cb5bf8 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift @@ -63,7 +63,7 @@ import UIKit addSubview(stack) NSLayoutConstraint.constraintPinSubview(toSuperview: stack) stack.backgroundColor = backgroundColor - stack.contentView.backgroundColor = .mvmWhite + stack.contentView.backgroundColor = .mvmCoolGray3 stack.model = StackModel(molecules: [], axis: .horizontal, spacing: 2) stack.stackModel?.horizontalAlignment = .leading From 206017443e4ba3b6c857f9dc886234b9412fb142 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 22 Jun 2020 10:21:27 -0400 Subject: [PATCH 10/42] back button change --- .../NavigationBar/NavigationItemModel.swift | 6 +++--- .../NavigationItemModelProtocol.swift | 2 +- MVMCoreUI/Containers/NavigationController.swift | 16 +++++++++------- .../MVMCoreUISplitViewController+Extension.swift | 14 ++++++++------ 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift index c0ee897c..d7d677fa 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift @@ -18,7 +18,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt public var backgroundColor: Color? public var tintColor: Color public var line: LineModel? - public var alwaysShowBackButton = false + public var alwaysShowBackButton: Bool? public var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? = NavigationImageButtonModel(with: "nav_back", action: ActionBackModel()) public var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? public var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? @@ -52,7 +52,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .white) tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) ?? LineModel(type: .standard) - alwaysShowBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysShowBackButton) ?? false + alwaysShowBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysShowBackButton) if let backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol) = try typeContainer.decodeModelIfPresent(codingKey: .backButton) { self.backButton = backButton } @@ -68,7 +68,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encode(tintColor, forKey: .tintColor) try container.encodeIfPresent(line, forKey: .line) - try container.encode(alwaysShowBackButton, forKey: .alwaysShowBackButton) + try container.encodeIfPresent(alwaysShowBackButton, forKey: .alwaysShowBackButton) try container.encodeModelIfPresent(backButton, forKey: .backButton) try container.encodeModelsIfPresent(additionalLeftButtons, forKey: .additionalLeftButtons) try container.encodeModelsIfPresent(additionalRightButtons, forKey: .additionalRightButtons) diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift index 30db2aa6..084509e0 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift @@ -14,7 +14,7 @@ public protocol NavigationItemModelProtocol { var backgroundColor: Color? { get set } var tintColor: Color { get set } var line: LineModel? { get set } - var alwaysShowBackButton: Bool { get set } + var alwaysShowBackButton: Bool? { get set } var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? { get set } var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } diff --git a/MVMCoreUI/Containers/NavigationController.swift b/MVMCoreUI/Containers/NavigationController.swift index 12d70634..2803792f 100644 --- a/MVMCoreUI/Containers/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController.swift @@ -47,13 +47,15 @@ import UIKit public static func setNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject var leftItems: [UIBarButtonItem] = [] - if let backButtonModel = navigationItemModel.backButton, - navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton { - leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) - } - if let leftItemModels = navigationItemModel.additionalLeftButtons { - for item in leftItemModels { - leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + if navigationItemModel.alwaysShowBackButton != false { + if let backButtonModel = navigationItemModel.backButton, + navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton ?? false { + leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + } + if let leftItemModels = navigationItemModel.additionalLeftButtons { + for item in leftItemModels { + leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + } } } viewController.navigationItem.leftBarButtonItems = leftItems.count > 0 ? leftItems : nil diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index bfbe19ac..e62efa29 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -48,13 +48,15 @@ public extension MVMCoreUISplitViewController { let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject // Add back button first. - if let backButtonModel = navigationItemModel?.backButton { - if navigationController.viewControllers.count > 1 || navigationItemModel!.alwaysShowBackButton { - leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + if navigationItemModel?.alwaysShowBackButton != false { + if let backButtonModel = navigationItemModel?.backButton { + if navigationController.viewControllers.count > 1 || navigationItemModel!.alwaysShowBackButton ?? false { + leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) + } + } else if let backButton = backButton, + navigationController.viewControllers.count > 1 { + leftItems.append(backButton) } - } else if let backButton = backButton, - navigationController.viewControllers.count > 1 { - leftItems.append(backButton) } // Add the panel button after the back button. From b3a9fcb1ab816e822ca154d6e65ece63f30b52e9 Mon Sep 17 00:00:00 2001 From: "Khan, Arshad" Date: Mon, 22 Jun 2020 21:47:23 +0530 Subject: [PATCH 11/42] added review feedback --- MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift b/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift index 28cb5bf8..945229c7 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift @@ -63,7 +63,7 @@ import UIKit addSubview(stack) NSLayoutConstraint.constraintPinSubview(toSuperview: stack) stack.backgroundColor = backgroundColor - stack.contentView.backgroundColor = .mvmCoolGray3 + stack.contentView.backgroundColor = .clear stack.model = StackModel(molecules: [], axis: .horizontal, spacing: 2) stack.stackModel?.horizontalAlignment = .leading @@ -111,7 +111,6 @@ import UIKit roundedCorners = multiProgressModel.roundedCorners ?? false thicknessConstraint?.constant = multiProgressModel.thickness ?? defaultHeight - stack.model?.backgroundColor = model.backgroundColor set(with: multiProgressModel.progressList, delegateObject, additionalData) } From 7c48a25832208ab5d12f3ae190f1670a5a258617 Mon Sep 17 00:00:00 2001 From: Damodaram <> Date: Mon, 22 Jun 2020 22:13:32 +0530 Subject: [PATCH 12/42] removed logic for tracking for first time --- MVMCoreUI/Atomic/Organisms/Carousel.swift | 7 ------- .../ModelProtocols/CarouselItemModelProtocol.swift | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift index 740cdb9a..808c370e 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -68,8 +68,6 @@ open class Carousel: View { private var size: CGFloat? - private var isTrackedAnalytics: Bool = false - // Updates the model and index. public func updateModelIndex() { (model as? CarouselModel)?.index = pageIndex @@ -165,11 +163,6 @@ open class Carousel: View { pageIndex = carouselModel.index pagingView?.currentIndex = carouselModel.index collectionView.reloadData() - // track analyticsData - if(!isTrackedAnalytics){ - trackSwipeActionAnalyticsforIndex(pageIndex) - isTrackedAnalytics = true - } } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift index 3501ce42..c2ade02d 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/CarouselItemModelProtocol.swift @@ -16,6 +16,6 @@ public extension CarouselItemModelProtocol { var analyticsData: JSONValueDictionary? { get { return nil } - set{ analyticsData = newValue } + set { analyticsData = newValue } } } From b1c1734a19890e05d67ae2367c8054ba0679f0d3 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 24 Jun 2020 12:57:04 +0530 Subject: [PATCH 13/42] 21518(iOS - Headers - H2 - Link) initial commit. Added model and molecule class files. --- MVMCoreUI.xcodeproj/project.pbxproj | 12 +++- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + .../Headers/H2/HeadersH2Link.swift | 59 ++++++++++++++++ .../Headers/H2/HeadersH2LinkModel.swift | 68 +++++++++++++++++++ 4 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 6c80ccd2..43982c8b 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -211,6 +211,8 @@ AA633B3324989ED500731E80 /* HeadersH2PricingTwoRows.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */; }; AA69AAF62445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA69AAF52445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift */; }; AA69AAF82445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA69AAF72445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift */; }; + AA71AD3E24A32FCE00ACA76F /* HeadersH2LinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA71AD3D24A32FCE00ACA76F /* HeadersH2LinkModel.swift */; }; + AA71AD4024A32FE700ACA76F /* HeadersH2Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA71AD3F24A32FE700ACA76F /* HeadersH2Link.swift */; }; AA7F32AB246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA7F32AA246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift */; }; AA7F32AD246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA7F32AC246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift */; }; AA85236C244435A20059CC1E /* RadioSwatchCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA85236B244435A20059CC1E /* RadioSwatchCollectionViewCell.swift */; }; @@ -665,6 +667,8 @@ AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2PricingTwoRows.swift; sourceTree = ""; }; AA69AAF52445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxBodyText.swift; sourceTree = ""; }; AA69AAF72445BF6800AF3D3B /* ListLeftVariableCheckboxBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxBodyTextModel.swift; sourceTree = ""; }; + AA71AD3D24A32FCE00ACA76F /* HeadersH2LinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2LinkModel.swift; sourceTree = ""; }; + AA71AD3F24A32FE700ACA76F /* HeadersH2Link.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2Link.swift; sourceTree = ""; }; AA7F32AA246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAllTextAndLinksModel.swift; sourceTree = ""; }; AA7F32AC246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAllTextAndLinks.swift; sourceTree = ""; }; AA85236B244435A20059CC1E /* RadioSwatchCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchCollectionViewCell.swift; sourceTree = ""; }; @@ -1502,7 +1506,7 @@ children = ( AA104AC824472DC7004D2810 /* HeadersH1ButtonModel.swift */, AA104AC624472DB0004D2810 /* HeadersH1Button.swift */, - AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */, + AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */, AA104AD9244734DB004D2810 /* HeadersH1LandingPageHeader.swift */, ); path = H1; @@ -1517,8 +1521,10 @@ AA26850B244840AE00CE34CC /* HeadersH2TinyButton.swift */, AA104B1B24474A76004D2810 /* HeadersH2ButtonsModel.swift */, AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */, - AA633B3024989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift */, + AA633B3024989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift */, AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */, + AA71AD3D24A32FCE00ACA76F /* HeadersH2LinkModel.swift */, + AA71AD3F24A32FE700ACA76F /* HeadersH2Link.swift */, ); path = H2; sourceTree = ""; @@ -2143,6 +2149,7 @@ 01004F3022721C3800991ECC /* RadioButton.swift in Sources */, D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */, D236E5B7242007C500C38625 /* MVMControllerModelProtocol.swift in Sources */, + AA71AD4024A32FE700ACA76F /* HeadersH2Link.swift in Sources */, D29DF11721E6805F003B2FB9 /* UIColor+MFConvenience.m in Sources */, D2B18B7F2360913400A9AEDC /* Control.swift in Sources */, D253BB8A24574CC5002DE544 /* StackModel.swift in Sources */, @@ -2398,6 +2405,7 @@ 8D070BB2241B56AD0099AC56 /* ListRightVariableTotalData.swift in Sources */, D264FAA5243F66A500D98315 /* CollectionTemplateItemProtocol.swift in Sources */, D29DF11D21E684A9003B2FB9 /* MVMCoreUISplitViewController.m in Sources */, + AA71AD3E24A32FCE00ACA76F /* HeadersH2LinkModel.swift in Sources */, 8DD1E36E243B3CFB00D8F2DF /* ListThreeColumnInternationalDataModel.swift in Sources */, D243859923A16B1800332775 /* Container.swift in Sources */, D2C521A923EDE79E00CA2634 /* ViewController.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index c6bb77bb..b5209bfb 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -210,6 +210,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2TinyButton.self, viewModelClass: HeadersH2TinyButtonModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Buttons.self, viewModelClass: HeadersH2ButtonsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2PricingTwoRows.self, viewModelClass: HeadersH2PricingTwoRowsModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Link.self, viewModelClass: HeadersH2LinkModel.self) // Device Items MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexButtonMedium.self, viewModelClass: ListDeviceComplexButtonMediumModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift new file mode 100644 index 00000000..4b0334e7 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift @@ -0,0 +1,59 @@ +// +// HeadersH2Link.swift +// MVMCoreUI +// +// Created by Lekshmi S on 24/06/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class HeadersH2Link: HeaderView { + //-------------------------------------------------- + // MARK: - Outlets + //-------------------------------------------------- + public let headlineBody = HeadlineBody() + public let link = Link() + public let stack: Stack + + //------------------------------------------------------- + // MARK: - Initializers + //------------------------------------------------------- + public override init(frame: CGRect) { + stack = Stack.createStack(with: [headlineBody, link], spacing: PaddingHorizontalBetweenRelatedItems) + super.init(frame: frame) + } + + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //------------------------------------------------------- + // MARK: - Lifecycle + //------------------------------------------------------- + open override func setupView() { + super.setupView() + headlineBody.stylePageHeader() + addMolecule(stack) + stack.restack() + } + + //---------------------------------------------------- + // MARK: - Molecule + //------------------------------------------------------ + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? HeadersH2LinkModel else { return } + headlineBody.set(with: model.headlineBody, delegateObject, additionalData) + link.set(with: model.link, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 121 + } + + open override func reset() { + super.reset() + headlineBody.stylePageHeader() + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift new file mode 100644 index 00000000..5793eedf --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift @@ -0,0 +1,68 @@ +// +// HeadersH2LinkModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 24/06/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class HeadersH2LinkModel: HeaderModel, MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public static var identifier: String = "headerH2Link" + public var headlineBody: HeadlineBodyModel + public var link: LinkModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + + public init(headlineBody: HeadlineBodyModel, link: LinkModel) { + self.headlineBody = headlineBody + self.link = link + super.init() + } + + //-------------------------------------------------- + // MARK: - Methods + //-------------------------------------------------- + + public override func setDefaults() { + super.setDefaults() + topPadding = PaddingDefaultVerticalSpacing3 + bottomPadding = PaddingDefaultVerticalSpacing3 + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + + private enum CodingKeys: String, CodingKey { + case moleculeName + case headlineBody + case link + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) + link = try typeContainer.decode(LinkModel.self, forKey: .link) + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(headlineBody, forKey: .headlineBody) + try container.encode(link, forKey: .link) + } +} From d47365864f5979f59c03afb000bff64510aa5b29 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Wed, 24 Jun 2020 15:39:09 -0400 Subject: [PATCH 14/42] add logging for tracing template parsing errors back to the source. --- .../Atomic/Atoms/Views/WebViewModel.swift | 2 +- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 2 +- .../BaseControllers/ViewController.swift | 28 +++++++++++++++++++ .../Legacy/Adapters/ActionModelAdapter.swift | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift b/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift index 25142fa5..7e70d0f0 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/WebViewModel.swift @@ -32,7 +32,7 @@ import Foundation url = try typeContainer.decodeIfPresent(URL.self, forKey: .url) htmlString = try typeContainer.decodeIfPresent(String.self, forKey: .htmlString) if url == nil, htmlString == nil { - throw ModelRegistry.Error.decoderErrorModelNotMapped + throw ModelRegistry.Error.decoderErrorModelNotMapped() } height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height) borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor) diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index c6bb77bb..0a242707 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -38,7 +38,7 @@ import Foundation public func getMoleculeModelForJSON(_ json: [String: Any]) throws -> MoleculeModelProtocol? { guard let moleculeName = json.optionalStringForKey(KeyMoleculeName), let type = ModelRegistry.getType(for: moleculeName, with: MoleculeModelProtocol.self) else { - throw ModelRegistry.Error.decoderErrorModelNotMapped + throw ModelRegistry.Error.decoderErrorModelNotMapped() } guard let model = try type.decode(jsonDict: json) as? MoleculeModelProtocol else { throw ModelRegistry.Error.decoderError diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 6e1b35ff..8c63ed51 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -119,6 +119,7 @@ import UIKit return true } catch let parsingError { // Log all parsing errors and fail load. + handleLoggingFor(parsingError: parsingError) if let errorObject = MVMCoreErrorObject.createErrorObject(for: parsingError, location: MVMCoreLoadHandler.sharedGlobal()?.errorLocation(forRequest: loadObject)) { errorObject.messageToDisplay = MVMCoreGetterUtility.hardcodedString(withKey: HardcodedErrorUnableToProcess) error.pointee = errorObject @@ -127,6 +128,33 @@ import UIKit } } + func handleLoggingFor(parsingError: Error) { + if let registryError = parsingError as? ModelRegistry.Error { + switch (registryError) { + case .decoderErrorModelNotMapped(let identifier, let codingKey, let codingPath) where identifier != nil && codingKey != nil && codingPath != nil: + MVMCoreLoggingHandler.shared()?.handleDebugMessage("Error parsing template: Model identifier \"\(identifier!)\" is not mapped for \"\(codingKey!.stringValue)\" @ \(codingPath!.map { return $0.stringValue })") + case .decoderErrorObjectNotPresent(let codingKey, codingPath: let codingPath): + MVMCoreLoggingHandler.shared()?.handleDebugMessage("Error parsing template: Required model \"\(codingKey.stringValue)\" was not found @ \(codingPath.map { return $0.stringValue })") + default: + MVMCoreLoggingHandler.shared()?.handleDebugMessage("Error parsing template: Registry error: \(registryError)") + } + } + if let decodingError = parsingError as? DecodingError { + switch (decodingError) { + case .keyNotFound(let codingKey, let context): + MVMCoreLoggingHandler.shared()?.handleDebugMessage("Error parsing template: Key \(codingKey.stringValue) was not found @ \(context.codingPath.map { return $0.stringValue })") + case .valueNotFound(_, let context): + MVMCoreLoggingHandler.shared()?.handleDebugMessage("Error parsing template: Value not found @ \(context.codingPath.map { return $0.stringValue })") + case .typeMismatch(_, let context): + MVMCoreLoggingHandler.shared()?.handleDebugMessage("Error parsing template: Type mismatch @ \(context.codingPath.map { return $0.stringValue })") + case .dataCorrupted(let context): + MVMCoreLoggingHandler.shared()?.handleDebugMessage("Error parsing template: Data corrupted @ \(context.codingPath.map { return $0.stringValue })") + @unknown default: + MVMCoreLoggingHandler.shared()?.handleDebugMessage("Error parsing template: \(parsingError)") + } + } + } + open func parsePageJSON() throws { } diff --git a/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift b/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift index 5e45b6ed..f88ca5ec 100644 --- a/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift +++ b/MVMCoreUI/Legacy/Adapters/ActionModelAdapter.swift @@ -13,7 +13,7 @@ public extension Dictionary { throw ModelRegistry.Error.decoderOther(message: "Dictionary is not of type [String: Any]") } guard let actionType = ModelRegistry.getType(for: castedSelf.stringForkey(KeyActionType), with: ActionModelProtocol.self) else { - throw ModelRegistry.Error.decoderErrorModelNotMapped + throw ModelRegistry.Error.decoderErrorModelNotMapped() } guard let actionModel = try actionType.decode(jsonDict: castedSelf) as? ActionModelProtocol else { throw ModelRegistry.Error.decoderOther(message: "Could not decode to ActionModelProtocol") From 28c8c5216656f0041903edc1c51f8cd38dc640ca Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 25 Jun 2020 19:04:23 +0530 Subject: [PATCH 15/42] Added top and bottom padding for H2 header molecule. --- .../Headers/H2/HeadersH2PricingTwoRowsModel.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2PricingTwoRowsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2PricingTwoRowsModel.swift index 219f539f..ff0955e7 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2PricingTwoRowsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2PricingTwoRowsModel.swift @@ -40,6 +40,8 @@ public class HeadersH2PricingTwoRowsModel: HeaderModel, MoleculeModelProtocol { //-------------------------------------------------- public override func setDefaults() { super.setDefaults() + topPadding = PaddingDefaultVerticalSpacing3 + bottomPadding = PaddingDefaultVerticalSpacing3 subBody?.attributes = [LabelAttributeStrikeThroughModel(0, subBody?.text.count ?? 0)] subBody2?.attributes = [LabelAttributeStrikeThroughModel(0, subBody2?.text.count ?? 0)] subBody3?.attributes = [LabelAttributeStrikeThroughModel(0, subBody3?.text.count ?? 0)] From e2f2fb428681eaf602bb926d619bbb75b4e3d67e Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 25 Jun 2020 10:01:19 -0400 Subject: [PATCH 16/42] New right variable Toggle fixes --- MVMCoreUI.xcodeproj/project.pbxproj | 12 +- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 10 +- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + ...stRightVariableToggleAllTextAndLinks.swift | 112 ++++++++++++++++++ ...htVariableToggleAllTextAndLinksModel.swift | 58 +++++++++ 5 files changed, 190 insertions(+), 3 deletions(-) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 6c80ccd2..676d554f 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -290,6 +290,8 @@ D224799B231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D224799A231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift */; }; D22D8393241C27B100D3DF69 /* TemplateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22D8392241C27B100D3DF69 /* TemplateModel.swift */; }; D22D8395241FB41200D3DF69 /* UIStackView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22D8394241FB41200D3DF69 /* UIStackView+Extension.swift */; }; + D2351C7A24A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2351C7924A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift */; }; + D2351C7C24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2351C7B24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift */; }; D236E5B4241FEB1000C38625 /* ListTwoColumnPriceDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = D236E5B2241FEB1000C38625 /* ListTwoColumnPriceDescription.swift */; }; D236E5B5241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D236E5B3241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift */; }; D236E5B7242007C500C38625 /* MVMControllerModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D236E5B6242007C500C38625 /* MVMControllerModelProtocol.swift */; }; @@ -744,6 +746,8 @@ D224799A231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccordionMoleculeTableViewCell.swift; sourceTree = ""; }; D22D8392241C27B100D3DF69 /* TemplateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateModel.swift; sourceTree = ""; }; D22D8394241FB41200D3DF69 /* UIStackView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+Extension.swift"; sourceTree = ""; }; + D2351C7924A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableToggleAllTextAndLinksModel.swift; sourceTree = ""; }; + D2351C7B24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableToggleAllTextAndLinks.swift; sourceTree = ""; }; D236E5B2241FEB1000C38625 /* ListTwoColumnPriceDescription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDescription.swift; sourceTree = ""; }; D236E5B3241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDescriptionModel.swift; sourceTree = ""; }; D236E5B6242007C500C38625 /* MVMControllerModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMControllerModelProtocol.swift; sourceTree = ""; }; @@ -1152,6 +1156,8 @@ 8D8067D22444473A00203BE8 /* ListRightVariablePriceChangeAllTextAndLinks.swift */, C7F8012223E846C300396FBD /* ListRVWheelModel.swift */, C7F8012023E8303200396FBD /* ListRVWheel.swift */, + D2351C7924A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift */, + D2351C7B24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift */, ); path = RightVariable; sourceTree = ""; @@ -1502,7 +1508,7 @@ children = ( AA104AC824472DC7004D2810 /* HeadersH1ButtonModel.swift */, AA104AC624472DB0004D2810 /* HeadersH1Button.swift */, - AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */, + AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */, AA104AD9244734DB004D2810 /* HeadersH1LandingPageHeader.swift */, ); path = H1; @@ -1517,7 +1523,7 @@ AA26850B244840AE00CE34CC /* HeadersH2TinyButton.swift */, AA104B1B24474A76004D2810 /* HeadersH2ButtonsModel.swift */, AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */, - AA633B3024989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift */, + AA633B3024989EC000731E80 /* HeadersH2PricingTwoRowsModel.swift */, AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */, ); path = H2; @@ -2310,6 +2316,7 @@ BB55B51D244482C1002001AD /* ListRightVariablePriceChangeBodyText.swift in Sources */, 017BEB382360C6AC0024EF95 /* RadioButtonLabel.swift in Sources */, D28A837923C7D5BC00DFE4FC /* PageModelProtocol.swift in Sources */, + D2351C7C24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift in Sources */, 017BEB7B236763000024EF95 /* LineModel.swift in Sources */, D256E9932412880000360572 /* Header.swift in Sources */, 94C2D9A523872C350006CF46 /* LabelAttributeFontModel.swift in Sources */, @@ -2407,6 +2414,7 @@ AA26850E244840C300CE34CC /* HeadersH2TinyButtonModel.swift in Sources */, D260105F23D0BFFC00764D80 /* StackItem.swift in Sources */, 9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */, + D2351C7A24A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift in Sources */, 01EB369323609801006832FA /* HeaderModel.swift in Sources */, 8DE5BECF2456F7B100772E76 /* ListTwoColumnDropdownSelectors.swift in Sources */, D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 17fabef7..bfa5ba33 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -159,7 +159,6 @@ public typealias ActionBlockConfirmation = () -> (Bool) public override init(frame: CGRect) { super.init(frame: frame) - setupView() } public convenience override init() { @@ -305,6 +304,15 @@ public typealias ActionBlockConfirmation = () -> (Bool) isAnimated = isAnimatedState } + override open func accessibilityActivate() -> Bool { + // Hold state in case User wanted isAnimated to remain off. + let isAnimatedState = isAnimated + isAnimated = false + sendActions(for: .touchUpInside) + isAnimated = isAnimatedState + return true + } + //-------------------------------------------------- // MARK: - UIResponder //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index c6bb77bb..2ac82b23 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -180,6 +180,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableButtonAllTextAndLinks.self, viewModelClass: ListRightVariableButtonAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePriceChangeBodyText.self, viewModelClass: ListRightVariablePriceChangeBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePriceChangeAllTextAndLinks.self, viewModelClass: ListRightVariablePriceChangeAllTextAndLinksModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableToggleAllTextAndLinks.self, viewModelClass: ListRightVariableToggleAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextBodyText.self, viewModelClass: ListOneColumnFullWidthTextBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift new file mode 100644 index 00000000..9d5f6b84 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift @@ -0,0 +1,112 @@ +// +// ListRightVariableToggleAllTextAndLinks.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 6/25/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class ListRightVariableToggleAllTextAndLinks: TableViewCell { + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + + public let toggle = Toggle() + public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() + + //----------------------------------------------------- + // MARK: - Properties + //----------------------------------------------------- + + public var stack: Stack! + + //-------------------------------------------------- + // MARK: - Initializers + //-------------------------------------------------- + + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading)), + (view: toggle, model: StackItemModel(horizontalAlignment: .fill))], + axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + + //----------------------------------------------------- + // MARK: - Lifecycle + //----------------------------------------------------- + + override open func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + accessibilityHint = toggle.accessibilityHint + accessibilityTraits = toggle.accessibilityTraits + } + + //----------------------------------------------------- + // MARK: - Molecular + //----------------------------------------------------- + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListRightVariableToggleAllTextAndLinksModel else { return } + toggle.set(with: model.toggle, delegateObject, additionalData) + eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) + updateAccessibilityLabel() + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } + + //---------------------------------------------------- + // MARK: - Accessibility + //---------------------------------------------------- + + func getAccessibilityMessage() -> String? { + guard let toggleMessage = toggle.accessibilityLabel else { + return eyebrowHeadlineBodyLink.getAccessibilityMessage() + } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { + return toggleMessage + } + return label + ", " + toggleMessage + } + + func updateAccessibilityLabel() { + accessibilityValue = toggle.accessibilityValue + let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 + if !linkShowing && accessoryView == nil { + // Make whole cell focusable if one action + isAccessibilityElement = true + accessibilityLabel = getAccessibilityMessage() + } else { + // Make buttons focusable. + isAccessibilityElement = false + var elements: [Any] = [] + if let accessoryView = accessoryView { + accessoryView.accessibilityLabel = eyebrowHeadlineBodyLink.getAccessibilityMessage() + elements.append(accessoryView) + } else { + toggle.accessibilityLabel = getAccessibilityMessage() + } + elements.append(toggle) + + if linkShowing { + elements.append(eyebrowHeadlineBodyLink.link) + } + accessibilityElements = elements + } + } + + open override func accessibilityActivate() -> Bool { + return toggle.accessibilityActivate() + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift new file mode 100644 index 00000000..9fdc16ca --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift @@ -0,0 +1,58 @@ +// +// ListRightVariableToggleAllTextAndLinksModel.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 6/25/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListRightVariableToggleAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public static var identifier: String = "listRVTgl" + public var toggle: ToggleModel + public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + + public init(toggle: ToggleModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { + self.toggle = toggle + self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink + super.init() + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + + private enum CodingKeys: String, CodingKey { + case moleculeName + case toggle + case eyebrowHeadlineBodyLink + } + + //-------------------------------------------------- + // MARK: - codec + //-------------------------------------------------- + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + toggle = try typeContainer.decode(ToggleModel.self, forKey: .toggle) + eyebrowHeadlineBodyLink = try typeContainer.decode(EyebrowHeadlineBodyLinkModel.self, forKey: .eyebrowHeadlineBodyLink) + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(toggle, forKey: .toggle) + try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) + } +} From 6c5f80aa0b9681b252a42df782bf85769a432d4f Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 25 Jun 2020 10:18:59 -0400 Subject: [PATCH 17/42] list toggle accessibility fix --- .../ListRightVariableToggleAllTextAndLinks.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift index 9d5f6b84..ca2a3b92 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift @@ -107,6 +107,8 @@ import Foundation } open override func accessibilityActivate() -> Bool { - return toggle.accessibilityActivate() + let activate = toggle.accessibilityActivate() + accessibilityValue = toggle.accessibilityValue + return activate } } From 1e90e33b1e5c91decdf9c27b48561bacebd75300 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 10:54:51 -0400 Subject: [PATCH 18/42] fix enabled state for toggle --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 17fabef7..98619c8f 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -96,8 +96,8 @@ public typealias ActionBlockConfirmation = () -> (Bool) }, completion: nil) } else { - backgroundColor = isOn ? containerTintColor.on : containerTintColor.off - knobView.backgroundColor = isOn ? knobTintColor.on : knobTintColor.off + backgroundColor = isEnabled ? isOn ? containerTintColor.on : containerTintColor.off : disabledTintColor.container + knobView.backgroundColor = isEnabled ? isOn ? knobTintColor.on : knobTintColor.off : disabledTintColor.knob self.constrainKnob() } From 9d15c7c3dbaed3ca82485f499a3f39cf00d6396d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 25 Jun 2020 10:56:49 -0400 Subject: [PATCH 19/42] update hint for deactivated. --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 2 ++ .../ListRightVariableToggleAllTextAndLinks.swift | 4 ++-- .../SupportingFiles/Strings/en.lproj/Localizable.strings | 2 +- .../SupportingFiles/Strings/es-MX.lproj/Localizable.strings | 1 + .../SupportingFiles/Strings/es.lproj/Localizable.strings | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index bfa5ba33..d4e090aa 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -64,6 +64,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) changeStateNoAnimation(isEnabled ? isOn : false) backgroundColor = isEnabled ? (isOn ? containerTintColor.on : containerTintColor.off) : disabledTintColor.container knobView.backgroundColor = isEnabled ? (isOn ? knobTintColor.on : knobTintColor.off) : disabledTintColor.knob + accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: isEnabled ? "AccToggleHint" : "AccDisabled") } } @@ -306,6 +307,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) override open func accessibilityActivate() -> Bool { // Hold state in case User wanted isAnimated to remain off. + guard isUserInteractionEnabled == true else { return false } let isAnimatedState = isAnimated isAnimated = false sendActions(for: .touchUpInside) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift index ca2a3b92..a631616b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift @@ -46,8 +46,6 @@ import Foundation super.setupView() addMolecule(stack) stack.restack() - accessibilityHint = toggle.accessibilityHint - accessibilityTraits = toggle.accessibilityTraits } //----------------------------------------------------- @@ -81,6 +79,8 @@ import Foundation } func updateAccessibilityLabel() { + accessibilityHint = toggle.accessibilityHint + accessibilityTraits = toggle.accessibilityTraits accessibilityValue = toggle.accessibilityValue let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 if !linkShowing && accessoryView == nil { diff --git a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings index da55d597..74b907e3 100644 --- a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings @@ -9,7 +9,7 @@ // MARK: Accessibility "AccCloseButton" = "Close"; "swipe_to_select_with_action_hint" = "swipe up or down to select action, then double tap to select."; - +"AccDisabled" = "Disabled"; // MARK: Tab "AccTab" = ", tab"; diff --git a/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings index 0a9eadb9..b3b6298c 100644 --- a/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings @@ -8,6 +8,7 @@ // Accessibility "swipe_to_select_with_action_hint" = "deslízate hacia arriba o hacia abajo para seleccionar la acción, luego toca dos veces para seleccionar."; +"AccDisabled" = "desactivado"; "AccCloseButton" = "Cerrar"; // Tab diff --git a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings index bbc45f4a..8e0dbd02 100644 --- a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings @@ -8,6 +8,7 @@ // Accessibility "swipe_to_select_with_action_hint" = "deslízate hacia arriba o hacia abajo para seleccionar la acción, luego toca dos veces para seleccionar."; +"AccDisabled" = "desactivado"; "AccCloseButton" = "Cerrar"; // Tab From c8ac41fbadd74d61169240953fbdd0b53f28ae16 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 10:58:04 -0400 Subject: [PATCH 20/42] refactored --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 98619c8f..7407fa61 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -62,8 +62,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) didSet { isUserInteractionEnabled = isEnabled changeStateNoAnimation(isEnabled ? isOn : false) - backgroundColor = isEnabled ? (isOn ? containerTintColor.on : containerTintColor.off) : disabledTintColor.container - knobView.backgroundColor = isEnabled ? (isOn ? knobTintColor.on : knobTintColor.off) : disabledTintColor.knob + setToggleAppearanceFromState() } } @@ -96,8 +95,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) }, completion: nil) } else { - backgroundColor = isEnabled ? isOn ? containerTintColor.on : containerTintColor.off : disabledTintColor.container - knobView.backgroundColor = isEnabled ? isOn ? knobTintColor.on : knobTintColor.off : disabledTintColor.knob + setToggleAppearanceFromState() self.constrainKnob() } @@ -342,6 +340,12 @@ public typealias ActionBlockConfirmation = () -> (Bool) // MARK: - Animations //-------------------------------------------------- + public func setToggleAppearanceFromState() { + + backgroundColor = isEnabled ? isOn ? containerTintColor.on : containerTintColor.off : disabledTintColor.container + knobView.backgroundColor = isEnabled ? isOn ? knobTintColor.on : knobTintColor.off : disabledTintColor.knob + } + public func knobReformAnimation() { if isAnimated { From aaca9583351aa34296364b6ebdc4c891e8f3b845 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 25 Jun 2020 13:48:45 -0400 Subject: [PATCH 21/42] push code reduction --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 5be3ce31..2e50dfca 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -305,7 +305,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) override open func accessibilityActivate() -> Bool { // Hold state in case User wanted isAnimated to remain off. - guard isUserInteractionEnabled == true else { return false } + guard isUserInteractionEnabled else { return false } let isAnimatedState = isAnimated isAnimated = false sendActions(for: .touchUpInside) From eb193b16de0e51fd55d137ddcde323cc704cb758 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 17:35:59 -0400 Subject: [PATCH 22/42] dimension changes as per invision --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 17fabef7..ed2a015b 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -44,8 +44,8 @@ public typealias ActionBlockConfirmation = () -> (Bool) }() // Sizes are from InVision design specs. - static let containerSize = CGSize(width: 46, height: 24) - static let knobSize = CGSize(width: 22, height: 22) + static let containerSize = CGSize(width: 51, height: 31) + static let knobSize = CGSize(width: 28, height: 28) private var knobView: View = { let view = View() From 4da8eddd8dc7ba3964935ee4acfa8aac98928de9 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 17:57:42 -0400 Subject: [PATCH 23/42] corner radius --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index ed2a015b..597b50ae 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -50,7 +50,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) private var knobView: View = { let view = View() view.backgroundColor = .white - view.layer.cornerRadius = Toggle.getKnobHeight() / 2.0 + view.layer.cornerRadius = 14 return view }() @@ -205,9 +205,6 @@ public typealias ActionBlockConfirmation = () -> (Bool) knobHeightConstraint?.constant = Self.getKnobHeight() knobWidthConstraint?.constant = Self.getKnobWidth() - layer.cornerRadius = Self.getContainerHeight() / 2.0 - knobView.layer.cornerRadius = Self.getKnobHeight() / 2.0 - changeStateNoAnimation(isOn) } @@ -225,7 +222,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) widthConstraint = widthAnchor.constraint(equalToConstant: Self.containerSize.width) widthConstraint?.isActive = true - layer.cornerRadius = Self.containerSize.height / 2.0 + layer.cornerRadius = 15 backgroundColor = containerTintColor.off addSubview(knobView) From f2f26c60a24da68f16e5be92cdc4aa35e3516968 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 18:08:52 -0400 Subject: [PATCH 24/42] latest dimensions --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index ccf11073..02373958 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -50,7 +50,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) private var knobView: View = { let view = View() view.backgroundColor = .white - view.layer.cornerRadius = 14 + view.layer.cornerRadius = Toggle.getKnobHeight() / 2.0 return view }() @@ -142,14 +142,14 @@ public typealias ActionBlockConfirmation = () -> (Bool) private func constrainKnobOn() { - knobTrailingConstraint = trailingAnchor.constraint(equalTo: knobView.trailingAnchor, constant: 1) + knobTrailingConstraint = trailingAnchor.constraint(equalTo: knobView.trailingAnchor, constant: 2) knobLeadingConstraint = knobView.leadingAnchor.constraint(greaterThanOrEqualTo: leadingAnchor) } private func constrainKnobOff() { knobTrailingConstraint = trailingAnchor.constraint(greaterThanOrEqualTo: knobView.trailingAnchor) - knobLeadingConstraint = knobView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 1) + knobLeadingConstraint = knobView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 2) } //-------------------------------------------------- @@ -203,6 +203,9 @@ public typealias ActionBlockConfirmation = () -> (Bool) knobHeightConstraint?.constant = Self.getKnobHeight() knobWidthConstraint?.constant = Self.getKnobWidth() + layer.cornerRadius = Self.getContainerHeight() / 2.0 + knobView.layer.cornerRadius = Self.getKnobHeight() / 2.0 + changeStateNoAnimation(isOn) } @@ -220,7 +223,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) widthConstraint = widthAnchor.constraint(equalToConstant: Self.containerSize.width) widthConstraint?.isActive = true - layer.cornerRadius = 15 + layer.cornerRadius = Self.getContainerHeight() / 2.0 backgroundColor = containerTintColor.off addSubview(knobView) From 3eb6f6c6901df7df4f3792167fe1568e32863605 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 26 Jun 2020 08:57:42 -0400 Subject: [PATCH 25/42] open list page template model for outside extension. --- MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift | 6 +++--- MVMCoreUI/Atomic/Templates/TemplateModel.swift | 3 ++- MVMCoreUI/Atomic/Templates/ThreeLayerModelBase.swift | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift b/MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift index b239bd81..b2b52573 100644 --- a/MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift +++ b/MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift @@ -8,12 +8,12 @@ import Foundation -@objcMembers public class ListPageTemplateModel: ThreeLayerModelBase { +@objcMembers open class ListPageTemplateModel: ThreeLayerModelBase { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- - public override class var identifier: String { + open override class var identifier: String { return "list" } public var molecules: [ListItemModelProtocol & MoleculeModelProtocol]? @@ -49,7 +49,7 @@ import Foundation try super.init(from: decoder) } - public override func encode(to encoder: Encoder) throws { + open override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeModelsIfPresent(molecules, forKey: .molecules) diff --git a/MVMCoreUI/Atomic/Templates/TemplateModel.swift b/MVMCoreUI/Atomic/Templates/TemplateModel.swift index 01753414..bb8bb104 100644 --- a/MVMCoreUI/Atomic/Templates/TemplateModel.swift +++ b/MVMCoreUI/Atomic/Templates/TemplateModel.swift @@ -9,7 +9,8 @@ import Foundation -@objcMembers public class TemplateModel: MVMControllerModelProtocol, TabPageModelProtocol { +@objcMembers open class TemplateModel: MVMControllerModelProtocol, TabPageModelProtocol { + //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Templates/ThreeLayerModelBase.swift b/MVMCoreUI/Atomic/Templates/ThreeLayerModelBase.swift index f0276979..1120b0e7 100644 --- a/MVMCoreUI/Atomic/Templates/ThreeLayerModelBase.swift +++ b/MVMCoreUI/Atomic/Templates/ThreeLayerModelBase.swift @@ -8,7 +8,7 @@ import Foundation -@objcMembers public class ThreeLayerModelBase: TemplateModel, ThreeLayerTemplateModelProtocol { +@objcMembers open class ThreeLayerModelBase: TemplateModel, ThreeLayerTemplateModelProtocol { public var anchorHeader: Bool = false public var header: MoleculeModelProtocol? public var anchorFooter: Bool = false From 3edb3dcfe246ee7b19019f03c639b0b272fe9b65 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 26 Jun 2020 08:58:11 -0400 Subject: [PATCH 26/42] toggle alternateAction handling. --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 2e50dfca..87373ff4 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -392,8 +392,23 @@ public typealias ActionBlockConfirmation = () -> (Bool) accessibilityLabel = accessibileString } - if let actionMap = model.action?.toJSON() { - didToggleAction = { MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) } + let actionMap = model.action?.toJSON() + let alternateActionMap = model.alternateAction?.toJSON() + if actionMap != nil || alternateActionMap != nil { + didToggleAction = { [weak self] in + guard let strongSelf = self else { return } + if strongSelf.isOn { + if actionMap != nil { + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) + } + } else { + if alternateActionMap != nil { + MVMCoreActionHandler.shared()?.handleAction(with: alternateActionMap, additionalData: additionalData, delegateObject: delegateObject) + } else if actionMap != nil { + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) + } + } + } } } From 1337e87c3de64703292e057a7033f6e0bf4bd65d Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 26 Jun 2020 08:59:01 -0400 Subject: [PATCH 27/42] move decoding logic to ViewController for overrides. --- MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift | 6 ++++-- MVMCoreUI/BaseControllers/ViewController.swift | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift index 04280042..4e6d5d32 100644 --- a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift @@ -14,13 +14,15 @@ public protocol TemplateProtocol: AnyObject { } public extension TemplateProtocol where Self: ViewController { + func parseTemplate(json: [AnyHashable: Any]?) throws { guard let pageJSON = json else { return } let data = try JSONSerialization.data(withJSONObject: pageJSON) let decoder = JSONDecoder() try decoder.add(delegateObject: delegateObjectIVar) - let templateModel = try decoder.decode(TemplateModel.self, from: data) - self.templateModel = templateModel + let templateModel = try decodeTemplate(using: decoder, from: data) + self.templateModel = templateModel as? TemplateModel self.pageModel = templateModel as? MVMControllerModelProtocol } + } diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 6e1b35ff..df604d82 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -130,6 +130,10 @@ import UIKit open func parsePageJSON() throws { } + open func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModel { + return try decoder.decode(TemplateModel.self, from: data) + } + open class func verifyRequiredModulesLoaded(for loadObject: MVMCoreLoadObject?, error: AutoreleasingUnsafeMutablePointer) -> Bool { guard let pageType = loadObject?.pageType, var modulesRequired = MVMCoreUIViewControllerMappingObject.shared()?.modulesRequired(forPageType: pageType), !modulesRequired.isEmpty else { return true } From 0cb184a41b187876e3468193a37bc91be7ac56bb Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 26 Jun 2020 20:00:54 -0400 Subject: [PATCH 28/42] Fix methodology of template model subclassing. --- MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift | 13 +++++++++++-- MVMCoreUI/BaseControllers/ViewController.swift | 4 ---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift index 4e6d5d32..699c217c 100644 --- a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift @@ -13,6 +13,10 @@ public protocol TemplateProtocol: AnyObject { var templateModel: TemplateModel? { get set } } +public protocol CustomTemplateDecoder { + func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModelProtocol +} + public extension TemplateProtocol where Self: ViewController { func parseTemplate(json: [AnyHashable: Any]?) throws { @@ -20,8 +24,13 @@ public extension TemplateProtocol where Self: ViewController { let data = try JSONSerialization.data(withJSONObject: pageJSON) let decoder = JSONDecoder() try decoder.add(delegateObject: delegateObjectIVar) - let templateModel = try decodeTemplate(using: decoder, from: data) - self.templateModel = templateModel as? TemplateModel + let templateModel: TemplateModel + if let customDecoder = self as? CustomTemplateDecoder { + templateModel = try customDecoder.decodeTemplate(using: decoder, from: data) as! Self.TemplateModel + } else { + templateModel = try decoder.decode(TemplateModel.self, from: data) + } + self.templateModel = templateModel self.pageModel = templateModel as? MVMControllerModelProtocol } diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index df604d82..bd8c66f9 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -129,10 +129,6 @@ import UIKit open func parsePageJSON() throws { } - - open func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModel { - return try decoder.decode(TemplateModel.self, from: data) - } open class func verifyRequiredModulesLoaded(for loadObject: MVMCoreLoadObject?, error: AutoreleasingUnsafeMutablePointer) -> Bool { guard let pageType = loadObject?.pageType, var modulesRequired = MVMCoreUIViewControllerMappingObject.shared()?.modulesRequired(forPageType: pageType), From e7c7351840b3e952ded3a2b9b6d993f61cb103e6 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 29 Jun 2020 11:01:17 -0400 Subject: [PATCH 29/42] separating navigation item setters --- .../BaseControllers/ViewController.swift | 50 +++++++++++++------ .../Containers/NavigationController.swift | 32 +++++++----- ...MCoreUISplitViewController+Extension.swift | 6 +-- 3 files changed, 56 insertions(+), 32 deletions(-) diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 6e1b35ff..6a585dab 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -94,9 +94,10 @@ import UIKit try parsePageJSON() MVMCoreDispatchUtility.performBlock(onMainThread: { self.handleNewDataAndUpdateUI() - // If the screen is showing, can update the navigation controller. - if MVMCoreUIUtility.getCurrentVisibleController() == self.manager ?? self { - self.setNavigationController() + + // Update navigation bar if showing. + if MVMCoreUIUtility.getCurrentVisibleController() == self { + self.setNavigationBar() } }) } catch { @@ -168,12 +169,6 @@ import UIKit /// Processes any new data. Called after the page is loaded the first time and on response updates for this page, open func handleNewData() { - // TODO: remove legacy. Temporary, convert legacy to navigation model. - if pageModel?.navigationBar == nil { - let navigationItem = createDefaultLegacyNavigationModel() - pageModel?.navigationBar = navigationItem - } - if formValidator == nil { let rules = pageModel?.formRules formValidator = FormValidator(rules) @@ -182,20 +177,43 @@ import UIKit if let backgroundColor = pageModel?.backgroundColor { view.backgroundColor = backgroundColor.uiColor } + + // Sets up the navigation item based on the data. + setNavigationItem() } // MARK: - Navigation Item (Move to model base) - open func setNavigationController() { + + open func getNavigationModel() -> NavigationItemModelProtocol? { + // TODO: remove legacy. Temporary, convert legacy to navigation model. + if pageModel?.navigationBar == nil { + let navigationItem = createDefaultLegacyNavigationModel() + pageModel?.navigationBar = navigationItem + } + return pageModel?.navigationBar + } + + /// Sets the navigation item for this view controller. + open func setNavigationItem() { + guard let navigationItemModel = getNavigationModel(), + let navigationController = navigationController else { return } + + // We additionally want our left items + navigationItem.leftItemsSupplementBackButton = true + + // Utilize helper function to set the navigation item state. + NavigationController.setNavigationItem(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: self) + } + + /// Sets the appearance of the navigation bar based on the model. + open func setNavigationBar() { let viewController = manager ?? self - guard let navigationItemModel = pageModel?.navigationBar, + guard let navigationItemModel = getNavigationModel(), let navigationController = viewController.navigationController else { MVMCoreUISession.sharedGlobal()?.splitViewController?.parent?.setNeedsStatusBarAppearanceUpdate() return } - // We additionally want our left items - navigationItem.leftItemsSupplementBackButton = true - // Utilize helper function to set the split view and navigation item state. MVMCoreUISplitViewController.setSplitViewController(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: isMasterInitiallyAccessible(), rightPanelAccessible: isSupportInitiallyAccessible(), progress: bottomProgress() ?? 0) } @@ -308,7 +326,7 @@ import UIKit open func pageShown() { // Update the navigation bar ui when view is appearing. - setNavigationController() + setNavigationBar() // Update tab if needed. updateTabBar() @@ -425,7 +443,7 @@ import UIKit // Reset the navigation state. public func splitViewDidReset() { - setNavigationController() + setNavigationBar() } // MARK: - UITextFieldDelegate (Check if this is still needed) diff --git a/MVMCoreUI/Containers/NavigationController.swift b/MVMCoreUI/Containers/NavigationController.swift index 12d70634..a412728b 100644 --- a/MVMCoreUI/Containers/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController.swift @@ -43,6 +43,14 @@ import UIKit return navigationController } + /// 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.backButton != nil) + setNavigationButtons(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 @@ -68,11 +76,7 @@ import UIKit } /// Convenience function for setting the navigation bar ui, except for the buttons. - public static func setNavigationUI(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { - viewController.navigationItem.title = navigationItemModel.title - viewController.navigationItem.accessibilityLabel = navigationItemModel.title - viewController.navigationItem.hidesBackButton = (navigationItemModel.backButton != nil) - + public static func setNavigationBarUI(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { navigationController.setNavigationBarHidden(navigationItemModel.hidden, animated: true) navigationController.navigationBar.barTintColor = navigationItemModel.backgroundColor?.uiColor ?? .white @@ -88,17 +92,19 @@ import UIKit } } - /// Convenience function for setting navigation bar with model. - public static func set(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { - setNavigationUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) - setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) - } - /// Convenience setter for legacy files - public static func set(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws { + public static func setNavigationItem(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws { guard let barModel = try MoleculeObjectMapping.shared()?.getMoleculeModelForJSON(navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else { throw ModelRegistry.Error.decoderOther(message: "Model not a bar model") } - set(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController) + setNavigationItem(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController) + } + + /// Convenience setter for legacy files + public static func setNavigationBarUI(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws { + guard let barModel = try MoleculeObjectMapping.shared()?.getMoleculeModelForJSON(navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else { + throw ModelRegistry.Error.decoderOther(message: "Model not a bar model") + } + setNavigationBarUI(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController) } } diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index bfbe19ac..059723a6 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -15,7 +15,7 @@ public extension MVMCoreUISplitViewController { guard let splitView = MVMCoreUISplitViewController.main(), navigationController == splitView.navigationController, navigationController.topViewController == viewController else { - NavigationController.set(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) + NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) return } splitView.set(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: leftPanelAccessible, rightPanelAccessible: rightPanelAccessible, progress: progress) @@ -27,7 +27,7 @@ public extension MVMCoreUISplitViewController { // Setup the panels. setupPanels() - NavigationController.setNavigationUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) + NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) setLeftPanelIsAccessible(leftPanelAccessible ?? leftPanelIsAccessible, for: viewController, updateNavigationButtons: false) setRightPanelIsAccessible(rightPanelAccessible ?? rightPanelIsAccessible, for: viewController, updateNavigationButtons: false) @@ -115,7 +115,7 @@ public extension MVMCoreUISplitViewController { guard let splitView = MVMCoreUISplitViewController.main(), navigationController == splitView.navigationController, navigationController.topViewController == viewController else { - NavigationController.set(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) + NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) return } let progress = progress?.floatValue From aa23c9298773eb8326c889271e74373e808a4eae Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 29 Jun 2020 14:59:57 -0400 Subject: [PATCH 30/42] very minor cleaning --- .../DesignedComponents/Headers/H2/HeadersH2Link.swift | 2 +- .../Headers/H2/HeadersH2LinkModel.swift | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift index 4b0334e7..c5aaefc8 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2Link.swift @@ -20,7 +20,7 @@ import Foundation // MARK: - Initializers //------------------------------------------------------- public override init(frame: CGRect) { - stack = Stack.createStack(with: [headlineBody, link], spacing: PaddingHorizontalBetweenRelatedItems) + stack = Stack.createStack(with: [headlineBody, link]) super.init(frame: frame) } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift index 5793eedf..66189f99 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2LinkModel.swift @@ -32,9 +32,13 @@ public class HeadersH2LinkModel: HeaderModel, MoleculeModelProtocol { //-------------------------------------------------- public override func setDefaults() { + if topPadding == nil { + topPadding = Padding.Component.VerticalMarginSpacing + } + if bottomPadding == nil { + bottomPadding = Padding.Component.VerticalMarginSpacing + } super.setDefaults() - topPadding = PaddingDefaultVerticalSpacing3 - bottomPadding = PaddingDefaultVerticalSpacing3 } //-------------------------------------------------- From 625bc1ca013d329f81ab344ba62cea8400122365 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 29 Jun 2020 15:06:14 -0400 Subject: [PATCH 31/42] Modernize variable --- .../Headers/H2/HeadersH2ButtonsModel.swift | 8 ++++++-- .../Headers/H2/HeadersH2NoButtonsBodyTextModel.swift | 8 ++++++-- .../Headers/H2/HeadersH2PricingTwoRowsModel.swift | 8 ++++++-- .../Headers/H2/HeadersH2TinyButtonModel.swift | 8 ++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2ButtonsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2ButtonsModel.swift index 3cb09a0f..d3ea7497 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2ButtonsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2ButtonsModel.swift @@ -33,9 +33,13 @@ public class HeadersH2ButtonsModel: HeaderModel, MoleculeModelProtocol { //-------------------------------------------------- public override func setDefaults() { + if topPadding == nil { + topPadding = Padding.Component.VerticalMarginSpacing + } + if bottomPadding == nil { + bottomPadding = Padding.Component.VerticalMarginSpacing + } super.setDefaults() - topPadding = PaddingDefaultVerticalSpacing3 - bottomPadding = PaddingDefaultVerticalSpacing3 } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2NoButtonsBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2NoButtonsBodyTextModel.swift index a6cfc0ce..96d30730 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2NoButtonsBodyTextModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2NoButtonsBodyTextModel.swift @@ -27,9 +27,13 @@ public class HeadersH2NoButtonsBodyTextModel: HeaderModel, MoleculeModelProtocol } public override func setDefaults() { + if topPadding == nil { + topPadding = Padding.Component.VerticalMarginSpacing + } + if bottomPadding == nil { + bottomPadding = Padding.Component.VerticalMarginSpacing + } super.setDefaults() - topPadding = PaddingDefaultVerticalSpacing3 - bottomPadding = PaddingDefaultVerticalSpacing3 } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2PricingTwoRowsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2PricingTwoRowsModel.swift index ff0955e7..01bd72e4 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2PricingTwoRowsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2PricingTwoRowsModel.swift @@ -39,9 +39,13 @@ public class HeadersH2PricingTwoRowsModel: HeaderModel, MoleculeModelProtocol { // MARK: - Methods //-------------------------------------------------- public override func setDefaults() { + if topPadding == nil { + topPadding = Padding.Component.VerticalMarginSpacing + } + if bottomPadding == nil { + bottomPadding = Padding.Component.VerticalMarginSpacing + } super.setDefaults() - topPadding = PaddingDefaultVerticalSpacing3 - bottomPadding = PaddingDefaultVerticalSpacing3 subBody?.attributes = [LabelAttributeStrikeThroughModel(0, subBody?.text.count ?? 0)] subBody2?.attributes = [LabelAttributeStrikeThroughModel(0, subBody2?.text.count ?? 0)] subBody3?.attributes = [LabelAttributeStrikeThroughModel(0, subBody3?.text.count ?? 0)] diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2TinyButtonModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2TinyButtonModel.swift index 55c2c6e4..d4edfd38 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2TinyButtonModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2TinyButtonModel.swift @@ -33,9 +33,13 @@ public class HeadersH2TinyButtonModel: HeaderModel, MoleculeModelProtocol { //-------------------------------------------------- public override func setDefaults() { + if topPadding == nil { + topPadding = Padding.Component.VerticalMarginSpacing + } + if bottomPadding == nil { + bottomPadding = Padding.Component.VerticalMarginSpacing + } super.setDefaults() - topPadding = PaddingDefaultVerticalSpacing3 - bottomPadding = PaddingDefaultVerticalSpacing3 button.style = .secondary button.size = .tiny } From d1df1e2944696e6c88eee0c90cbff2645ac89c9a Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 29 Jun 2020 19:54:00 -0400 Subject: [PATCH 32/42] feedback --- .../MVMCoreUISplitViewController+Extension.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index 963834ff..e9d0eb65 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -43,14 +43,14 @@ public extension MVMCoreUISplitViewController { } /// Sets the left navigation items for the view controller based on model and splitview. - func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { + func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { var leftItems: [UIBarButtonItem] = [] let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject // Add back button first. - if navigationItemModel?.alwaysShowBackButton != false { - if let backButtonModel = navigationItemModel?.backButton { - if navigationController.viewControllers.count > 1 || navigationItemModel!.alwaysShowBackButton ?? false { + if navigationItemModel.alwaysShowBackButton ?? false != false { + if let backButtonModel = navigationItemModel.backButton { + if navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton ?? false { leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } } else if let backButton = backButton, @@ -67,7 +67,7 @@ public extension MVMCoreUISplitViewController { } // Add other model buttons - if let leftItemModels = navigationItemModel?.additionalLeftButtons { + if let leftItemModels = navigationItemModel.additionalLeftButtons { for item in leftItemModels { leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } @@ -82,7 +82,7 @@ public extension MVMCoreUISplitViewController { } /// Sets the right navigation items for the view controller based on model and splitview. - func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { + func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject var rightItems: [UIBarButtonItem] = [] @@ -94,7 +94,7 @@ public extension MVMCoreUISplitViewController { } // Add other model buttons - if let rightItemModels = navigationItemModel?.additionalRightButtons { + if let rightItemModels = navigationItemModel.additionalRightButtons { for item in rightItemModels { rightItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } From c599f314c39580895a6f2f3ea68a52126eaf9984 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 29 Jun 2020 19:58:34 -0400 Subject: [PATCH 33/42] undo changes --- .../MVMCoreUISplitViewController+Extension.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index e9d0eb65..963834ff 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -43,14 +43,14 @@ public extension MVMCoreUISplitViewController { } /// Sets the left navigation items for the view controller based on model and splitview. - func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { + func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { var leftItems: [UIBarButtonItem] = [] let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject // Add back button first. - if navigationItemModel.alwaysShowBackButton ?? false != false { - if let backButtonModel = navigationItemModel.backButton { - if navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton ?? false { + if navigationItemModel?.alwaysShowBackButton != false { + if let backButtonModel = navigationItemModel?.backButton { + if navigationController.viewControllers.count > 1 || navigationItemModel!.alwaysShowBackButton ?? false { leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } } else if let backButton = backButton, @@ -67,7 +67,7 @@ public extension MVMCoreUISplitViewController { } // Add other model buttons - if let leftItemModels = navigationItemModel.additionalLeftButtons { + if let leftItemModels = navigationItemModel?.additionalLeftButtons { for item in leftItemModels { leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } @@ -82,7 +82,7 @@ public extension MVMCoreUISplitViewController { } /// Sets the right navigation items for the view controller based on model and splitview. - func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { + func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject var rightItems: [UIBarButtonItem] = [] @@ -94,7 +94,7 @@ public extension MVMCoreUISplitViewController { } // Add other model buttons - if let rightItemModels = navigationItemModel.additionalRightButtons { + if let rightItemModels = navigationItemModel?.additionalRightButtons { for item in rightItemModels { rightItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } From 51c243d059ddb81c0bd90166c5342d566d7bbe19 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 1 Jul 2020 17:03:40 +0530 Subject: [PATCH 34/42] 21522(iOS - Headers - H2 - Caret Link) story initial commit. --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + .../Headers/H2/HeadersH2CaretLink.swift | 58 ++++++++++++++++ .../Headers/H2/HeadersH2CaretLinkModel.swift | 66 +++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLink.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLinkModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 9ebcf41d..f280c4c6 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -225,6 +225,8 @@ AAB9C10824346F4B00151545 /* RadioSwatches.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C10724346F4B00151545 /* RadioSwatches.swift */; }; AAB9C10A243496DD00151545 /* RadioSwatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C109243496DD00151545 /* RadioSwatch.swift */; }; AAC6F167243332E400F295C1 /* RadioSwatchesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */; }; + AAE7270C24AC8B8500A3ED0E /* HeadersH2CaretLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE7270B24AC8B8500A3ED0E /* HeadersH2CaretLinkModel.swift */; }; + AAE7270E24AC8B9300A3ED0E /* HeadersH2CaretLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE7270D24AC8B9300A3ED0E /* HeadersH2CaretLink.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 */; }; @@ -683,6 +685,8 @@ AAB9C10724346F4B00151545 /* RadioSwatches.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatches.swift; sourceTree = ""; }; AAB9C109243496DD00151545 /* RadioSwatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatch.swift; sourceTree = ""; }; AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchesModel.swift; sourceTree = ""; }; + AAE7270B24AC8B8500A3ED0E /* HeadersH2CaretLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2CaretLinkModel.swift; sourceTree = ""; }; + AAE7270D24AC8B9300A3ED0E /* HeadersH2CaretLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2CaretLink.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 = ""; }; @@ -1531,6 +1535,8 @@ AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */, AA71AD3D24A32FCE00ACA76F /* HeadersH2LinkModel.swift */, AA71AD3F24A32FE700ACA76F /* HeadersH2Link.swift */, + AAE7270B24AC8B8500A3ED0E /* HeadersH2CaretLinkModel.swift */, + AAE7270D24AC8B9300A3ED0E /* HeadersH2CaretLink.swift */, ); path = H2; sourceTree = ""; @@ -2369,6 +2375,7 @@ 279B1569242BBC2F00921D6C /* ActionModelAdapter.swift in Sources */, BB6C6AC0242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift in Sources */, 8DEFA95E243DAC2F000D27E5 /* ListThreeColumnDataUsageDivider.swift in Sources */, + AAE7270E24AC8B9300A3ED0E /* HeadersH2CaretLink.swift in Sources */, D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */, 324FB6AC24936717002552C7 /* ListLeftVariableNumberedListBodyText.swift in Sources */, AAA74A172410C04600080241 /* HeadersH2NoButtonsBodyText.swift in Sources */, @@ -2470,6 +2477,7 @@ D264FA90243BCE6800D98315 /* ThreeLayerCollectionViewController.swift in Sources */, AA104B1C24474A76004D2810 /* HeadersH2ButtonsModel.swift in Sources */, 0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */, + AAE7270C24AC8B8500A3ED0E /* HeadersH2CaretLinkModel.swift in Sources */, BB6C6AC824225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift in Sources */, 0A41BA6E2344FCD400D4C0BC /* CATransaction+Extension.swift in Sources */, D21B7F73243BAC6800051ABF /* CollectionItemModelProtocol.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index fbb2fe8c..38aac342 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -212,6 +212,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Buttons.self, viewModelClass: HeadersH2ButtonsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2PricingTwoRows.self, viewModelClass: HeadersH2PricingTwoRowsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Link.self, viewModelClass: HeadersH2LinkModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2CaretLink.self, viewModelClass: HeadersH2CaretLinkModel.self) // Device Items MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexButtonMedium.self, viewModelClass: ListDeviceComplexButtonMediumModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLink.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLink.swift new file mode 100644 index 00000000..1aaf092f --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLink.swift @@ -0,0 +1,58 @@ +// +// HeadersH2CaretLink.swift +// MVMCoreUI +// +// Created by Lekshmi S on 01/07/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +@objcMembers open class HeadersH2CaretLink: HeaderView { + //-------------------------------------------------- + // MARK: - Outlets + //-------------------------------------------------- + public let headlineBody = HeadlineBody() + public let caretLink = CaretLink() + public let stack: Stack + + //------------------------------------------------------- + // MARK: - Initializers + //------------------------------------------------------- + public override init(frame: CGRect) { + stack = Stack.createStack(with: [headlineBody, caretLink]) + super.init(frame: frame) + } + + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //------------------------------------------------------- + // MARK: - Lifecycle + //------------------------------------------------------- + open override func setupView() { + super.setupView() + headlineBody.stylePageHeader() + addMolecule(stack) + stack.restack() + } + + //---------------------------------------------------- + // MARK: - Molecule + //------------------------------------------------------ + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? HeadersH2CaretLinkModel else { return } + headlineBody.set(with: model.headlineBody, delegateObject, additionalData) + caretLink.set(with: model.caretLink, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 121 + } + + open override func reset() { + super.reset() + headlineBody.stylePageHeader() + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLinkModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLinkModel.swift new file mode 100644 index 00000000..9d56118e --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLinkModel.swift @@ -0,0 +1,66 @@ +// +// HeadersH2CaretLinkModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 01/07/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +public class HeadersH2CaretLinkModel: HeaderModel, MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + public static var identifier: String = "headerH2CrtBtn" + public var headlineBody: HeadlineBodyModel + public var caretLink: CaretLinkModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + public init(headlineBody: HeadlineBodyModel, caretLink: CaretLinkModel) { + self.headlineBody = headlineBody + self.caretLink = caretLink + super.init() + } + + //-------------------------------------------------- + // MARK: - Methods + //-------------------------------------------------- + public override func setDefaults() { + if topPadding == nil { + topPadding = Padding.Component.VerticalMarginSpacing + } + if bottomPadding == nil { + bottomPadding = Padding.Component.VerticalMarginSpacing + } + super.setDefaults() + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { + case moleculeName + case headlineBody + case caretLink + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) + caretLink = try typeContainer.decode(CaretLinkModel.self, forKey: .caretLink) + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(headlineBody, forKey: .headlineBody) + try container.encode(caretLink, forKey: .caretLink) + } +} From 616c242b29fb4786147b5f3546774ae3cef8ef9b Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Wed, 1 Jul 2020 11:26:52 -0400 Subject: [PATCH 35/42] remove extra custom protocol --- .../Atomic/Protocols/TemplateProtocol.swift | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift index 699c217c..4696ce38 100644 --- a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift @@ -11,10 +11,8 @@ import Foundation public protocol TemplateProtocol: AnyObject { associatedtype TemplateModel: TemplateModelProtocol var templateModel: TemplateModel? { get set } -} - -public protocol CustomTemplateDecoder { - func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModelProtocol + + func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModel } public extension TemplateProtocol where Self: ViewController { @@ -24,14 +22,12 @@ public extension TemplateProtocol where Self: ViewController { let data = try JSONSerialization.data(withJSONObject: pageJSON) let decoder = JSONDecoder() try decoder.add(delegateObject: delegateObjectIVar) - let templateModel: TemplateModel - if let customDecoder = self as? CustomTemplateDecoder { - templateModel = try customDecoder.decodeTemplate(using: decoder, from: data) as! Self.TemplateModel - } else { - templateModel = try decoder.decode(TemplateModel.self, from: data) - } - self.templateModel = templateModel + self.templateModel = try decodeTemplate(using: decoder, from: data) self.pageModel = templateModel as? MVMControllerModelProtocol } + func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModel { + return try decoder.decode(TemplateModel.self, from: data) + } + } From 50888916cbad468ccb9223e3dcb4b963f0744c4b Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Wed, 1 Jul 2020 14:55:04 -0400 Subject: [PATCH 36/42] open list template model subclassing --- MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift b/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift index 4be4e025..372ae778 100644 --- a/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift +++ b/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift @@ -28,6 +28,11 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol try super.parsePageJSON() } + // For subclassing the model. + open func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> ListPageTemplateModel { + return try decoder.decode(ListPageTemplateModel.self, from: data) + } + open override var loadObject: MVMCoreLoadObject? { didSet { guard loadObject != oldValue else { return } From 012d16ed09893d7722fa123e1cef4ee4210c1c6f Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Wed, 1 Jul 2020 14:55:21 -0400 Subject: [PATCH 37/42] code review --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index bb75d963..dfffcded 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -396,8 +396,8 @@ public typealias ActionBlockConfirmation = () -> (Bool) let alternateActionMap = model.alternateAction?.toJSON() if actionMap != nil || alternateActionMap != nil { didToggleAction = { [weak self] in - guard let strongSelf = self else { return } - if strongSelf.isOn { + guard let self = self else { return } + if self.isOn { if actionMap != nil { MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) } From 356d8064f294fed13083c74c318a534847328a34 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 2 Jul 2020 15:25:12 -0400 Subject: [PATCH 38/42] allow view to be tappable --- MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m index 3d15652c..ed9f5271 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m @@ -374,6 +374,7 @@ weakSelf.shortViewHeight.active = NO; } completion:^(BOOL finished) { [weakSelf.viewToLayout layoutIfNeeded]; + weakSelf.accessibilityElements = @[weakSelf.shortView.label]; UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil); [MVMCoreDispatchUtility performBlockInBackground:^{ // Must notify animation delegate when animating finished. From 4f013bec6f6f3c7171db6cbfd71c13f378cc0a3d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 2 Jul 2020 16:29:17 -0400 Subject: [PATCH 39/42] action fix for tab bar --- MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift | 3 +++ MVMCoreUI/BaseControllers/ViewController.swift | 1 + MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h | 4 ++-- MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift b/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift index 1bf79795..19c7e107 100644 --- a/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift @@ -9,6 +9,9 @@ import Foundation @objc public protocol TabBarProtocol { + + var delegateObject: MVMCoreUIDelegateObject? { get set } + /// Should visually select the given tab index. @objc func highlightTab(at index: Int) diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 6a585dab..b6bdc1ca 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -267,6 +267,7 @@ import UIKit open func updateTabBar() { guard MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() == self, let tabModel = pageModel as? TabPageModelProtocol else { return } + MVMCoreUISplitViewController.main()?.tabBar?.delegateObject = delegateObjectIVar if let index = tabModel.tabBarIndex { MVMCoreUISplitViewController.main()?.tabBar?.highlightTab(at: index) } diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h index 9fec90f5..14da21ad 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h @@ -17,8 +17,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)defaultLogPageStateForController:(nonnull id )controller; // Action Logging -- (void)defaultLogActionForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; -- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; +- (void)defaultLogActionForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; +- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; @end diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m index 0c694cce..45a13acf 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m @@ -13,10 +13,10 @@ - (void)defaultLogPageStateForController:(nonnull id )controller { } -- (void)defaultLogActionForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { +- (void)defaultLogActionForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { } -- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { +- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { return nil; } From 573d6b2a986c25042fcadfb8957f6180f7cdc487 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 2 Jul 2020 19:20:30 -0400 Subject: [PATCH 40/42] style in model for list item --- .../ListTwoColumnPriceDetailsModel.swift | 5 +- .../ListFourColumnDataUsageDividerModel.swift | 2 +- ...nFullWidthTextDividerSubsectionModel.swift | 2 +- ...nTextWithWhitespaceDividerShortModel.swift | 2 +- ...mnTextWithWhitespaceDividerTallModel.swift | 2 +- ...stThreeColumnBillChangesDividerModel.swift | 2 +- ...ListThreeColumnDataUsageDividerModel.swift | 2 +- ...eColumnInternationalDataDividerModel.swift | 2 +- .../ListThreeColumnPlanDataDividerModel.swift | 2 +- ...ListThreeColumnSpeedTestDividerModel.swift | 2 +- .../ListTwoColumnSubsectionDividerModel.swift | 2 +- .../Items/DropDownListItemModel.swift | 2 +- .../Molecules/Items/ListItemModel.swift | 51 ++++++++++--- .../ListItemModelProtocol.swift | 11 ++- MVMCoreUI/BaseClasses/TableViewCell.swift | 71 ++++++------------- 15 files changed, 85 insertions(+), 75 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift index 86dee27a..97582574 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift @@ -33,10 +33,9 @@ public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtoco //-------------------------------------------------- override public func setDefaults() { + style = ListItemStyle.none super.setDefaults() - - style = "none" - + if leftLabel.textColor == nil { leftLabel.textColor = Color(uiColor: .mvmCoolGray6) } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift index 1c161bd4..a094f91c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift @@ -33,8 +33,8 @@ public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelPr } override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift index 34687957..063c8cfa 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift @@ -33,8 +33,8 @@ public class ListOneColumnFullWidthTextDividerSubsectionModel: ListItemModel, Mo //-------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift index d63ea18b..f6303a85 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift @@ -33,8 +33,8 @@ public class ListOneColumnTextWithWhitespaceDividerShortModel: ListItemModel, Mo //-------------------------------------------------- override public func setDefaults() { + style = .shortDivider super.setDefaults() - style = "shortDivider" } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift index d8119802..e3bb634d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift @@ -33,8 +33,8 @@ public class ListOneColumnTextWithWhitespaceDividerTallModel: ListItemModel, Mol //-------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDividerModel.swift index 6f824fff..965de291 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDividerModel.swift @@ -35,8 +35,8 @@ public class ListThreeColumnBillChangesDividerModel: ListItemModel, MoleculeMode //----------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDividerModel.swift index 93efb963..268e68e9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDividerModel.swift @@ -35,8 +35,8 @@ public class ListThreeColumnDataUsageDividerModel: ListItemModel, MoleculeModelP //----------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift index b4909581..f7df0c3a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift @@ -35,8 +35,8 @@ public class ListThreeColumnInternationalDataDividerModel: ListItemModel, Molecu //------------------------------------------------------ override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //------------------------------------------------------ diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift index 6b29f58e..84357252 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift @@ -35,8 +35,8 @@ public class ListThreeColumnPlanDataDividerModel: ListItemModel, MoleculeModelPr //----------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" leftHeadlineBody.style = .itemHeader centerHeadlineBody.style = .itemHeader rightHeadlineBody.style = .itemHeader diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDividerModel.swift index 0e627c2a..fa7ad9f7 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDividerModel.swift @@ -35,8 +35,8 @@ public class ListThreeColumnSpeedTestDividerModel: ListItemModel, MoleculeModelP //----------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDividerModel.swift index 0cb938ad..407764f2 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDividerModel.swift @@ -33,8 +33,8 @@ public class ListTwoColumnSubsectionDividerModel: ListItemModel, MoleculeModelPr //------------------------------------------------------ override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //------------------------------------------------------ diff --git a/MVMCoreUI/Atomic/Molecules/Items/DropDownListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/DropDownListItemModel.swift index deb2374b..693874e6 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/DropDownListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/DropDownListItemModel.swift @@ -24,10 +24,10 @@ import Foundation /// Defaults to set public override func setDefaults() { + style = .sectionFooter super.setDefaults() hideArrow = true line = LineModel(type: .none) - style = "sectionFooter" } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift index 81b896f0..fcee1166 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift @@ -11,6 +11,7 @@ import Foundation @objcMembers open class ListItemModel: ContainerModel, ListItemModelProtocol { + //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- @@ -19,7 +20,7 @@ import Foundation public var action: ActionModelProtocol? public var hideArrow: Bool? public var line: LineModel? - public var style: String? + public var style: ListItemStyle? = .standard //-------------------------------------------------- // MARK: - Keys @@ -39,17 +40,39 @@ import Foundation /// Defaults to set open override func setDefaults() { - if useHorizontalMargins == nil { - useHorizontalMargins = true + setByStyle() + } + + /// Convenience function to set common values. + open func set(useHorizontalMargins: Bool? = true, useVerticalMargins: Bool? = true, topPadding: CGFloat? = nil, bottomPadding: CGFloat? = nil) { + if self.useHorizontalMargins == nil { + self.useHorizontalMargins = useHorizontalMargins } - if useVerticalMargins == nil { - useVerticalMargins = true + if self.useVerticalMargins == nil { + self.useVerticalMargins = useVerticalMargins } - if topPadding == nil { - topPadding = 24 + if self.topPadding == nil { + self.topPadding = topPadding } - if bottomPadding == nil { - bottomPadding = 24 + if self.bottomPadding == nil { + self.bottomPadding = bottomPadding + } + } + + /// Convenience function to set common values based on style. + open func setByStyle() { + guard let style = style else { return } + switch style { + case .standard: + set(topPadding: Padding.Component.VerticalMarginSpacing, bottomPadding: Padding.Component.VerticalMarginSpacing) + case .shortDivider: + set(topPadding: Padding.Component.LargeVerticalMarginSpacing, bottomPadding: Padding.Four) + case .tallDivider: + set(topPadding: Padding.Twelve, bottomPadding: Padding.Four) + case .sectionFooter: + set(topPadding: Padding.Component.VerticalMarginSpacing, bottomPadding: 0) + case ListItemStyle.none: + set(topPadding: 0, bottomPadding: 0) } } @@ -57,6 +80,12 @@ import Foundation // MARK: - Initializer //-------------------------------------------------- + public init(style: ListItemStyle? = .standard, action: ActionModelProtocol?) { + self.style = style + self.action = action + super.init() + } + public override init(horizontalAlignment: UIStackView.Alignment? = nil, verticalAlignment: UIStackView.Alignment? = nil, useHorizontalMargins: Bool? = nil, leftPadding: CGFloat? = nil, rightPadding: CGFloat? = nil, useVerticalMargins: Bool? = nil, topPadding: CGFloat? = nil, bottomPadding: CGFloat? = nil) { super.init(horizontalAlignment: horizontalAlignment, verticalAlignment: verticalAlignment, useHorizontalMargins: useHorizontalMargins, leftPadding: leftPadding, rightPadding: rightPadding, useVerticalMargins: useVerticalMargins, topPadding: topPadding, bottomPadding: bottomPadding) } @@ -75,7 +104,9 @@ import Foundation action = try typeContainer.decodeModelIfPresent(codingKey: .action) hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) - style = try typeContainer.decodeIfPresent(String.self, forKey: .style) + if let style = try typeContainer.decodeIfPresent(ListItemStyle.self, forKey: .style) { + self.style = style + } try super.init(from: decoder) } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift index 5d0fee08..b13ff039 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift @@ -8,12 +8,19 @@ import Foundation +public enum ListItemStyle: String, Codable { + case standard + case shortDivider + case tallDivider + case sectionFooter + case none +} public protocol ListItemModelProtocol: ContainerModelProtocol { var line: LineModel? { get set } var action: ActionModelProtocol? { get set } var hideArrow: Bool? { get set } - var style: String? { get set } + var style: ListItemStyle? { get set } } // Not a strict requirement. @@ -24,7 +31,7 @@ public extension ListItemModelProtocol { set { } } - var style: String? { + var style: ListItemStyle? { get { return nil } set { } } diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index 300150e8..bb5871d0 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -31,60 +31,33 @@ import UIKit private var initialSetupPerformed = false // MARK: - Styling - open func style(with styleString: String?) { - guard let styleString = styleString else { - return - } - switch styleString { - case "standard": - styleStandard() - case "shortDivider": - styleShortDivider() - case "tallDivider": - styleTallDivider() - case "sectionFooter": - styleFooter() - case "none": - styleNone() + open func styleLine(with style: ListItemStyle?) { + switch style { + case .standard?: + topSeparatorView?.setStyle(.none) + bottomSeparatorView?.setStyle(.standard) + case .shortDivider?: + topSeparatorView?.setStyle(.none) + bottomSeparatorView?.setStyle(.thin) + case .tallDivider?: + topSeparatorView?.setStyle(.none) + bottomSeparatorView?.setStyle(.thin) + case .sectionFooter?: + topSeparatorView?.setStyle(.none) + bottomSeparatorView?.setStyle(.none) + case ListItemStyle.none?: + topSeparatorView?.setStyle(.none) + bottomSeparatorView?.setStyle(.none) default: break } } + /// Default state. open func styleStandard() { - listItemModel?.topPadding = 24 - listItemModel?.bottomPadding = 24 - topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.standard) + MFStyler.setMarginsFor(self, size: MVMCoreUIUtility.getWidth(), defaultHorizontal: true, top: Padding.Component.VerticalMarginSpacing, bottom: Padding.Component.VerticalMarginSpacing) + styleLine(with: .standard) } - - open func styleTallDivider() { - listItemModel?.topPadding = 48 - listItemModel?.bottomPadding = 16 - topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.thin) - } - - open func styleShortDivider() { - listItemModel?.topPadding = 32 - listItemModel?.bottomPadding = 16 - topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.thin) - } - - open func styleFooter() { - listItemModel?.topPadding = 24 - listItemModel?.bottomPadding = 0 - topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.none) - } - - open func styleNone() { - listItemModel?.topPadding = 0 - listItemModel?.bottomPadding = 0 - topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.none) - } - + /// Adds the molecule to the view. open func addMolecule(_ molecule: MoleculeViewProtocol) { contentView.addSubview(molecule) @@ -156,7 +129,7 @@ import UIKit guard let model = model as? ListItemModelProtocol else { return } self.listItemModel = model - style(with: model.style) + styleLine(with: model.style) // Add the caret if there is an action and it's not declared hidden. if !customAccessoryView { From 63c793fe25331b9a865e98fa537f7405d2aa2dfc Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 6 Jul 2020 15:33:25 -0400 Subject: [PATCH 41/42] accessibility fix --- .../TextFields/DigitEntryField.swift | 5 +-- .../Atomic/Atoms/Selectors/RadioBox.swift | 39 +++++++++++++++++-- .../RadioBoxCollectionViewCell.swift | 8 ++++ .../Atomic/Atoms/Selectors/RadioBoxes.swift | 10 +++++ .../Atomic/Atoms/Selectors/RadioSwatch.swift | 27 ++++++++++++- .../RadioSwatchCollectionViewCell.swift | 20 ++++++++++ .../Atoms/Selectors/RadioSwatches.swift | 10 +++++ .../CarouselIndicator/BarsIndicatorView.swift | 5 +-- .../CarouselIndicator/CarouselIndicator.swift | 5 +-- .../Strings/en.lproj/Localizable.strings | 2 +- .../Strings/es-MX.lproj/Localizable.strings | 1 + MVMCoreUI/Utility/MVMCoreUIUtility.h | 3 ++ MVMCoreUI/Utility/MVMCoreUIUtility.m | 6 +++ 13 files changed, 124 insertions(+), 17 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift index 18f61b2d..b1f202a8 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift @@ -25,12 +25,9 @@ import UIKit if numberOfDigits > 0 { var digitBoxes = [DigitBox]() - let ordinalFormatter = NumberFormatter() - ordinalFormatter.numberStyle = .ordinal - for i in 0.. Date: Mon, 6 Jul 2020 15:56:12 -0400 Subject: [PATCH 42/42] revised name --- MVMCoreUI/Categories/UIColor+Extension.swift | 78 ++++++++++---------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/MVMCoreUI/Categories/UIColor+Extension.swift b/MVMCoreUI/Categories/UIColor+Extension.swift index e04a7d46..580a6ed6 100644 --- a/MVMCoreUI/Categories/UIColor+Extension.swift +++ b/MVMCoreUI/Categories/UIColor+Extension.swift @@ -71,149 +71,153 @@ extension UIColor { //-------------------------------------------------- /// HEX: #D52B1E - public static let mvmRed = UIColor(named: "red")! + public static let mvmRed = UIColor.assetColor(named: "red") //-------------------------------------------------- // MARK: - Pink //-------------------------------------------------- /// HEX: #D90368 - public static let mvmPink = UIColor(named: "pink")! + public static let mvmPink = UIColor.assetColor(named: "pink") /// HEX: #F2ABCD - public static let mvmPink33 = UIColor(named: "pink33")! + public static let mvmPink33 = UIColor.assetColor(named: "pink33") /// HEX: #E6589B - public static let mvmPink66 = UIColor(named: "pink66")! + public static let mvmPink66 = UIColor.assetColor(named: "pink66") /// HEX: #B31C63 - public static let mvmPinkShade1 = UIColor(named: "pinkShade1")! + public static let mvmPinkShade1 = UIColor.assetColor(named: "pinkShade1") /// HEX: #830842 - public static let mvmPinkShade2 = UIColor(named: "pinkShade2")! + public static let mvmPinkShade2 = UIColor.assetColor(named: "pinkShade2") //-------------------------------------------------- // MARK: - Purple //-------------------------------------------------- /// HEX: #8C00AC - public static let mvmPurple = UIColor(named: "purple")! + public static let mvmPurple = UIColor.assetColor(named: "purple") /// HEX: #D9ABE4 - public static let mvmPurple33 = UIColor(named: "purple33")! + public static let mvmPurple33 = UIColor.assetColor(named: "purple33") /// HEX: #B356C8 - public static let mvmPurple66 = UIColor(named: "purple66")! + public static let mvmPurple66 = UIColor.assetColor(named: "purple66") /// HEX: #6C177F - public static let mvmPurpleShade1 = UIColor(named: "purpleShade1")! + public static let mvmPurpleShade1 = UIColor.assetColor(named: "purpleShade1") /// HEX: #4A0E58 - public static let mvmPurpleShade2 = UIColor(named: "purpleShade2")! + public static let mvmPurpleShade2 = UIColor.assetColor(named: "purpleShade2") //-------------------------------------------------- // MARK: - Orange //-------------------------------------------------- /// HEX: #ED7000 - public static let mvmOrange = UIColor(named: "orange")! + public static let mvmOrange = UIColor.assetColor(named: "orange") /// HEX: #CC4D0F - public static let mvmOrangeAA = UIColor(named: "orangeAA")! + public static let mvmOrangeAA = UIColor.assetColor(named: "orangeAA") /// HEX: #F9D0AB - public static let mvmOrange33 = UIColor(named: "orange33")! + public static let mvmOrange33 = UIColor.assetColor(named: "orange33") /// HEX: #F3A157 - public static let mvmOrange66 = UIColor(named: "orange66")! + public static let mvmOrange66 = UIColor.assetColor(named: "orange66") /// HEX: #CB5F00 - public static let mvmOrangeShade1 = UIColor(named: "orangeShade1")! + public static let mvmOrangeShade1 = UIColor.assetColor(named: "orangeShade1") /// HEX: #984700 - public static let mvmOrangeShade2 = UIColor(named: "orangeShade2")! + public static let mvmOrangeShade2 = UIColor.assetColor(named: "orangeShade2") //-------------------------------------------------- // MARK: - Green //-------------------------------------------------- /// HEX: #008330 - public static let mvmGreen = UIColor(named: "green")! + public static let mvmGreen = UIColor.assetColor(named: "green") /// HEX: #ABE4BF - public static let mvmGreen33 = UIColor(named: "green33")! + public static let mvmGreen33 = UIColor.assetColor(named: "green33") /// HEX: #57C880 - public static let mvmGreen66 = UIColor(named: "green66")! + public static let mvmGreen66 = UIColor.assetColor(named: "green66") /// HEX: #0F5B25 - public static let mvmGreenShade2 = UIColor(named: "greenShade2")! + public static let mvmGreenShade2 = UIColor.assetColor(named: "greenShade2") /// HEX: #00AC3E - public static let mvmGreenInverted = UIColor(named: "greenInverted")! + public static let mvmGreenInverted = UIColor.assetColor(named: "greenInverted") //-------------------------------------------------- // MARK: - Blue //-------------------------------------------------- /// HEX: #0077B4 - public static let mvmBlue = UIColor(named: "blue")! + public static let mvmBlue = UIColor.assetColor(named: "blue") /// HEX: #ABD8EF - public static let mvmBlue33 = UIColor(named: "blue33")! + public static let mvmBlue33 = UIColor.assetColor(named: "blue33") /// HEX: #57B1DF - public static let mvmBlue66 = UIColor(named: "blue66")! + public static let mvmBlue66 = UIColor.assetColor(named: "blue66") /// HEX: #136598 - public static let mvmBlueShade1 = UIColor(named: "blueShade1")! + public static let mvmBlueShade1 = UIColor.assetColor(named: "blueShade1") /// HEX: #0B4467 - public static let mvmBlueShade2 = UIColor(named: "blueShade2")! + public static let mvmBlueShade2 = UIColor.assetColor(named: "blueShade2") /// HEX: #0088CE - public static let mvmBlueInverted = UIColor(named: "blueInverted")! + public static let mvmBlueInverted = UIColor.assetColor(named: "blueInverted") //-------------------------------------------------- // MARK: - Yellow //-------------------------------------------------- /// HEX: #FFBC3D - public static let mvmYellow = UIColor(named: "yellow")! + public static let mvmYellow = UIColor.assetColor(named: "yellow") //-------------------------------------------------- // MARK: - Gray //-------------------------------------------------- /// HEX: #F6F6F6 - public static let mvmCoolGray1 = UIColor(named: "coolGray1")! + public static let mvmCoolGray1 = UIColor.assetColor(named: "coolGray1") /// HEX: #D8DADA - public static let mvmCoolGray3 = UIColor(named: "coolGray3")! + public static let mvmCoolGray3 = UIColor.assetColor(named: "coolGray3") /// HEX: #747676 - public static let mvmCoolGray6 = UIColor(named: "coolGray6")! + public static let mvmCoolGray6 = UIColor.assetColor(named: "coolGray6") /// HEX: #333333 - public static let mvmCoolGray10 = UIColor(named: "coolGray10")! + public static let mvmCoolGray10 = UIColor.assetColor(named: "coolGray10") //-------------------------------------------------- // MARK: - VZ UP Brand //-------------------------------------------------- /// HEX: #F9D542 - public static let vzupGold1 = UIColor(named: "upGold1")! + public static let vzupGold1 = UIColor.assetColor(named: "upGold1") /// HEX: #F4CA53 - public static let vzupGold2 = UIColor(named: "upGold2")! + public static let vzupGold2 = UIColor.assetColor(named: "upGold2") /// HEX: #CC9B2D - public static let vzupGold3 = UIColor(named: "upGold3")! + public static let vzupGold3 = UIColor.assetColor(named: "upGold3") //-------------------------------------------------- // MARK: - Functions //-------------------------------------------------- + public static func assetColor(named name: String) -> UIColor { + return UIColor(named: name, in: MVMCoreUIUtility.bundleForMVMCoreUI(), compatibleWith: nil)! + } + /// Convenience to get a grayscale UIColor where the same value is used for red, green, and blue. public class func grayscale(rgb: Int, alpha: CGFloat = 1.0) -> UIColor { @@ -299,7 +303,7 @@ extension UIColor { } else if numberOfComponents == 2 { // Monochromatic color space let value = Int(CGFloat(components[0]) * 255) - + // If alpha of color is less than 1.0 then alpha hex is relevant. if components[1] < 1.0 { let alpha = Int(CGFloat(components[1]) * 255)