aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/main/src/index.ts')
-rw-r--r--packages/main/src/index.ts29
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';
28import { readFileSync } from 'fs'; 27import { readFileSync } from 'fs';
29import { readFile } from 'fs/promises'; 28import { readFile } from 'fs/promises';
@@ -47,7 +46,10 @@ import {
47 installDevToolsExtensions, 46 installDevToolsExtensions,
48 openDevToolsWhenReady, 47 openDevToolsWhenReady,
49} from './devTools'; 48} from './devTools';
50import { ConfigPersistenceImpl } from './services/impl/ConfigPersistenceImpl'; 49import { initConfig } from './controllers/ConfigController';
50import { initNativeTheme } from './controllers/NativeThemeController';
51import { ConfigPersistenceService } from './services/ConfigPersistenceService';
52import { NativeThemeService } from './services/NativeThemeService';
51import { createMainStore } from './stores/MainStore'; 53import { createMainStore } from './stores/MainStore';
52 54
53const isDevelopment = import.meta.env.MODE === 'development'; 55const isDevelopment = import.meta.env.MODE === 'development';
@@ -105,23 +107,14 @@ if (isDevelopment) {
105 107
106let mainWindow: BrowserWindow | null = null; 108let mainWindow: BrowserWindow | null = null;
107 109
108const store = createMainStore({ 110const store = createMainStore();
109 configPersistence: new ConfigPersistenceImpl(
110 app.getPath('userData'),
111 'config.json5',
112 ),
113});
114
115autorun(() => {
116 nativeTheme.themeSource = store.config.themeSource;
117});
118
119store.setShouldUseDarkColors(nativeTheme.shouldUseDarkColors);
120nativeTheme.on('updated', () => {
121 store.setShouldUseDarkColors(nativeTheme.shouldUseDarkColors);
122});
123 111
124store.config.initConfig(); 112initConfig(
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
126const rendererBaseUrl = getResourceUrl('../renderer/'); 119const rendererBaseUrl = getResourceUrl('../renderer/');
127function shouldCancelMainWindowRequest(url: string, method: string): boolean { 120function shouldCancelMainWindowRequest(url: string, method: string): boolean {