diff --git a/src/Android/Services/DeviceActionService.cs b/src/Android/Services/DeviceActionService.cs index e08ef81e5..93061a336 100644 --- a/src/Android/Services/DeviceActionService.cs +++ b/src/Android/Services/DeviceActionService.cs @@ -612,6 +612,11 @@ namespace Bit.Droid.Services } } + public bool UsingDarkTheme() + { + return false; + } + private bool DeleteDir(Java.IO.File dir) { if(dir != null && dir.IsDirectory) diff --git a/src/App/Abstractions/IDeviceActionService.cs b/src/App/Abstractions/IDeviceActionService.cs index f9e120bcf..85c92e71a 100644 --- a/src/App/Abstractions/IDeviceActionService.cs +++ b/src/App/Abstractions/IDeviceActionService.cs @@ -35,5 +35,6 @@ namespace Bit.App.Abstractions string GetBuildNumber(); void OpenAccessibilitySettings(); void OpenAutofillSettings(); + bool UsingDarkTheme(); } } diff --git a/src/App/Utilities/ThemeManager.cs b/src/App/Utilities/ThemeManager.cs index 7fe6b6d85..963a02432 100644 --- a/src/App/Utilities/ThemeManager.cs +++ b/src/App/Utilities/ThemeManager.cs @@ -1,6 +1,8 @@ -using Bit.App.Services; +using Bit.App.Abstractions; +using Bit.App.Services; using Bit.App.Styles; using Bit.Core; +using Bit.Core.Utilities; using Xamarin.Forms; namespace Bit.App.Utilities @@ -29,9 +31,21 @@ namespace Bit.App.Utilities { Application.Current.Resources.MergedDictionaries.Add(new Nord()); } + else if(name == "light") + { + Application.Current.Resources.MergedDictionaries.Add(new Nord()); + } else { - Application.Current.Resources.MergedDictionaries.Add(new Light()); + var deviceActionService = ServiceContainer.Resolve("deviceActionService", true); + if(deviceActionService?.UsingDarkTheme() ?? false) + { + Application.Current.Resources.MergedDictionaries.Add(new Dark()); + } + else + { + Application.Current.Resources.MergedDictionaries.Add(new Light()); + } } // Base styles diff --git a/src/iOS.Core/Services/DeviceActionService.cs b/src/iOS.Core/Services/DeviceActionService.cs index 0c7b12604..2125cdc9e 100644 --- a/src/iOS.Core/Services/DeviceActionService.cs +++ b/src/iOS.Core/Services/DeviceActionService.cs @@ -351,6 +351,11 @@ namespace Bit.iOS.Core.Services throw new NotImplementedException(); } + public bool UsingDarkTheme() + { + return false; + } + private void ImagePicker_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e) { if(sender is UIImagePickerController picker)