feat: enhance theme management and image caching functionality

This commit is contained in:
DEV_DSW
2026-04-16 15:43:35 +08:00
parent 411f4f3421
commit b1f589a674
13 changed files with 74 additions and 183 deletions

View File

@@ -8,15 +8,17 @@ class ThemeService {
private _isDark: boolean = nativeTheme.shouldUseDarkColors;
constructor() {
const themeMode = configManager.get(CONFIG_KEYS.THEME_MODE);
if (themeMode) {
nativeTheme.themeSource = themeMode;
this._isDark = nativeTheme.shouldUseDarkColors;
}
this._setupIpcEvent();
logManager.info('ThemeService initialized successfully.');
}
async init() {
const themeMode = configManager.get(CONFIG_KEYS.THEME_MODE);
nativeTheme.themeSource = themeMode;
this._isDark = nativeTheme.shouldUseDarkColors;
logManager.info('ThemeService async init completed.');
}
private _setupIpcEvent() {
ipcMain.handle(IPC_EVENTS.SET_THEME_MODE, (_e, mode: ThemeMode) => {
nativeTheme.themeSource = mode;
@@ -25,7 +27,7 @@ class ThemeService {
});
ipcMain.handle(IPC_EVENTS.GET_THEME_MODE, () => {
return nativeTheme.themeSource;
return configManager.get(CONFIG_KEYS.THEME_MODE);
});
ipcMain.handle(IPC_EVENTS.IS_DARK_THEME, () => {