import { Hotkey, HotkeysService } from 'angular2-hotkeys'
-import { concat } from 'rxjs'
-import { filter, first, map, pairwise, switchMap } from 'rxjs/operators'
-import { DOCUMENT, PlatformLocation, ViewportScroller } from '@angular/common'
+import { filter, map, pairwise, switchMap } from 'rxjs/operators'
+import { DOCUMENT, getLocaleDirection, PlatformLocation, ViewportScroller } from '@angular/common'
import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core'
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
import { Event, GuardsCheckStart, NavigationEnd, RouteConfigLoadEnd, RouteConfigLoadStart, Router, Scroll } from '@angular/router'
import { NgbConfig, NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { LoadingBarService } from '@ngx-loading-bar/core'
import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
-import { getShortLocale, is18nPath } from '@shared/core-utils/i18n'
+import { getShortLocale } from '@shared/core-utils/i18n'
import { BroadcastMessageLevel, HTMLServerConfig, ServerConfig, UserRole } from '@shared/models'
import { MenuService } from './core/menu/menu.service'
import { POP_STATE_MODAL_DISMISS } from './helpers'
this.serverConfig = this.serverService.getHTMLConfig()
- this.loadPlugins()
+ this.hooks.runAction('action:application.init', 'common')
this.themeService.initialize()
this.authService.loadClientCredentials()
this.openModalsIfNeeded()
this.document.documentElement.lang = getShortLocale(this.localeId)
+ this.document.documentElement.dir = getLocaleDirection(this.localeId)
}
ngAfterViewInit () {
}
})
- // Homepage redirection
- navigationEndEvent.pipe(
- map(() => window.location.pathname),
- filter(pathname => !pathname || pathname === '/' || is18nPath(pathname))
- ).subscribe(() => this.redirectService.redirectToHomepage(true))
-
// Plugin hooks
navigationEndEvent.subscribe(e => {
this.hooks.runAction('action:router.navigation-end', 'common', { path: e.url })
}
}
- private async loadPlugins () {
- this.pluginService.initializePlugins()
-
- this.hooks.runAction('action:application.init', 'common')
- }
-
private async openModalsIfNeeded () {
this.authService.userInformationLoaded
.pipe(