From c5c661a9c18e523002174d7341e66c88ec537fe1 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Fri, 22 Nov 2024 10:33:15 -0800 Subject: [PATCH] chore: remove template-app-config service --- src/app/app.component.ts | 5 +-- .../template-app-config.service.spec.ts | 16 -------- .../services/template-app-config.service.ts | 41 ------------------- 3 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 src/app/shared/components/template/services/template-app-config.service.spec.ts delete mode 100644 src/app/shared/components/template/services/template-app-config.service.ts diff --git a/src/app/app.component.ts b/src/app/app.component.ts index c2fb25c261..323455791f 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -43,7 +43,6 @@ import { LocalStorageService } from "./shared/services/local-storage/local-stora import { DeploymentService } from "./shared/services/deployment/deployment.service"; import { ScreenOrientationService } from "./shared/services/screen-orientation/screen-orientation.service"; import { TemplateMetadataService } from "./shared/components/template/services/template-metadata.service"; -import { TemplateAppConfigService } from "./shared/components/template/services/template-app-config.service"; @Component({ selector: "app-root", @@ -113,8 +112,7 @@ export class AppComponent { private remoteAssetService: RemoteAssetService, private shareService: ShareService, private fileManagerService: FileManagerService, - private screenOrientationService: ScreenOrientationService, - private templateAppConfigService: TemplateAppConfigService + private screenOrientationService: ScreenOrientationService ) { this.initializeApp(); } @@ -241,7 +239,6 @@ export class AppComponent { this.fileManagerService, this.templateMetadataService, this.screenOrientationService, - this.templateAppConfigService, ], deferred: [this.analyticsService], implicit: [ diff --git a/src/app/shared/components/template/services/template-app-config.service.spec.ts b/src/app/shared/components/template/services/template-app-config.service.spec.ts deleted file mode 100644 index 60a4c457d3..0000000000 --- a/src/app/shared/components/template/services/template-app-config.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from "@angular/core/testing"; - -import { TemplateAppConfigService } from "./template-app-config.service"; - -describe("TemplateAppConfigService", () => { - let service: TemplateAppConfigService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(TemplateAppConfigService); - }); - - it("should be created", () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/src/app/shared/components/template/services/template-app-config.service.ts b/src/app/shared/components/template/services/template-app-config.service.ts deleted file mode 100644 index 3ae8f300e4..0000000000 --- a/src/app/shared/components/template/services/template-app-config.service.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { effect, Injectable, signal } from "@angular/core"; -import { SyncServiceBase } from "src/app/shared/services/syncService.base"; -import { TemplateMetadataService } from "./template-metadata.service"; -import { deepMergeObjects, RecursivePartial } from "src/app/shared/utils"; -import { IAppConfig } from "data-models"; -import { AppConfigService } from "src/app/shared/services/app-config/app-config.service"; -import { SkinService } from "src/app/shared/services/skin/skin.service"; - -/** - * Service to apply template-level app config changes (e.g. to header and footer elements) - * These overrides are on top of changes applied by skins (which are themselves on top of those in the deployment config) - * */ -@Injectable({ - providedIn: "root", -}) -export class TemplateAppConfigService extends SyncServiceBase { - constructor( - private templateMetadataService: TemplateMetadataService, - private appConfigService: AppConfigService, - private skinService: SkinService - ) { - super("TemplateAppConfig"); - effect( - async () => { - const templateAppConfigOverrides = this.templateMetadataService.parameterList() - .app_config as RecursivePartial; - this.applyAppConfigOverrides(templateAppConfigOverrides); - }, - { allowSignalWrites: true } - ); - } - - applyAppConfigOverrides(overrides: RecursivePartial = {}) { - // Template app config overrides are applied on top of skin overrides - const currentSkin = this.skinService.currentSkin; - if (currentSkin.appConfig) { - overrides = deepMergeObjects({}, currentSkin.appConfig, overrides); - } - this.appConfigService.setAppConfig(overrides); - } -}