기본 세팅 클리어 & 로그아웃 기능 추가.

> 상단 프로필 클릭 > 버전정보 > 현재버전 에서 마우스 middle 클릭 > 버튼 노출되면 클릭.
This commit is contained in:
leejinho 2020-03-11 17:01:44 +09:00
parent 2f3a76a7f7
commit 856b553da2
4 changed files with 52 additions and 33 deletions

View File

@ -124,13 +124,6 @@
</div>
</mat-card-content>
<mat-card-actions class="button-form flex-row">
<!-- <button
mat-stroked-button
(click)="onClickClearSettingAndLogout()"
class="mat-primary"
>
Clear Setting & Logout
</button> -->
<button
mat-stroked-button
(click)="onClickChoice(false)"

View File

@ -1,20 +1,12 @@
import { Component, OnInit, Inject, Renderer2, OnDestroy } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import {
KEY_LOGIN_RES_INFO,
KEY_VER_INFO,
KEY_LOGIN_INFO,
KEY_URL_INFO,
KEY_AUTH_INFO,
KEY_LOGOUT_INFO
} from '@app/types';
import { KEY_LOGIN_RES_INFO, KEY_VER_INFO } from '@app/types';
import {
SessionStorageService,
LocalStorageService
} from '@ucap-webmessenger/web-storage';
import { Store } from '@ngrx/store';
import * as AuthenticationStore from '@app/store/account/authentication';
import clone from 'clone';
@ -210,17 +202,4 @@ export class MessengerSettingsDialogComponent implements OnInit, OnDestroy {
return modSettings;
}
onClickClearSettingAndLogout() {
this.localStorageService.remove(KEY_APP_USER_INFO);
this.sessionStorageService.remove(KEY_LOGIN_RES_INFO);
this.sessionStorageService.remove(KEY_VER_INFO);
this.sessionStorageService.remove(KEY_LOGIN_INFO);
this.sessionStorageService.remove(KEY_URL_INFO);
this.sessionStorageService.remove(KEY_AUTH_INFO);
this.sessionStorageService.remove(KEY_LOGOUT_INFO);
this.nativeService.clearAppStorage();
this.dialogService.closeAll();
this.store.dispatch(AuthenticationStore.loginRedirect());
}
}

View File

@ -454,10 +454,13 @@
</mat-menu>
<mat-menu #informationMenu="matMenu">
<ng-template matMenuContent>
<ng-template matMenuContent let-isShowClearBtn="false">
<div class="version-info-container menu-item">
<div class="version-info-now" (click)="$event.stopPropagation()">
<span class="version-info-item">
<span
class="version-info-item"
(auxclick)="isShowClearBtn = !isShowClearBtn"
>
{{ 'information.installedVersion' | translate }}:<span
class="info-content"
>{{ appVersion }}</span
@ -498,5 +501,14 @@
</div>
</div>
</div>
<div *ngIf="isShowClearBtn" class="version-info-container menu-item">
<button
mat-flat-button
class="mat-primary"
(click)="onClickClearSettingAndLogout($event)"
>
Clear setting & Logout
</button>
</div>
</ng-template>
</mat-menu>

View File

@ -34,7 +34,10 @@ import {
KEY_LOGIN_INFO,
KEY_VER_INFO,
EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO
KEY_ENVIRONMENTS_INFO,
KEY_LOGIN_RES_INFO,
KEY_LOGOUT_INFO,
KEY_AUTH_INFO
} from '@app/types';
import {
WebLink,
@ -62,7 +65,12 @@ import {
ProfileDialogResult,
ProfileDialogData
} from '@app/layouts/messenger/dialogs/profile/profile.dialog.component';
import { DialogService } from '@ucap-webmessenger/ui';
import {
DialogService,
ConfirmDialogComponent,
ConfirmDialogData,
ConfirmDialogResult
} from '@ucap-webmessenger/ui';
import { DOCUMENT } from '@angular/common';
import { MatMenu, MatMenuTrigger } from '@angular/material/menu';
import { StatusCode, StatusType, WindowUtil } from '@ucap-webmessenger/core';
@ -663,4 +671,31 @@ export class TopBarComponent implements OnInit, OnDestroy {
this.integratedSearchWord = '';
}
async onClickClearSettingAndLogout() {
const result = await this.dialogService.open<
ConfirmDialogComponent,
ConfirmDialogData,
ConfirmDialogResult
>(ConfirmDialogComponent, {
width: '400px',
data: {
title: 'Clear & Logout?',
html: 'Clear General Setting And Logout?'
}
});
if (!!result && !!result.choice && result.choice) {
this.localStorageService.remove(KEY_APP_USER_INFO);
this.sessionStorageService.remove(KEY_LOGIN_RES_INFO);
this.sessionStorageService.remove(KEY_VER_INFO);
this.sessionStorageService.remove(KEY_LOGIN_INFO);
this.sessionStorageService.remove(KEY_URL_INFO);
this.sessionStorageService.remove(KEY_AUTH_INFO);
this.sessionStorageService.remove(KEY_LOGOUT_INFO);
this.nativeService.clearAppStorage();
this.dialogService.closeAll();
this.store.dispatch(AuthenticationStore.loginRedirect());
}
}
}