diff --git a/apps/client/src/app/components/admin-market-data/admin-market-data.service.ts b/apps/client/src/app/components/admin-market-data/admin-market-data.service.ts index c4d45b7f0..73ea1e86f 100644 --- a/apps/client/src/app/components/admin-market-data/admin-market-data.service.ts +++ b/apps/client/src/app/components/admin-market-data/admin-market-data.service.ts @@ -3,15 +3,13 @@ import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces'; import { NotificationService } from '@ghostfolio/ui/notifications'; import { AdminService } from '@ghostfolio/ui/services'; -import { Injectable } from '@angular/core'; +import { inject, Service } from '@angular/core'; import { EMPTY, Subject, catchError, finalize, forkJoin } from 'rxjs'; -@Injectable() +@Service({ autoProvided: false }) export class AdminMarketDataService { - public constructor( - private adminService: AdminService, - private notificationService: NotificationService - ) {} + private readonly adminService = inject(AdminService); + private readonly notificationService = inject(NotificationService); public deleteAssetProfile({ dataSource, symbol }: AssetProfileIdentifier) { const assetProfileDeleted = new Subject(); diff --git a/apps/client/src/app/core/auth.interceptor.ts b/apps/client/src/app/core/auth.interceptor.ts index 9c06a11d5..04be15478 100644 --- a/apps/client/src/app/core/auth.interceptor.ts +++ b/apps/client/src/app/core/auth.interceptor.ts @@ -13,10 +13,10 @@ import { HttpInterceptor, HttpRequest } from '@angular/common/http'; -import { inject, Injectable } from '@angular/core'; +import { inject, Service } from '@angular/core'; import { Observable } from 'rxjs'; -@Injectable() +@Service({ autoProvided: false }) export class AuthInterceptor implements HttpInterceptor { private readonly impersonationStorageService = inject( ImpersonationStorageService diff --git a/apps/client/src/app/core/http-response.interceptor.ts b/apps/client/src/app/core/http-response.interceptor.ts index 42c5b3ffc..f5735fc11 100644 --- a/apps/client/src/app/core/http-response.interceptor.ts +++ b/apps/client/src/app/core/http-response.interceptor.ts @@ -14,7 +14,7 @@ import { HttpInterceptor, HttpRequest } from '@angular/common/http'; -import { inject, Injectable } from '@angular/core'; +import { inject, Service } from '@angular/core'; import { MatSnackBar, MatSnackBarRef, @@ -26,7 +26,7 @@ import ms from 'ms'; import { Observable, throwError } from 'rxjs'; import { catchError } from 'rxjs/operators'; -@Injectable() +@Service({ autoProvided: false }) export class HttpResponseInterceptor implements HttpInterceptor { private readonly info: InfoItem; private snackBarRef: MatSnackBarRef | undefined; diff --git a/apps/client/src/app/core/language.service.ts b/apps/client/src/app/core/language.service.ts index ebd0e21dc..1f5ce68c8 100644 --- a/apps/client/src/app/core/language.service.ts +++ b/apps/client/src/app/core/language.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { Service } from '@angular/core'; -@Injectable() +@Service({ autoProvided: false }) export class LanguageService {} diff --git a/apps/client/src/app/core/layout.service.ts b/apps/client/src/app/core/layout.service.ts index a2bb7f252..2daa39f81 100644 --- a/apps/client/src/app/core/layout.service.ts +++ b/apps/client/src/app/core/layout.service.ts @@ -11,9 +11,10 @@ export class LayoutService { public shouldReloadContent$: Observable; + private readonly shouldReloadSubject = new Subject(); + private readonly deviceDetectorService = inject(DeviceDetectorService); private readonly notificationService = inject(NotificationService); - private shouldReloadSubject = new Subject(); public constructor() { this.shouldReloadContent$ = this.shouldReloadSubject.asObservable(); diff --git a/apps/client/src/app/core/module-preload.service.ts b/apps/client/src/app/core/module-preload.service.ts index 85d9c5e33..4f9290ede 100644 --- a/apps/client/src/app/core/module-preload.service.ts +++ b/apps/client/src/app/core/module-preload.service.ts @@ -1,8 +1,8 @@ -import { Injectable } from '@angular/core'; +import { Service } from '@angular/core'; import { PreloadingStrategy, Route } from '@angular/router'; import { Observable, of } from 'rxjs'; -@Injectable() +@Service({ autoProvided: false }) export class ModulePreloadService implements PreloadingStrategy { /** * Preloads all lazy loading modules with the attribute 'preload' set to true diff --git a/apps/client/src/app/services/page-title.strategy.ts b/apps/client/src/app/services/page-title.strategy.ts index ce04a0af8..ad4a5bdce 100644 --- a/apps/client/src/app/services/page-title.strategy.ts +++ b/apps/client/src/app/services/page-title.strategy.ts @@ -1,16 +1,14 @@ -import { Injectable } from '@angular/core'; +import { inject, Service } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { RouterStateSnapshot, TitleStrategy } from '@angular/router'; -@Injectable() +@Service({ autoProvided: false }) export class PageTitleStrategy extends TitleStrategy { private static readonly DEFAULT_TITLE = 'Ghostfolio – Open Source Wealth Management Software'; private static readonly DEFAULT_TITLE_SHORT = 'Ghostfolio'; - public constructor(private readonly title: Title) { - super(); - } + private readonly title = inject(Title); public override updateTitle(routerState: RouterStateSnapshot) { const title = this.buildTitle(routerState); diff --git a/libs/ui/src/lib/entity-logo/entity-logo-image-source.service.ts b/libs/ui/src/lib/entity-logo/entity-logo-image-source.service.ts index 1b4e3dfa8..26d2ff675 100644 --- a/libs/ui/src/lib/entity-logo/entity-logo-image-source.service.ts +++ b/libs/ui/src/lib/entity-logo/entity-logo-image-source.service.ts @@ -2,7 +2,7 @@ import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces'; import { Service } from '@angular/core'; -// Required to allow mocking in Storybook +// Must stay auto-provided so it can be mocked in Storybook @Service() export class EntityLogoImageSourceService { public getLogoUrlByAssetProfileIdentifier({ diff --git a/libs/ui/src/lib/fire-calculator/fire-calculator.service.ts b/libs/ui/src/lib/fire-calculator/fire-calculator.service.ts index 848a9efa4..482aee2d5 100644 --- a/libs/ui/src/lib/fire-calculator/fire-calculator.service.ts +++ b/libs/ui/src/lib/fire-calculator/fire-calculator.service.ts @@ -1,7 +1,7 @@ -import { Injectable } from '@angular/core'; +import { Service } from '@angular/core'; import { Big } from 'big.js'; -@Injectable() +@Service({ autoProvided: false }) export class FireCalculatorService { private readonly COMPOUND_PERIOD = 12; diff --git a/libs/ui/src/lib/notifications/notification.service.ts b/libs/ui/src/lib/notifications/notification.service.ts index 389f52180..b0758b576 100644 --- a/libs/ui/src/lib/notifications/notification.service.ts +++ b/libs/ui/src/lib/notifications/notification.service.ts @@ -1,7 +1,7 @@ import { ConfirmationDialogType } from '@ghostfolio/common/enums'; import { translate } from '@ghostfolio/ui/i18n'; -import { inject, Injectable } from '@angular/core'; +import { inject, Service } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { isFunction } from 'lodash'; @@ -14,7 +14,7 @@ import { } from './interfaces/interfaces'; import { GfPromptDialogComponent } from './prompt-dialog/prompt-dialog.component'; -@Injectable() +@Service({ autoProvided: false }) export class NotificationService { private dialogMaxWidth: string; private dialogWidth: string;