next-ucap-messenger/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.ts

58 lines
1.9 KiB
TypeScript
Raw Normal View History

2019-11-25 01:57:02 +00:00
import { Component, OnInit, Inject, Renderer2 } from '@angular/core';
2019-11-21 01:29:19 +00:00
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { Store } from '@ngrx/store';
import { DialogService } from '@ucap-webmessenger/ui';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { map } from 'rxjs/operators';
2019-11-25 01:57:02 +00:00
import { DOCUMENT } from '@angular/common';
2019-11-21 01:29:19 +00:00
export interface MessengerSettingsDialogData {}
export interface MessengerSettingsDialogResult {}
@Component({
selector: 'app-messenger-settings-dialog',
templateUrl: './messenger-settings.dialog.component.html',
styleUrls: ['./messenger-settings.dialog.component.scss']
})
export class MessengerSettingsDialogComponent implements OnInit {
loginRes: LoginResponse;
sessionVerinfo: VersionInfo2Response;
constructor(
public dialogRef: MatDialogRef<
MessengerSettingsDialogData,
MessengerSettingsDialogResult
>,
@Inject(MAT_DIALOG_DATA) public data: MessengerSettingsDialogData,
private dialogService: DialogService,
private sessionStorageService: SessionStorageService,
2019-11-25 01:57:02 +00:00
private store: Store<any>,
@Inject(DOCUMENT) private document: Document,
private renderer2: Renderer2
2019-11-21 01:29:19 +00:00
) {
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
KEY_VER_INFO
);
this.loginRes = this.sessionStorageService.get<LoginResponse>(
KEY_LOGIN_RES_INFO
);
}
ngOnInit() {}
2019-11-25 01:57:02 +00:00
onSelectTheme(theme: string): void {
this.renderer2.setAttribute(this.document.body, 'class', theme);
}
2019-11-21 01:29:19 +00:00
onClickChoice(choice: boolean): void {
this.dialogRef.close({});
}
}