support dark theme logos

This commit is contained in:
Kyle Spearrin 2019-09-30 16:52:20 -04:00
parent b6747a63ed
commit b92f3abbaf
3 changed files with 10 additions and 6 deletions

View file

@ -16,9 +16,7 @@ namespace Bit.App.Pages
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService"); _messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
_messagingService.Send("showStatusBar", false); _messagingService.Send("showStatusBar", false);
InitializeComponent(); InitializeComponent();
var theme = ThemeManager.GetTheme(Device.RuntimePlatform == Device.Android); _logo.Source = !ThemeManager.UsingLightTheme ? "logo_white.png" : "logo.png";
var darkbasedTheme = theme == "dark" || theme == "black" || theme == "nord";
_logo.Source = darkbasedTheme ? "logo_white.png" : "logo.png";
} }
public async Task DismissRegisterPageAndLogInAsync(string email) public async Task DismissRegisterPageAndLogInAsync(string email)

View file

@ -9,6 +9,8 @@ namespace Bit.App.Utilities
{ {
public static class ThemeManager public static class ThemeManager
{ {
public static bool UsingLightTheme = true;
public static void SetThemeStyle(string name) public static void SetThemeStyle(string name)
{ {
// Reset styles // Reset styles
@ -22,18 +24,22 @@ namespace Bit.App.Utilities
if(name == "dark") if(name == "dark")
{ {
Application.Current.Resources.MergedDictionaries.Add(new Dark()); Application.Current.Resources.MergedDictionaries.Add(new Dark());
UsingLightTheme = false;
} }
else if(name == "black") else if(name == "black")
{ {
Application.Current.Resources.MergedDictionaries.Add(new Black()); Application.Current.Resources.MergedDictionaries.Add(new Black());
UsingLightTheme = false;
} }
else if(name == "nord") else if(name == "nord")
{ {
Application.Current.Resources.MergedDictionaries.Add(new Nord()); Application.Current.Resources.MergedDictionaries.Add(new Nord());
UsingLightTheme = false;
} }
else if(name == "light") else if(name == "light")
{ {
Application.Current.Resources.MergedDictionaries.Add(new Nord()); Application.Current.Resources.MergedDictionaries.Add(new Nord());
UsingLightTheme = true;
} }
else else
{ {
@ -41,10 +47,12 @@ namespace Bit.App.Utilities
if(deviceActionService?.UsingDarkTheme() ?? false) if(deviceActionService?.UsingDarkTheme() ?? false)
{ {
Application.Current.Resources.MergedDictionaries.Add(new Dark()); Application.Current.Resources.MergedDictionaries.Add(new Dark());
UsingLightTheme = false;
} }
else else
{ {
Application.Current.Resources.MergedDictionaries.Add(new Light()); Application.Current.Resources.MergedDictionaries.Add(new Light());
UsingLightTheme = true;
} }
} }

View file

@ -189,9 +189,7 @@ namespace Bit.iOS
BackgroundColor = ((Color)Xamarin.Forms.Application.Current.Resources["SplashBackgroundColor"]) BackgroundColor = ((Color)Xamarin.Forms.Application.Current.Resources["SplashBackgroundColor"])
.ToUIColor() .ToUIColor()
}; };
var theme = ThemeManager.GetTheme(false); var logo = new UIImage(!ThemeManager.UsingLightTheme ? "logo_white.png" : "logo.png");
var darkbasedTheme = theme == "dark" || theme == "black" || theme == "nord";
var logo = new UIImage(darkbasedTheme ? "logo_white.png" : "logo.png");
var imageView = new UIImageView(logo) var imageView = new UIImageView(logo)
{ {
Center = new CoreGraphics.CGPoint(view.Center.X, view.Center.Y - 30) Center = new CoreGraphics.CGPoint(view.Center.X, view.Center.Y - 30)