mirror of
https://github.com/bitwarden/mobile
synced 2025-12-18 09:13:15 +00:00
Dynamic theme switching and visual tweaks (#1556)
* Dynamic theme switching and visual tweaks * update action runner to use macos-11 for iOS 15 support * additional tweaks * refinements * refinements * formatting and tweaks
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Models;
|
||||
using Bit.App.Services;
|
||||
using Bit.App.Styles;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Utilities;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Utilities
|
||||
@@ -47,8 +46,7 @@ namespace Bit.App.Utilities
|
||||
}
|
||||
else
|
||||
{
|
||||
var deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService", true);
|
||||
if (deviceActionService?.UsingDarkTheme() ?? false)
|
||||
if (OsDarkModeEnabled())
|
||||
{
|
||||
resources.MergedDictionaries.Add(new Dark());
|
||||
UsingLightTheme = false;
|
||||
@@ -86,6 +84,17 @@ namespace Bit.App.Utilities
|
||||
!android ? "group.com.8bit.bitwarden" : default(string));
|
||||
}
|
||||
|
||||
public static bool OsDarkModeEnabled()
|
||||
{
|
||||
if (Application.Current == null)
|
||||
{
|
||||
// called from iOS extension
|
||||
var app = new App(new AppOptions { IosExtension = true });
|
||||
return app.RequestedTheme == OSAppTheme.Dark;
|
||||
}
|
||||
return Application.Current.RequestedTheme == OSAppTheme.Dark;
|
||||
}
|
||||
|
||||
public static void ApplyResourcesToPage(ContentPage page)
|
||||
{
|
||||
foreach (var resourceDict in Resources().MergedDictionaries)
|
||||
|
||||
Reference in New Issue
Block a user