From 7fb306ce229d1921b6b793c7cc63deb1963c93cf Mon Sep 17 00:00:00 2001 From: leejinho Date: Tue, 18 Feb 2020 11:38:59 +0900 Subject: [PATCH] =?UTF-8?q?#=20=EC=9D=B4=EC=8A=88=EC=B2=98=EB=A6=AC=20266?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../messenger-settings.dialog.component.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.ts index d0770a2f..9242abdc 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component.ts @@ -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)