diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 4511f52e9c..f959f91178 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -124,14 +124,6 @@ export class AppComponent implements OnInit { window.onkeypress = () => this.recordActivity(); }); - this.platformUtilsService.onDefaultSystemThemeChange(async systemTheme => { - const theme = await this.storageService.get(ConstantsService.themeKey); - if (theme == null) { - window.document.documentElement.classList.remove('theme_light', 'theme_dark'); - window.document.documentElement.classList.add('theme_' + systemTheme); - } - }); - this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => { this.ngZone.run(async () => { switch (message.command) { diff --git a/src/app/services.module.ts b/src/app/services.module.ts index bfdf235ccd..b6a24f9fd8 100644 --- a/src/app/services.module.ts +++ b/src/app/services.module.ts @@ -157,6 +157,10 @@ export function initFactory(): Function { let theme = await storageService.get(ConstantsService.themeKey); if (theme == null) { theme = await platformUtilsService.getDefaultSystemTheme(); + platformUtilsService.onDefaultSystemThemeChange(sysTheme => { + window.document.documentElement.classList.remove('theme_light', 'theme_dark'); + window.document.documentElement.classList.add('theme_' + sysTheme); + }); } htmlEl.classList.add('theme_' + theme); stateService.save(ConstantsService.disableFaviconKey,