]>
Commit | Line | Data |
---|---|---|
67ed6552 | 1 | import 'focus-visible' |
fc21ef5c | 2 | import { tap } from 'rxjs/operators' |
1d22d251 | 3 | import { environment } from 'src/environments/environment' |
67ed6552 | 4 | import { APP_BASE_HREF, registerLocaleData } from '@angular/common' |
8e08d415 | 5 | import { APP_INITIALIZER, NgModule } from '@angular/core' |
df98563e | 6 | import { BrowserModule } from '@angular/platform-browser' |
1d22d251 | 7 | import { ServiceWorkerModule } from '@angular/service-worker' |
67ed6552 | 8 | import localeOc from '@app/helpers/locales/oc' |
df98563e C |
9 | import { AppRoutingModule } from './app-routing.module' |
10 | import { AppComponent } from './app.component' | |
fc21ef5c | 11 | import { CoreModule, PluginService, ServerService } from './core' |
f0b56fdd | 12 | import { EmptyComponent } from './empty.component' |
5fb2e288 | 13 | import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header' |
1942f11d | 14 | import { HighlightPipe } from './header/highlight.pipe' |
1d22d251 | 15 | import { LanguageChooserComponent, MenuComponent, NotificationComponent } from './menu' |
67ed6552 C |
16 | import { ConfirmComponent } from './modal/confirm.component' |
17 | import { CustomModalComponent } from './modal/custom-modal.component' | |
18 | import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component' | |
19 | import { QuickSettingsModalComponent } from './modal/quick-settings-modal.component' | |
8f581725 C |
20 | import { AdminWelcomeModalComponent } from './modal/admin-welcome-modal.component' |
21 | import { AccountSetupWarningModalComponent } from './modal/account-setup-warning-modal.component' | |
0f01a8ba | 22 | import { SharedActorImageModule } from './shared/shared-actor-image/shared-actor-image.module' |
67ed6552 C |
23 | import { SharedFormModule } from './shared/shared-forms' |
24 | import { SharedGlobalIconModule } from './shared/shared-icons' | |
25 | import { SharedInstanceModule } from './shared/shared-instance' | |
26 | import { SharedMainModule } from './shared/shared-main' | |
27 | import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings' | |
2a39506c C |
28 | |
29 | registerLocaleData(localeOc, 'oc') | |
693b1aba | 30 | |
fc21ef5c C |
31 | export function loadConfigFactory (server: ServerService, pluginService: PluginService) { |
32 | return () => { | |
33 | const result = server.loadHTMLConfig() | |
34 | ||
35 | if (result) return result.pipe(tap(() => pluginService.initializePlugins())) | |
36 | ||
37 | return pluginService.initializePlugins() | |
38 | } | |
8e08d415 C |
39 | } |
40 | ||
ab32b0fc C |
41 | @NgModule({ |
42 | bootstrap: [ AppComponent ], | |
67ed6552 | 43 | |
ab32b0fc | 44 | declarations: [ |
b33f657c | 45 | AppComponent, |
f0b56fdd | 46 | EmptyComponent, |
b33f657c C |
47 | |
48 | MenuComponent, | |
8afc19a6 | 49 | LanguageChooserComponent, |
d3217560 | 50 | QuickSettingsModalComponent, |
51a83970 | 51 | NotificationComponent, |
43d0ea7f | 52 | HeaderComponent, |
f409f0c3 | 53 | SearchTypeaheadComponent, |
6af662a5 | 54 | SuggestionComponent, |
1942f11d | 55 | HighlightPipe, |
43d0ea7f | 56 | |
8f581725 | 57 | AccountSetupWarningModalComponent, |
437e8e06 | 58 | CustomModalComponent, |
8f581725 | 59 | AdminWelcomeModalComponent, |
67ed6552 C |
60 | InstanceConfigWarningModalComponent, |
61 | ConfirmComponent | |
ab32b0fc | 62 | ], |
67ed6552 | 63 | |
693b1aba | 64 | imports: [ |
ab32b0fc | 65 | BrowserModule, |
1d22d251 | 66 | ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }), |
23bcf666 | 67 | |
693b1aba | 68 | CoreModule, |
67ed6552 C |
69 | SharedMainModule, |
70 | SharedFormModule, | |
71 | SharedUserInterfaceSettingsModule, | |
72 | SharedGlobalIconModule, | |
73 | SharedInstanceModule, | |
746018f6 | 74 | SharedActorImageModule, |
693b1aba | 75 | |
a9614776 | 76 | AppRoutingModule // Put it after all the module because it has the 404 route |
ab32b0fc | 77 | ], |
361dcebc | 78 | |
989e526a | 79 | providers: [ |
8cc56c7f C |
80 | { |
81 | provide: APP_BASE_HREF, | |
82 | useValue: '/' | |
8e08d415 C |
83 | }, |
84 | { | |
85 | provide: APP_INITIALIZER, | |
86 | useFactory: loadConfigFactory, | |
fc21ef5c | 87 | deps: [ ServerService, PluginService ], |
8e08d415 | 88 | multi: true |
fc21ef5c | 89 | } |
989e526a | 90 | ] |
ab32b0fc | 91 | }) |
63c4db6d | 92 | export class AppModule {} |