diff --git a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts index 3e91d267..56a8e74e 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts +++ b/projects/ucap-webmessenger-app/src/app/pages/messenger/components/main.page.component.ts @@ -6,7 +6,8 @@ import { OnDestroy, ViewChild, NgZone, - ElementRef + ElementRef, + Renderer2 } from '@angular/core'; import { Store, select } from '@ngrx/store'; @@ -64,7 +65,7 @@ import { environment } from '../../../../environments/environment'; import { TranslateService } from '@ngx-translate/core'; import { LeftSideComponent } from '@app/layouts/messenger/components/left-side.component'; import { MatDrawer } from '@angular/material/sidenav'; -import { LocationStrategy } from '@angular/common'; +import { LocationStrategy, DOCUMENT } from '@angular/common'; import { ElectronBrowserWindowChannel } from '@ucap-webmessenger/electron-core'; @Component({ @@ -118,12 +119,27 @@ export class MainPageComponent implements OnInit, OnDestroy { private translateService: TranslateService, private dialogService: DialogService, private location: LocationStrategy, + @Inject(DOCUMENT) private document: Document, + private renderer2: Renderer2, private logger: NGXLogger ) { this.environmentsInfo = this.sessionStorageService.get( KEY_ENVIRONMENTS_INFO ); + const appUserInfo = this.localStorageService.encGet( + KEY_APP_USER_INFO, + environment.customConfig.appKey + ); + + if (!!appUserInfo && !!appUserInfo.settings.general.appTheme) { + this.renderer2.setAttribute( + this.document.body, + 'class', + appUserInfo.settings.general.appTheme + ); + } + // preventing back button in browser history.pushState(null, null, window.location.href); this.location.onPopState(() => {