Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Load themes as sound as possible

Chocobozzzeab150cd3363
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index a83f2e2e26..605c629fd5 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -11,7 +11,6 @@ import {
ScreenService,
ScrollService,
ServerService,
- ThemeService,
User,
UserLocalStorageService
} from '@app/core'
@@ -93,7 +92,6 @@ export class AppComponent implements OnInit, AfterViewInit {
private domSanitizer: DomSanitizer,
private screenService: ScreenService,
private hotkeysService: HotkeysService,
- private themeService: ThemeService,
private hooks: HooksService,
private location: PlatformLocation,
private modalService: NgbModal,
@@ -115,7 +113,6 @@ export class AppComponent implements OnInit, AfterViewInit {
this.serverConfig = this.serverService.getHTMLConfig()
this.hooks.runAction('action:application.init', 'common')
- this.themeService.initialize()
this.authService.loadClientCredentials()
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index 43f10e02e1..348f6c3441 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -81,7 +81,7 @@ export class PluginService implements ClientHook {
initializePlugins () {
this.pluginsManager.loadPluginsList(this.server.getHTMLConfig())
- this.pluginsManager.ensurePluginsAreLoaded('common')
+ return this.pluginsManager.ensurePluginsAreLoaded('common')
}
initializeCustomModal (customModal: CustomModalComponent) {
diff --git a/client/src/main.ts b/client/src/main.ts
index 842ed53d60..8867bc6af8 100644
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -11,7 +11,7 @@ import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap'
import { LoadingBarModule } from '@ngx-loading-bar/core'
import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client'
import { ToastModule } from 'primeng/toast'
-import { tap } from 'rxjs/operators'
+import { switchMap } from 'rxjs/operators'
import { AppComponent } from './app/app.component'
import routes from './app/app.routes'
import {
@@ -20,6 +20,7 @@ import {
PreloadSelectedModulesList,
RedirectService,
ServerService,
+ ThemeService,
getCoreProviders
} from './app/core'
import { getMainProviders } from './app/shared/shared-main/main-providers'
@@ -28,17 +29,24 @@ import { logger } from './root-helpers'
registerLocaleData(localeOc, 'oc')
-export function loadConfigFactory (server: ServerService, pluginService: PluginService, redirectService: RedirectService) {
+export function loadConfigFactory (
+ server: ServerService,
+ pluginService: PluginService,
+ themeService: ThemeService,
+ redirectService: RedirectService
+) {
const initializeServices = () => {
redirectService.init()
- pluginService.initializePlugins()
+ themeService.initialize()
+
+ return pluginService.initializePlugins()
}
return () => {
const result = server.loadHTMLConfig()
- if (result) return result.pipe(tap(() => initializeServices()))
+ if (result) return result.pipe(switchMap(() => initializeServices()))
- initializeServices()
+ return initializeServices()
}
}
@@ -90,7 +98,7 @@ const bootstrap = () => bootstrapApplication(AppComponent, {
{
provide: APP_INITIALIZER,
useFactory: loadConfigFactory,
- deps: [ ServerService, PluginService, RedirectService ],
+ deps: [ ServerService, PluginService, ThemeService, RedirectService ],
multi: true
}
]