diff options
author | Kristóf Marussy <kristof@marussy.com> | 2021-12-27 19:41:46 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2021-12-27 19:51:14 +0100 |
commit | f5f27eddc93314e8e10ab96c7bdb5c626142a1d3 (patch) | |
tree | 99ce5eca8c2bf3590612b24e33d4fe727bd240ab /packages/main/src/index.ts | |
parent | fix: Allow the shared store listener to re-register in dev mode (diff) | |
download | sophie-f5f27eddc93314e8e10ab96c7bdb5c626142a1d3.tar.gz sophie-f5f27eddc93314e8e10ab96c7bdb5c626142a1d3.tar.zst sophie-f5f27eddc93314e8e10ab96c7bdb5c626142a1d3.zip |
refactor: Inversion of control with typed-inject
Diffstat (limited to 'packages/main/src/index.ts')
-rw-r--r-- | packages/main/src/index.ts | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/packages/main/src/index.ts b/packages/main/src/index.ts index 7aa3ee9..8eb0803 100644 --- a/packages/main/src/index.ts +++ b/packages/main/src/index.ts | |||
@@ -45,10 +45,7 @@ import { | |||
45 | installDevToolsExtensions, | 45 | installDevToolsExtensions, |
46 | openDevToolsWhenReady, | 46 | openDevToolsWhenReady, |
47 | } from './devTools'; | 47 | } from './devTools'; |
48 | import { initConfig } from './controllers/ConfigController'; | 48 | import { injector } from './injector'; |
49 | import { initNativeTheme } from './controllers/NativeThemeController'; | ||
50 | import { ConfigPersistenceService } from './services/ConfigPersistenceService'; | ||
51 | import { NativeThemeService } from './services/NativeThemeService'; | ||
52 | import { createMainStore } from './stores/MainStore'; | 49 | import { createMainStore } from './stores/MainStore'; |
53 | 50 | ||
54 | const isDevelopment = import.meta.env.MODE === 'development'; | 51 | const isDevelopment = import.meta.env.MODE === 'development'; |
@@ -108,12 +105,10 @@ let mainWindow: BrowserWindow | null = null; | |||
108 | 105 | ||
109 | const store = createMainStore(); | 106 | const store = createMainStore(); |
110 | 107 | ||
111 | initConfig( | 108 | const controller = injector.resolve('mainController'); |
112 | store.config, | 109 | controller.connect(store).catch((err) => { |
113 | new ConfigPersistenceService(app.getPath('userData'), 'config.json5'), | 110 | console.log('Error while initializing app', err); |
114 | ).then(() => { | 111 | }); |
115 | initNativeTheme(store, new NativeThemeService()); | ||
116 | }).catch((err) => console.error(err)); | ||
117 | 112 | ||
118 | const rendererBaseUrl = getResourceUrl('../renderer/'); | 113 | const rendererBaseUrl = getResourceUrl('../renderer/'); |
119 | function shouldCancelMainWindowRequest(url: string, method: string): boolean { | 114 | function shouldCancelMainWindowRequest(url: string, method: string): boolean { |