# 이슈처리 266

This commit is contained in:
leejinho 2020-02-18 11:38:59 +09:00
parent e62c3aa9ea
commit 7fb306ce22

View File

@ -1,4 +1,4 @@
import { Component, OnInit, Inject, Renderer2 } from '@angular/core';
import { Component, OnInit, Inject, Renderer2, OnDestroy } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { KEY_LOGIN_RES_INFO, KEY_VER_INFO } from '@app/types';
import {
@ -11,13 +11,12 @@ import { Store } from '@ngrx/store';
import clone from 'clone';
import {
DialogService,
TranslateService as UCapTranslateService,
DateService as UCapDateService
} from '@ucap-webmessenger/ui';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { map, take } from 'rxjs/operators';
import { take } from 'rxjs/operators';
import { DOCUMENT } from '@angular/common';
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
import {
@ -45,7 +44,7 @@ export interface MessengerSettingsDialogResult {}
templateUrl: './messenger-settings.dialog.component.html',
styleUrls: ['./messenger-settings.dialog.component.scss']
})
export class MessengerSettingsDialogComponent implements OnInit {
export class MessengerSettingsDialogComponent implements OnInit, OnDestroy {
loginRes: LoginResponse;
sessionVerinfo: VersionInfo2Response;
environmentsInfo: EnvironmentsInfo;
@ -53,6 +52,8 @@ export class MessengerSettingsDialogComponent implements OnInit {
modifiedSettings: Settings;
appUserInfo: AppUserInfo;
// backdrop closing yn
isBackDrop = true;
constructor(
public dialogRef: MatDialogRef<
@ -60,7 +61,6 @@ export class MessengerSettingsDialogComponent implements OnInit {
MessengerSettingsDialogResult
>,
@Inject(MAT_DIALOG_DATA) public data: MessengerSettingsDialogData,
private dialogService: DialogService,
private sessionStorageService: SessionStorageService,
private localStorageService: LocalStorageService,
private ucapTranslateService: UCapTranslateService,
@ -92,6 +92,12 @@ export class MessengerSettingsDialogComponent implements OnInit {
ngOnInit() {}
ngOnDestroy(): void {
if (!!this.isBackDrop) {
this.applySettings(this.modifiedSettings, this.appUserInfo.settings);
}
}
onChangedGeneralSetting(setting: GeneralSetting) {
this.modifiedSettings = this.applySettings(this.modifiedSettings, {
...this.appUserInfo.settings,
@ -114,6 +120,7 @@ export class MessengerSettingsDialogComponent implements OnInit {
}
onClickChoice(choice: boolean): void {
this.isBackDrop = false;
if (choice) {
if (
!ObjectUtil.equals(this.appUserInfo.settings, this.modifiedSettings)