From b92f3abbafeb82533b650bd3db2716fe9b6cd0d2 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 30 Sep 2019 16:52:20 -0400 Subject: [PATCH] support dark theme logos --- src/App/Pages/Accounts/HomePage.xaml.cs | 4 +--- src/App/Utilities/ThemeManager.cs | 8 ++++++++ src/iOS/AppDelegate.cs | 4 +--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/App/Pages/Accounts/HomePage.xaml.cs b/src/App/Pages/Accounts/HomePage.xaml.cs index b76ca6a71..60ab8bbad 100644 --- a/src/App/Pages/Accounts/HomePage.xaml.cs +++ b/src/App/Pages/Accounts/HomePage.xaml.cs @@ -16,9 +16,7 @@ namespace Bit.App.Pages _messagingService = ServiceContainer.Resolve("messagingService"); _messagingService.Send("showStatusBar", false); InitializeComponent(); - var theme = ThemeManager.GetTheme(Device.RuntimePlatform == Device.Android); - var darkbasedTheme = theme == "dark" || theme == "black" || theme == "nord"; - _logo.Source = darkbasedTheme ? "logo_white.png" : "logo.png"; + _logo.Source = !ThemeManager.UsingLightTheme ? "logo_white.png" : "logo.png"; } public async Task DismissRegisterPageAndLogInAsync(string email) diff --git a/src/App/Utilities/ThemeManager.cs b/src/App/Utilities/ThemeManager.cs index 963a02432..0697e3b06 100644 --- a/src/App/Utilities/ThemeManager.cs +++ b/src/App/Utilities/ThemeManager.cs @@ -9,6 +9,8 @@ namespace Bit.App.Utilities { public static class ThemeManager { + public static bool UsingLightTheme = true; + public static void SetThemeStyle(string name) { // Reset styles @@ -22,18 +24,22 @@ namespace Bit.App.Utilities if(name == "dark") { Application.Current.Resources.MergedDictionaries.Add(new Dark()); + UsingLightTheme = false; } else if(name == "black") { Application.Current.Resources.MergedDictionaries.Add(new Black()); + UsingLightTheme = false; } else if(name == "nord") { Application.Current.Resources.MergedDictionaries.Add(new Nord()); + UsingLightTheme = false; } else if(name == "light") { Application.Current.Resources.MergedDictionaries.Add(new Nord()); + UsingLightTheme = true; } else { @@ -41,10 +47,12 @@ namespace Bit.App.Utilities if(deviceActionService?.UsingDarkTheme() ?? false) { Application.Current.Resources.MergedDictionaries.Add(new Dark()); + UsingLightTheme = false; } else { Application.Current.Resources.MergedDictionaries.Add(new Light()); + UsingLightTheme = true; } } diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index c41e1ceb8..78a48fe48 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -189,9 +189,7 @@ namespace Bit.iOS BackgroundColor = ((Color)Xamarin.Forms.Application.Current.Resources["SplashBackgroundColor"]) .ToUIColor() }; - var theme = ThemeManager.GetTheme(false); - var darkbasedTheme = theme == "dark" || theme == "black" || theme == "nord"; - var logo = new UIImage(darkbasedTheme ? "logo_white.png" : "logo.png"); + var logo = new UIImage(!ThemeManager.UsingLightTheme ? "logo_white.png" : "logo.png"); var imageView = new UIImageView(logo) { Center = new CoreGraphics.CGPoint(view.Center.X, view.Center.Y - 30)