From 1ac977065d1359e523d0c80a4cecf0d7ab9ac9af Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 19 Feb 2019 09:36:43 +0100 Subject: [PATCH 1/5] Update dark theme colors --- Riot/Managers/Theme/Themes/DarkTheme.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Riot/Managers/Theme/Themes/DarkTheme.swift b/Riot/Managers/Theme/Themes/DarkTheme.swift index 89d3cc92b..1f556f662 100644 --- a/Riot/Managers/Theme/Themes/DarkTheme.swift +++ b/Riot/Managers/Theme/Themes/DarkTheme.swift @@ -23,15 +23,15 @@ class DarkTheme: NSObject, Theme { var backgroundColor: UIColor = UIColor(rgb: 0x181B21) - var baseColor: UIColor = UIColor(rgb: 0x1B1F25) + var baseColor: UIColor = UIColor(rgb: 0x15171B) var baseTextPrimaryColor: UIColor = UIColor(rgb: 0xEDF3FF) var baseTextSecondaryColor: UIColor = UIColor(rgb: 0xEDF3FF) var searchBackgroundColor: UIColor = UIColor(rgb: 0x181B21) var searchPlaceholderColor: UIColor = UIColor(rgb: 0x61708B) - var headerBackgroundColor: UIColor = UIColor(rgb: 0x22262E) - var headerBorderColor: UIColor = UIColor(rgb: 0x181B21) + var headerBackgroundColor: UIColor = UIColor(rgb: 0x15171B) + var headerBorderColor: UIColor = UIColor(rgb: 0x22262E) var headerTextPrimaryColor: UIColor = UIColor(rgb: 0xA1B2D1) var headerTextSecondaryColor: UIColor = UIColor(rgb: 0xC8C8CD) From 6b3fe31ef5076c3dc9c1aadfaf037cf6ead10222 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 19 Feb 2019 09:39:01 +0100 Subject: [PATCH 2/5] Add style method for UITabBar on Theme protocol. Update themes and make UITabBar non translucent. --- Riot/Managers/Theme/Theme.swift | 5 +++++ Riot/Managers/Theme/Themes/DarkTheme.swift | 6 ++++++ Riot/Managers/Theme/Themes/DefaultTheme.swift | 6 ++++++ Riot/Modules/TabBar/MasterTabBarController.m | 3 +-- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Riot/Managers/Theme/Theme.swift b/Riot/Managers/Theme/Theme.swift index 839f4641c..50970fed0 100644 --- a/Riot/Managers/Theme/Theme.swift +++ b/Riot/Managers/Theme/Theme.swift @@ -80,6 +80,11 @@ import UIKit // MARK: - Customisation methods + + /// Apply the theme on a button. + /// + /// - Parameter tabBar: The tabBar to customise. + func applyStyle(onTabBar tabBar: UITabBar) /// Apply the theme on a navigation bar /// diff --git a/Riot/Managers/Theme/Themes/DarkTheme.swift b/Riot/Managers/Theme/Themes/DarkTheme.swift index 1f556f662..501f100d0 100644 --- a/Riot/Managers/Theme/Themes/DarkTheme.swift +++ b/Riot/Managers/Theme/Themes/DarkTheme.swift @@ -60,6 +60,12 @@ class DarkTheme: NSObject, Theme { var selectedBackgroundColor: UIColor? = UIColor.black var overlayBackgroundColor: UIColor = UIColor(white: 0.7, alpha: 0.5) var matrixSearchBackgroundImageTintColor: UIColor = UIColor(rgb: 0x7E7E7E) + + func applyStyle(onTabBar tabBar: UITabBar) { + tabBar.tintColor = self.tintColor; + tabBar.barTintColor = self.headerBackgroundColor; + tabBar.isTranslucent = false; + } func applyStyle(onNavigationBar navigationBar: UINavigationBar) { navigationBar.tintColor = self.baseTextPrimaryColor; diff --git a/Riot/Managers/Theme/Themes/DefaultTheme.swift b/Riot/Managers/Theme/Themes/DefaultTheme.swift index 3a14b3f95..d400fa6c8 100644 --- a/Riot/Managers/Theme/Themes/DefaultTheme.swift +++ b/Riot/Managers/Theme/Themes/DefaultTheme.swift @@ -60,6 +60,12 @@ class DefaultTheme: NSObject, Theme { var selectedBackgroundColor: UIColor? = nil // Use the default selection color var overlayBackgroundColor: UIColor = UIColor(white: 0.7, alpha: 0.5) var matrixSearchBackgroundImageTintColor: UIColor = UIColor(rgb: 0xE7E7E7) + + func applyStyle(onTabBar tabBar: UITabBar) { + tabBar.tintColor = self.tintColor; + tabBar.barTintColor = self.headerBackgroundColor; + tabBar.isTranslucent = false; + } func applyStyle(onNavigationBar navigationBar: UINavigationBar) { navigationBar.tintColor = self.baseTextPrimaryColor; diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index d926c8781..b7290b760 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -116,8 +116,7 @@ { [ThemeService.shared.theme applyStyleOnNavigationBar:self.navigationController.navigationBar]; - self.tabBar.tintColor = ThemeService.shared.theme.tintColor; - self.tabBar.barTintColor = ThemeService.shared.theme.headerBackgroundColor; + [ThemeService.shared.theme applyStyleOnTabBar:self.tabBar]; self.view.backgroundColor = ThemeService.shared.theme.backgroundColor; From e5005cc2229a0ac9b31e85cb7e525c6eb7afeb7e Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 19 Feb 2019 09:39:40 +0100 Subject: [PATCH 3/5] Handle UISearchBar cancel button color in ThemeService --- Riot/Managers/Theme/ThemeService.m | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Riot/Managers/Theme/ThemeService.m b/Riot/Managers/Theme/ThemeService.m index 2c54ec5ad..0cbe1bd97 100644 --- a/Riot/Managers/Theme/ThemeService.m +++ b/Riot/Managers/Theme/ThemeService.m @@ -51,8 +51,8 @@ NSString *const kThemeServiceDidChangeThemeNotification = @"kThemeServiceDidChan - (void)setTheme:(id _Nonnull)theme { _theme = theme; - - [UIScrollView appearance].indicatorStyle = self.theme.scrollBarStyle; + + [self updateAppearance]; [[NSNotificationCenter defaultCenter] postNotificationName:kThemeServiceDidChangeThemeNotification object:nil]; } @@ -112,5 +112,15 @@ NSString *const kThemeServiceDidChangeThemeNotification = @"kThemeServiceDidChan } } +- (void)updateAppearance +{ + [UIScrollView appearance].indicatorStyle = self.theme.scrollBarStyle; + + // Define the navigation bar text color + [[UINavigationBar appearance] setTintColor:self.theme.tintColor]; + + // Define the UISearchBar cancel button color + [[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setTitleTextAttributes:@{ NSForegroundColorAttributeName : self.theme.searchPlaceholderColor } forState: UIControlStateNormal]; +} @end From 8d4d7636cea2615837cedd160ae20b7c21e2ae4b Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 19 Feb 2019 09:40:38 +0100 Subject: [PATCH 4/5] Remove UISearchBar border color --- Riot/Managers/Theme/Themes/DarkTheme.swift | 4 +--- Riot/Managers/Theme/Themes/DefaultTheme.swift | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Riot/Managers/Theme/Themes/DarkTheme.swift b/Riot/Managers/Theme/Themes/DarkTheme.swift index 501f100d0..8e50e1b7b 100644 --- a/Riot/Managers/Theme/Themes/DarkTheme.swift +++ b/Riot/Managers/Theme/Themes/DarkTheme.swift @@ -81,9 +81,7 @@ class DarkTheme: NSObject, Theme { func applyStyle(onSearchBar searchBar: UISearchBar) { searchBar.barStyle = .black searchBar.tintColor = self.searchPlaceholderColor; - searchBar.barTintColor = self.headerBackgroundColor; - searchBar.layer.borderWidth = 1; - searchBar.layer.borderColor = self.headerBorderColor.cgColor; + searchBar.barTintColor = self.headerBackgroundColor; } func applyStyle(onTextField texField: UITextField) { diff --git a/Riot/Managers/Theme/Themes/DefaultTheme.swift b/Riot/Managers/Theme/Themes/DefaultTheme.swift index d400fa6c8..fb43f1fec 100644 --- a/Riot/Managers/Theme/Themes/DefaultTheme.swift +++ b/Riot/Managers/Theme/Themes/DefaultTheme.swift @@ -82,8 +82,6 @@ class DefaultTheme: NSObject, Theme { searchBar.barStyle = .default searchBar.tintColor = self.searchPlaceholderColor; searchBar.barTintColor = self.headerBackgroundColor; - searchBar.layer.borderWidth = 1; - searchBar.layer.borderColor = self.headerBorderColor.cgColor; } func applyStyle(onTextField texField: UITextField) { From a4efadbd02f848c65fd9daba69add7161b116e33 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Tue, 19 Feb 2019 09:51:35 +0100 Subject: [PATCH 5/5] Remove UINavigationBar appearance update from AppDelegate --- Riot/AppDelegate.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index df6253dc8..de048f57a 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -429,8 +429,6 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN [NSBundle mxk_setLanguage:language]; [NSBundle mxk_setFallbackLanguage:@"en"]; - // Define the navigation bar text color - [[UINavigationBar appearance] setTintColor:ThemeService.shared.theme.tintColor]; // Customize the localized string table [NSBundle mxk_customizeLocalizedStringTableName:@"Vector"];