fix(themes): fix the issue on startup while allowing reloadless themes to work with the old method
This commit is contained in:
parent
715223d72f
commit
d6a604f69c
2 changed files with 8 additions and 5 deletions
|
|
@ -27,7 +27,7 @@ export const _colorRef: InternalColorRef = {
|
|||
lastSetDiscordTheme: "darker"
|
||||
};
|
||||
|
||||
export function updateBunnyColor(colorManifest: ColorManifest | null, { update = true }) {
|
||||
export function updateBunnyColor(colorManifest: ColorManifest | null, { update = true, startup = true } ) {
|
||||
if (settings.safeMode?.enabled) return;
|
||||
|
||||
const internalDef = colorManifest ? parseColorManifest(colorManifest) : null;
|
||||
|
|
@ -52,11 +52,14 @@ export function updateBunnyColor(colorManifest: ColorManifest | null, { update =
|
|||
}
|
||||
|
||||
if (update) {
|
||||
AppearanceManager.setShouldSyncAppearanceSettings(false);
|
||||
AppearanceManager.updateTheme(internalDef != null ? ref.key : ref.lastSetDiscordTheme);
|
||||
}
|
||||
|
||||
if (startup) {
|
||||
// scuffed but it works
|
||||
AppearanceManager.setShouldSyncAppearanceSettings(true);
|
||||
AppearanceManager.updateTheme(internalDef != null ? ref.key : ref.lastSetDiscordTheme);
|
||||
AppearanceManager.setShouldSyncAppearanceSettings(false);
|
||||
AppearanceManager.updateTheme(internalDef != null ? ref.key : ref.lastSetDiscordTheme);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,10 +104,10 @@ export function selectTheme(theme: VdThemeInfo | null, write = true) {
|
|||
);
|
||||
|
||||
if (theme == null && write) {
|
||||
updateBunnyColor(null, { update: true });
|
||||
updateBunnyColor(null, { update: true, startup: false });
|
||||
return writeThemeToNative({});
|
||||
} else if (theme) {
|
||||
updateBunnyColor(theme.data, { update: true });
|
||||
updateBunnyColor(theme.data, { update: true, startup: false });
|
||||
return writeThemeToNative(theme);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue