fix: lock dark mode toggle with theme settings

This commit is contained in:
sethburkart123
2024-08-21 17:36:21 +10:00
parent 5549de571d
commit 5d97ab3da6
3 changed files with 18 additions and 5 deletions
+4 -3
View File
@@ -3,14 +3,15 @@ import { settingsState } from '../../utils/listeners/SettingsState';
import { applyCustomCSS } from './Themes';
export const applyTheme = async (theme: CustomTheme) => {
export const applyTheme = async (theme: CustomTheme, reEnable?: boolean) => {
let CustomCSS = '';
let CustomImages: CustomImage[] = [];
if (theme?.CustomCSS) CustomCSS = theme.CustomCSS;
if (theme?.CustomImages) CustomImages = theme.CustomImages;
if (theme?.forceDark) {
settingsState.originalDarkMode = settingsState.DarkMode
if (theme?.forceDark != undefined) {
if (!reEnable) settingsState.originalDarkMode = settingsState.DarkMode
settingsState.DarkMode = theme.forceDark
}
+1 -1
View File
@@ -8,7 +8,7 @@ export const enableCurrentTheme = async () => {
if (settingsState.selectedTheme) {
const theme = await localforage.getItem(settingsState.selectedTheme) as CustomTheme;
if (theme) {
await applyTheme(theme);
await applyTheme(theme, true);
}
}
};