diff options
Diffstat (limited to 'packages/main/src/index.ts')
-rw-r--r-- | packages/main/src/index.ts | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/packages/main/src/index.ts b/packages/main/src/index.ts index 8297ff5..67f5546 100644 --- a/packages/main/src/index.ts +++ b/packages/main/src/index.ts | |||
@@ -23,7 +23,6 @@ import { | |||
23 | BrowserView, | 23 | BrowserView, |
24 | BrowserWindow, | 24 | BrowserWindow, |
25 | ipcMain, | 25 | ipcMain, |
26 | nativeTheme, | ||
27 | } from 'electron'; | 26 | } from 'electron'; |
28 | import { readFileSync } from 'fs'; | 27 | import { readFileSync } from 'fs'; |
29 | import { readFile } from 'fs/promises'; | 28 | import { readFile } from 'fs/promises'; |
@@ -47,7 +46,10 @@ import { | |||
47 | installDevToolsExtensions, | 46 | installDevToolsExtensions, |
48 | openDevToolsWhenReady, | 47 | openDevToolsWhenReady, |
49 | } from './devTools'; | 48 | } from './devTools'; |
50 | import { ConfigPersistenceImpl } from './services/impl/ConfigPersistenceImpl'; | 49 | import { initConfig } from './controllers/ConfigController'; |
50 | import { initNativeTheme } from './controllers/NativeThemeController'; | ||
51 | import { ConfigPersistenceService } from './services/ConfigPersistenceService'; | ||
52 | import { NativeThemeService } from './services/NativeThemeService'; | ||
51 | import { createMainStore } from './stores/MainStore'; | 53 | import { createMainStore } from './stores/MainStore'; |
52 | 54 | ||
53 | const isDevelopment = import.meta.env.MODE === 'development'; | 55 | const isDevelopment = import.meta.env.MODE === 'development'; |
@@ -105,23 +107,14 @@ if (isDevelopment) { | |||
105 | 107 | ||
106 | let mainWindow: BrowserWindow | null = null; | 108 | let mainWindow: BrowserWindow | null = null; |
107 | 109 | ||
108 | const store = createMainStore({ | 110 | const store = createMainStore(); |
109 | configPersistence: new ConfigPersistenceImpl( | ||
110 | app.getPath('userData'), | ||
111 | 'config.json5', | ||
112 | ), | ||
113 | }); | ||
114 | |||
115 | autorun(() => { | ||
116 | nativeTheme.themeSource = store.config.themeSource; | ||
117 | }); | ||
118 | |||
119 | store.setShouldUseDarkColors(nativeTheme.shouldUseDarkColors); | ||
120 | nativeTheme.on('updated', () => { | ||
121 | store.setShouldUseDarkColors(nativeTheme.shouldUseDarkColors); | ||
122 | }); | ||
123 | 111 | ||
124 | store.config.initConfig(); | 112 | initConfig( |
113 | store.config, | ||
114 | new ConfigPersistenceService(app.getPath('userData'), 'config.json5'), | ||
115 | ).then(() => { | ||
116 | initNativeTheme(store, new NativeThemeService()); | ||
117 | }).catch((err) => console.error(err)); | ||
125 | 118 | ||
126 | const rendererBaseUrl = getResourceUrl('../renderer/'); | 119 | const rendererBaseUrl = getResourceUrl('../renderer/'); |
127 | function shouldCancelMainWindowRequest(url: string, method: string): boolean { | 120 | function shouldCancelMainWindowRequest(url: string, method: string): boolean { |