From 4c381c97dc3c00ba8b0e954e5ab4d8170302a0ce Mon Sep 17 00:00:00 2001 From: jmpuerta Date: Mon, 1 Aug 2022 10:18:32 +0200 Subject: [PATCH 1/8] IOS-7584 Fix pominent colors --- .../Source/Colors/MovistarColorPalette.swift | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Mistica/Source/Colors/MovistarColorPalette.swift b/Mistica/Source/Colors/MovistarColorPalette.swift index 790dc6ea2..c485ce603 100644 --- a/Mistica/Source/Colors/MovistarColorPalette.swift +++ b/Mistica/Source/Colors/MovistarColorPalette.swift @@ -17,10 +17,10 @@ struct MovistarColors: Colors { let backgroundOverlay = MovistarColorPalette.grey6.withAlphaComponent(0.6) | MovistarColorPalette.darkModeGrey.withAlphaComponent(0.8) let backgroundSkeleton = MovistarColorPalette.grey1 | MovistarColorPalette.grey6 let backgroundSkeletonInverse = MovistarColorPalette.movistarBlue55 | MovistarColorPalette.grey6 - let navigationBarBackground = MovistarColorPalette.movistarBlue | MovistarColorPalette.darkModeBlack + let navigationBarBackground = MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack - let backgroundAlternative = MovistarColorPalette.grey1 | MovistarColorPalette.darkModeGrey // (seguramente mejor darkModeBlack) - let backgroundFeedbackBottom = MovistarColorPalette.movistarBlue | MovistarColorPalette.darkModeBlack + let backgroundAlternative = MovistarColorPalette.grey1 | MovistarColorPalette.darkModeGrey + let backgroundFeedbackBottom = MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack let skeletonWave = MovistarColorPalette.grey2 | MovistarColorPalette.grey5 // BORDERS @@ -65,15 +65,15 @@ struct MovistarColors: Colors { // CONTROLS let control = MovistarColorPalette.grey3 | MovistarColorPalette.grey6 - let controlActivated = MovistarColorPalette.movistarBlue + let controlActivated = MovistarColorPalette.movistarBlueWithProminentVariant let controlError = MovistarColorPalette.pepper let loadingBar = MovistarColorPalette.movistarBlue30 | MovistarColorPalette.movistarBlue let loadingBarBackground = MovistarColorPalette.movistarBlue55 | MovistarColorPalette.darkModeGrey // DIVIDERS let divider = MovistarColorPalette.grey2 | MovistarColorPalette.white.withAlphaComponent(0.05) - let dividerInverse = MovistarColorPalette.movistarBlue55 | MovistarColorPalette.white.withAlphaComponent(0.05) - var navigationBarDivider = MovistarColorPalette.movistarBlue | MovistarColorPalette.darkModeBlack + let dividerInverse = movistarBlue55WithProminentVariant | MovistarColorPalette.white.withAlphaComponent(0.05) + var navigationBarDivider = MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack // FEEDBACKS let badge = MovistarColorPalette.pepper55 @@ -81,8 +81,8 @@ struct MovistarColors: Colors { let feedbackInfoBackground = MovistarColorPalette.grey6 // GLOBAL - let brand = MovistarColorPalette.movistarBlue - let brandHigh = MovistarColorPalette.movistarBlue55 | MovistarColorPalette.white.withAlphaComponent(0.05) + let brand = MovistarColorPalette.movistarBlueWithProminentVariant + let brandHigh = MovistarColorPalette.movistarBlue55WithProminentVariant | MovistarColorPalette.white.withAlphaComponent(0.05) let inverse = MovistarColorPalette.white | MovistarColorPalette.grey2 let neutralHigh = MovistarColorPalette.grey6 | MovistarColorPalette.grey2 let neutralMedium = MovistarColorPalette.grey5 @@ -106,7 +106,7 @@ struct MovistarColors: Colors { let textNavigationSearchBarHint = MovistarColorPalette.movistarBlue20 | MovistarColorPalette.grey4 // iOS only let textNavigationSearchBarText = MovistarColorPalette.white | MovistarColorPalette.grey2 // iOS only let textAppBar = MovistarColorPalette.grey4 | MovistarColorPalette.grey5 - let textAppBarSelected = MovistarColorPalette.movistarBlue | MovistarColorPalette.grey2 + let textAppBarSelected = MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.grey2 // GRADIENTS var backgroundBrandGradient: [UIColor] { @@ -181,4 +181,8 @@ public enum MovistarColorPalette { public static let darkModeBlack = UIColor(hex: "#191919")! public static let darkModeGrey = UIColor(hex: "#242424")! + + // Prominent and default + static let movistarBlueWithProminentVariant = UIColor(MovistarColorPalette.movistarBlue, variants: [.prominent: MovistarColorPalette.movistarProminentBlue]) + static let movistarBlue55WithProminentVariant = UIColor(MovistarColorPalette.movistarBlue55, variants: [.prominent: MovistarColorPalette.movistarProminentBlueDark]) } From 7b225b98601ddbaa3fa013952ca08d126eb52147 Mon Sep 17 00:00:00 2001 From: jmpuerta Date: Mon, 1 Aug 2022 10:42:56 +0200 Subject: [PATCH 2/8] IOS-7584 Fiix palette --- Mistica/Source/Colors/MovistarColorPalette.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mistica/Source/Colors/MovistarColorPalette.swift b/Mistica/Source/Colors/MovistarColorPalette.swift index c485ce603..64b80ec7c 100644 --- a/Mistica/Source/Colors/MovistarColorPalette.swift +++ b/Mistica/Source/Colors/MovistarColorPalette.swift @@ -72,7 +72,7 @@ struct MovistarColors: Colors { // DIVIDERS let divider = MovistarColorPalette.grey2 | MovistarColorPalette.white.withAlphaComponent(0.05) - let dividerInverse = movistarBlue55WithProminentVariant | MovistarColorPalette.white.withAlphaComponent(0.05) + let dividerInverse = MovistarColorPalette.movistarBlue55WithProminentVariant | MovistarColorPalette.white.withAlphaComponent(0.05) var navigationBarDivider = MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack // FEEDBACKS From 343a67025df263ea2bb86f595c4cb6f60dddf5b5 Mon Sep 17 00:00:00 2001 From: jmpuerta Date: Mon, 1 Aug 2022 11:37:49 +0200 Subject: [PATCH 3/8] IOS-7584 Swap lines --- Mistica/Source/MisticaConfig.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mistica/Source/MisticaConfig.swift b/Mistica/Source/MisticaConfig.swift index c0fa75841..5a494ac4c 100644 --- a/Mistica/Source/MisticaConfig.swift +++ b/Mistica/Source/MisticaConfig.swift @@ -22,8 +22,8 @@ public enum MisticaConfig { public static var themeVariant: ThemeVariant = .standard { didSet { - NotificationCenter.default.post(name: .themeVariantDidChange, object: nil) MisticaAppearance.setUp(controls: currentStyledControls) + NotificationCenter.default.post(name: .themeVariantDidChange, object: nil) } } From 24ea4df102de1722dbcda49d0455cbf39dddd231 Mon Sep 17 00:00:00 2001 From: jmpuerta Date: Mon, 1 Aug 2022 12:07:44 +0200 Subject: [PATCH 4/8] IOS-7584 Update theme variant notification --- Mistica/Source/Components/Filter/Filter.swift | 2 +- Mistica/Source/Components/Tabs/TabsView.swift | 2 +- Mistica/Source/MisticaConfig.swift | 2 +- Mistica/Source/Styles/ThemeVariant.swift | 6 +++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Mistica/Source/Components/Filter/Filter.swift b/Mistica/Source/Components/Filter/Filter.swift index 06328a1f0..cb2bd4448 100644 --- a/Mistica/Source/Components/Filter/Filter.swift +++ b/Mistica/Source/Components/Filter/Filter.swift @@ -103,7 +103,7 @@ public class Filter: UIView { setUpCollectionView() // Listen to theme variant changes - NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeVariantDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeVariantDidChangeName, object: nil) } override public func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { diff --git a/Mistica/Source/Components/Tabs/TabsView.swift b/Mistica/Source/Components/Tabs/TabsView.swift index f3c53d7c4..da533354f 100644 --- a/Mistica/Source/Components/Tabs/TabsView.swift +++ b/Mistica/Source/Components/Tabs/TabsView.swift @@ -117,7 +117,7 @@ private extension TabsView { updateEstimatedItemSize() // Listen to theme variant changes - NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeVariantDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeVariantDidChangeName, object: nil) } func setUpView() { diff --git a/Mistica/Source/MisticaConfig.swift b/Mistica/Source/MisticaConfig.swift index 5a494ac4c..bf691b382 100644 --- a/Mistica/Source/MisticaConfig.swift +++ b/Mistica/Source/MisticaConfig.swift @@ -23,7 +23,7 @@ public enum MisticaConfig { public static var themeVariant: ThemeVariant = .standard { didSet { MisticaAppearance.setUp(controls: currentStyledControls) - NotificationCenter.default.post(name: .themeVariantDidChange, object: nil) + NotificationCenter.default.post(.themeVariantDidChange) } } diff --git a/Mistica/Source/Styles/ThemeVariant.swift b/Mistica/Source/Styles/ThemeVariant.swift index b56b1214e..59db86bb7 100644 --- a/Mistica/Source/Styles/ThemeVariant.swift +++ b/Mistica/Source/Styles/ThemeVariant.swift @@ -15,5 +15,9 @@ public enum ThemeVariant: String, CaseIterable { } public extension Notification.Name { - static let themeVariantDidChange = Notification.Name("mistica.themeVariantDidChange") + static let themeVariantDidChangeName = Notification.Name("mistica.themeVariantDidChange") +} + +public extension Notification { + static let themeVariantDidChange = Notification(name: .themeVariantDidChangeName, object: nil, userInfo: nil) } From 265229d7d5088bc40dd93c8b54cf574ee793d39a Mon Sep 17 00:00:00 2001 From: jmpuerta Date: Mon, 1 Aug 2022 12:28:22 +0200 Subject: [PATCH 5/8] IOS-7584 Use computed properties --- .../Source/Colors/MovistarColorPalette.swift | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/Mistica/Source/Colors/MovistarColorPalette.swift b/Mistica/Source/Colors/MovistarColorPalette.swift index 64b80ec7c..a61166ed5 100644 --- a/Mistica/Source/Colors/MovistarColorPalette.swift +++ b/Mistica/Source/Colors/MovistarColorPalette.swift @@ -17,10 +17,10 @@ struct MovistarColors: Colors { let backgroundOverlay = MovistarColorPalette.grey6.withAlphaComponent(0.6) | MovistarColorPalette.darkModeGrey.withAlphaComponent(0.8) let backgroundSkeleton = MovistarColorPalette.grey1 | MovistarColorPalette.grey6 let backgroundSkeletonInverse = MovistarColorPalette.movistarBlue55 | MovistarColorPalette.grey6 - let navigationBarBackground = MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack + var navigationBarBackground: UIColor { MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack } let backgroundAlternative = MovistarColorPalette.grey1 | MovistarColorPalette.darkModeGrey - let backgroundFeedbackBottom = MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack + var backgroundFeedbackBottom: UIColor { MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack } let skeletonWave = MovistarColorPalette.grey2 | MovistarColorPalette.grey5 // BORDERS @@ -65,15 +65,15 @@ struct MovistarColors: Colors { // CONTROLS let control = MovistarColorPalette.grey3 | MovistarColorPalette.grey6 - let controlActivated = MovistarColorPalette.movistarBlueWithProminentVariant + var controlActivated: UIColor { MovistarColorPalette.movistarBlueWithProminentVariant } let controlError = MovistarColorPalette.pepper let loadingBar = MovistarColorPalette.movistarBlue30 | MovistarColorPalette.movistarBlue let loadingBarBackground = MovistarColorPalette.movistarBlue55 | MovistarColorPalette.darkModeGrey // DIVIDERS let divider = MovistarColorPalette.grey2 | MovistarColorPalette.white.withAlphaComponent(0.05) - let dividerInverse = MovistarColorPalette.movistarBlue55WithProminentVariant | MovistarColorPalette.white.withAlphaComponent(0.05) - var navigationBarDivider = MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack + var dividerInverse: UIColor { MovistarColorPalette.movistarBlue55WithProminentVariant | MovistarColorPalette.white.withAlphaComponent(0.05) } + var navigationBarDivider: UIColor { MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack } // FEEDBACKS let badge = MovistarColorPalette.pepper55 @@ -81,8 +81,8 @@ struct MovistarColors: Colors { let feedbackInfoBackground = MovistarColorPalette.grey6 // GLOBAL - let brand = MovistarColorPalette.movistarBlueWithProminentVariant - let brandHigh = MovistarColorPalette.movistarBlue55WithProminentVariant | MovistarColorPalette.white.withAlphaComponent(0.05) + var brand: UIColor { MovistarColorPalette.movistarBlueWithProminentVariant } + var brandHigh: UIColor { MovistarColorPalette.movistarBlue55WithProminentVariant | MovistarColorPalette.white.withAlphaComponent(0.05) } let inverse = MovistarColorPalette.white | MovistarColorPalette.grey2 let neutralHigh = MovistarColorPalette.grey6 | MovistarColorPalette.grey2 let neutralMedium = MovistarColorPalette.grey5 @@ -106,15 +106,15 @@ struct MovistarColors: Colors { let textNavigationSearchBarHint = MovistarColorPalette.movistarBlue20 | MovistarColorPalette.grey4 // iOS only let textNavigationSearchBarText = MovistarColorPalette.white | MovistarColorPalette.grey2 // iOS only let textAppBar = MovistarColorPalette.grey4 | MovistarColorPalette.grey5 - let textAppBarSelected = MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.grey2 + var textAppBarSelected: UIColor { MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.grey2 } // GRADIENTS var backgroundBrandGradient: [UIColor] { [ - UIColor(MovistarColorPalette.movistarBlue, variants: [.prominent: MovistarColorPalette.movistarProminentBlue]) | MovistarColorPalette.darkModeBlack, - UIColor(MovistarColorPalette.movistarBlue, variants: [.prominent: MovistarColorPalette.movistarProminentBlue]) | MovistarColorPalette.darkModeBlack, - UIColor(MovistarColorPalette.movistarBlue, variants: [.prominent: MovistarColorPalette.movistarProminentBlue]) | MovistarColorPalette.darkModeBlack, - UIColor(MovistarColorPalette.movistarBlue, variants: [.prominent: MovistarColorPalette.movistarProminentBlue]) | MovistarColorPalette.darkModeBlack + MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack, + MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack, + MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack, + MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack ] } @@ -183,6 +183,10 @@ public enum MovistarColorPalette { public static let darkModeGrey = UIColor(hex: "#242424")! // Prominent and default - static let movistarBlueWithProminentVariant = UIColor(MovistarColorPalette.movistarBlue, variants: [.prominent: MovistarColorPalette.movistarProminentBlue]) - static let movistarBlue55WithProminentVariant = UIColor(MovistarColorPalette.movistarBlue55, variants: [.prominent: MovistarColorPalette.movistarProminentBlueDark]) + static var movistarBlueWithProminentVariant: UIColor { + UIColor(MovistarColorPalette.movistarBlue, variants: [.prominent: MovistarColorPalette.movistarProminentBlue]) + } + static var movistarBlue55WithProminentVariant: UIColor { + UIColor(MovistarColorPalette.movistarBlue55, variants: [.prominent: MovistarColorPalette.movistarProminentBlueDark]) + } } From 766c75948cd9f1acff8a51affff1005c454af11a Mon Sep 17 00:00:00 2001 From: jmpuerta Date: Mon, 1 Aug 2022 12:29:02 +0200 Subject: [PATCH 6/8] IOS-7584 Rollback notification changes --- Mistica/Source/Components/Filter/Filter.swift | 2 +- Mistica/Source/Components/Tabs/TabsView.swift | 2 +- Mistica/Source/MisticaConfig.swift | 2 +- Mistica/Source/Styles/ThemeVariant.swift | 6 +----- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Mistica/Source/Components/Filter/Filter.swift b/Mistica/Source/Components/Filter/Filter.swift index cb2bd4448..06328a1f0 100644 --- a/Mistica/Source/Components/Filter/Filter.swift +++ b/Mistica/Source/Components/Filter/Filter.swift @@ -103,7 +103,7 @@ public class Filter: UIView { setUpCollectionView() // Listen to theme variant changes - NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeVariantDidChangeName, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeVariantDidChange, object: nil) } override public func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { diff --git a/Mistica/Source/Components/Tabs/TabsView.swift b/Mistica/Source/Components/Tabs/TabsView.swift index da533354f..f3c53d7c4 100644 --- a/Mistica/Source/Components/Tabs/TabsView.swift +++ b/Mistica/Source/Components/Tabs/TabsView.swift @@ -117,7 +117,7 @@ private extension TabsView { updateEstimatedItemSize() // Listen to theme variant changes - NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeVariantDidChangeName, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeVariantDidChange, object: nil) } func setUpView() { diff --git a/Mistica/Source/MisticaConfig.swift b/Mistica/Source/MisticaConfig.swift index bf691b382..5a494ac4c 100644 --- a/Mistica/Source/MisticaConfig.swift +++ b/Mistica/Source/MisticaConfig.swift @@ -23,7 +23,7 @@ public enum MisticaConfig { public static var themeVariant: ThemeVariant = .standard { didSet { MisticaAppearance.setUp(controls: currentStyledControls) - NotificationCenter.default.post(.themeVariantDidChange) + NotificationCenter.default.post(name: .themeVariantDidChange, object: nil) } } diff --git a/Mistica/Source/Styles/ThemeVariant.swift b/Mistica/Source/Styles/ThemeVariant.swift index 59db86bb7..b56b1214e 100644 --- a/Mistica/Source/Styles/ThemeVariant.swift +++ b/Mistica/Source/Styles/ThemeVariant.swift @@ -15,9 +15,5 @@ public enum ThemeVariant: String, CaseIterable { } public extension Notification.Name { - static let themeVariantDidChangeName = Notification.Name("mistica.themeVariantDidChange") -} - -public extension Notification { - static let themeVariantDidChange = Notification(name: .themeVariantDidChangeName, object: nil, userInfo: nil) + static let themeVariantDidChange = Notification.Name("mistica.themeVariantDidChange") } From f107a5ed0305b0280a7950cbad710812fb5b1ff9 Mon Sep 17 00:00:00 2001 From: jmpg93 Date: Mon, 1 Aug 2022 12:45:02 +0200 Subject: [PATCH 7/8] Run swiftformat --- Mistica/Source/Colors/MovistarColorPalette.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Mistica/Source/Colors/MovistarColorPalette.swift b/Mistica/Source/Colors/MovistarColorPalette.swift index a61166ed5..b98c34e85 100644 --- a/Mistica/Source/Colors/MovistarColorPalette.swift +++ b/Mistica/Source/Colors/MovistarColorPalette.swift @@ -181,11 +181,12 @@ public enum MovistarColorPalette { public static let darkModeBlack = UIColor(hex: "#191919")! public static let darkModeGrey = UIColor(hex: "#242424")! - + // Prominent and default static var movistarBlueWithProminentVariant: UIColor { UIColor(MovistarColorPalette.movistarBlue, variants: [.prominent: MovistarColorPalette.movistarProminentBlue]) } + static var movistarBlue55WithProminentVariant: UIColor { UIColor(MovistarColorPalette.movistarBlue55, variants: [.prominent: MovistarColorPalette.movistarProminentBlueDark]) } From dfb31c373ebf8907ec4f27f809eb120715718120 Mon Sep 17 00:00:00 2001 From: jmpuerta Date: Mon, 1 Aug 2022 12:49:46 +0200 Subject: [PATCH 8/8] IOS-7584 Use primonint for backgroundBrand --- Mistica/Source/Colors/MovistarColorPalette.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mistica/Source/Colors/MovistarColorPalette.swift b/Mistica/Source/Colors/MovistarColorPalette.swift index a61166ed5..e6ef337a3 100644 --- a/Mistica/Source/Colors/MovistarColorPalette.swift +++ b/Mistica/Source/Colors/MovistarColorPalette.swift @@ -13,7 +13,7 @@ struct MovistarColors: Colors { let appBarBackground = MovistarColorPalette.white | MovistarColorPalette.darkModeGrey let background = MovistarColorPalette.white | MovistarColorPalette.darkModeBlack let backgroundContainer = MovistarColorPalette.white | MovistarColorPalette.darkModeGrey - let backgroundBrand = MovistarColorPalette.movistarBlue | MovistarColorPalette.darkModeBlack + var backgroundBrand: UIColor { MovistarColorPalette.movistarBlueWithProminentVariant | MovistarColorPalette.darkModeBlack } let backgroundOverlay = MovistarColorPalette.grey6.withAlphaComponent(0.6) | MovistarColorPalette.darkModeGrey.withAlphaComponent(0.8) let backgroundSkeleton = MovistarColorPalette.grey1 | MovistarColorPalette.grey6 let backgroundSkeletonInverse = MovistarColorPalette.movistarBlue55 | MovistarColorPalette.grey6