테마 설정이 있을 경우 테마적용.

This commit is contained in:
leejinho 2020-04-01 15:14:45 +09:00
parent 4e4aba38da
commit 3da6832465

View File

@ -6,7 +6,8 @@ import {
OnDestroy, OnDestroy,
ViewChild, ViewChild,
NgZone, NgZone,
ElementRef ElementRef,
Renderer2
} from '@angular/core'; } from '@angular/core';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
@ -64,7 +65,7 @@ import { environment } from '../../../../environments/environment';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { LeftSideComponent } from '@app/layouts/messenger/components/left-side.component'; import { LeftSideComponent } from '@app/layouts/messenger/components/left-side.component';
import { MatDrawer } from '@angular/material/sidenav'; import { MatDrawer } from '@angular/material/sidenav';
import { LocationStrategy } from '@angular/common'; import { LocationStrategy, DOCUMENT } from '@angular/common';
import { ElectronBrowserWindowChannel } from '@ucap-webmessenger/electron-core'; import { ElectronBrowserWindowChannel } from '@ucap-webmessenger/electron-core';
@Component({ @Component({
@ -118,12 +119,27 @@ export class MainPageComponent implements OnInit, OnDestroy {
private translateService: TranslateService, private translateService: TranslateService,
private dialogService: DialogService, private dialogService: DialogService,
private location: LocationStrategy, private location: LocationStrategy,
@Inject(DOCUMENT) private document: Document,
private renderer2: Renderer2,
private logger: NGXLogger private logger: NGXLogger
) { ) {
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>( this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
KEY_ENVIRONMENTS_INFO KEY_ENVIRONMENTS_INFO
); );
const appUserInfo = this.localStorageService.encGet<AppUserInfo>(
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 // preventing back button in browser
history.pushState(null, null, window.location.href); history.pushState(null, null, window.location.href);
this.location.onPopState(() => { this.location.onPopState(() => {