Browse Source

Migrate services to Angular 22 @Service()

pull/7671/head
Thomas Kaul 1 week ago
parent
commit
d847d78f31
  1. 4
      apps/client/src/app/core/language.service.ts
  2. 2
      apps/client/src/app/core/layout.service.ts
  3. 8
      apps/client/src/main.ts
  4. 3
      libs/ui/src/lib/entity-logo/entity-logo-image-source.service.ts

4
apps/client/src/app/core/language.service.ts

@ -1,4 +0,0 @@
import { Service } from '@angular/core';
@Service({ autoProvided: false })
export class LanguageService {}

2
apps/client/src/app/core/layout.service.ts

@ -9,7 +9,7 @@ export class LayoutService {
public static readonly DEFAULT_NOTIFICATION_MAX_WIDTH = '50rem'; public static readonly DEFAULT_NOTIFICATION_MAX_WIDTH = '50rem';
public static readonly DEFAULT_NOTIFICATION_WIDTH = '75vw'; public static readonly DEFAULT_NOTIFICATION_WIDTH = '75vw';
public shouldReloadContent$: Observable<void>; public readonly shouldReloadContent$: Observable<void>;
private readonly shouldReloadSubject = new Subject<void>(); private readonly shouldReloadSubject = new Subject<void>();

8
apps/client/src/main.ts

@ -4,7 +4,6 @@ import { registerChartConfiguration } from '@ghostfolio/ui/chart';
import { GF_ENVIRONMENT } from '@ghostfolio/ui/environment'; import { GF_ENVIRONMENT } from '@ghostfolio/ui/environment';
import { GfNotificationModule } from '@ghostfolio/ui/notifications'; import { GfNotificationModule } from '@ghostfolio/ui/notifications';
import { Platform } from '@angular/cdk/platform';
import { import {
provideHttpClient, provideHttpClient,
withInterceptorsFromDi withInterceptorsFromDi
@ -17,7 +16,6 @@ import {
import { import {
DateAdapter, DateAdapter,
MAT_DATE_FORMATS, MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
MatNativeDateModule MatNativeDateModule
} from '@angular/material/core'; } from '@angular/material/core';
import { MatSnackBarModule } from '@angular/material/snack-bar'; import { MatSnackBarModule } from '@angular/material/snack-bar';
@ -35,7 +33,6 @@ import { GfAppComponent } from './app/app.component';
import { routes } from './app/app.routes'; import { routes } from './app/app.routes';
import { authInterceptorProviders } from './app/core/auth.interceptor'; import { authInterceptorProviders } from './app/core/auth.interceptor';
import { httpResponseInterceptorProviders } from './app/core/http-response.interceptor'; import { httpResponseInterceptorProviders } from './app/core/http-response.interceptor';
import { LanguageService } from './app/core/language.service';
import { ModulePreloadService } from './app/core/module-preload.service'; import { ModulePreloadService } from './app/core/module-preload.service';
import { PageTitleStrategy } from './app/services/page-title.strategy'; import { PageTitleStrategy } from './app/services/page-title.strategy';
import { environment } from './environments/environment'; import { environment } from './environments/environment';
@ -44,8 +41,7 @@ import { environment } from './environments/environment';
const response = await fetch('/api/v1/info'); const response = await fetch('/api/v1/info');
const info: InfoResponse = await response.json(); const info: InfoResponse = await response.json();
const utmSource = window.localStorage.getItem('utm_source') as const utmSource = window.localStorage.getItem('utm_source') as
| 'ios' 'ios' | 'trusted-web-activity';
| 'trusted-web-activity';
info.globalPermissions = filterGlobalPermissions( info.globalPermissions = filterGlobalPermissions(
info.globalPermissions, info.globalPermissions,
@ -79,7 +75,6 @@ import { environment } from './environments/environment';
registrationStrategy: 'registerImmediately' registrationStrategy: 'registerImmediately'
}) })
), ),
LanguageService,
ModulePreloadService, ModulePreloadService,
provideHttpClient(withInterceptorsFromDi()), provideHttpClient(withInterceptorsFromDi()),
provideIonicAngular(), provideIonicAngular(),
@ -87,7 +82,6 @@ import { environment } from './environments/environment';
provideNgxSkeletonLoader(), provideNgxSkeletonLoader(),
provideZoneChangeDetection(), provideZoneChangeDetection(),
{ {
deps: [LanguageService, MAT_DATE_LOCALE, Platform],
provide: DateAdapter, provide: DateAdapter,
useClass: CustomDateAdapter useClass: CustomDateAdapter
}, },

3
libs/ui/src/lib/entity-logo/entity-logo-image-source.service.ts

@ -2,7 +2,8 @@ import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
import { Service } from '@angular/core'; import { Service } from '@angular/core';
// Must stay auto-provided so it can be mocked in Storybook // Must stay auto-provided: several table stories render gf-entity-logo
// without providing an override and resolve this from the root injector
@Service() @Service()
export class EntityLogoImageSourceService { export class EntityLogoImageSourceService {
public getLogoUrlByAssetProfileIdentifier({ public getLogoUrlByAssetProfileIdentifier({

Loading…
Cancel
Save