로그아웃, 설정 버튼에 대한 유효성 체크.
1. 로그아웃시 보여지지 않게 수정. 2. 로그인 상태가 아닐 경우에 skip 하도록 수정. 3. 로그아웃시 confirm 하도록 수정.
This commit is contained in:
parent
bde11c8711
commit
fd5b4b12f3
|
@ -166,6 +166,7 @@ function createTray() {
|
||||||
// accelerator: 'Q',
|
// accelerator: 'Q',
|
||||||
// selector: 'terminate:',
|
// selector: 'terminate:',
|
||||||
click: () => {
|
click: () => {
|
||||||
|
appWindow.show();
|
||||||
appWindow.browserWindow.webContents.send(MessengerChannel.Logout);
|
appWindow.browserWindow.webContents.send(MessengerChannel.Logout);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="app-layout-native-title-bar-title">UCAP M Messenger</div>
|
<div class="app-layout-native-title-bar-title">UCAP M Messenger</div>
|
||||||
<div class="app-layout-native-title-bar-spacer"></div>
|
<div class="app-layout-native-title-bar-spacer"></div>
|
||||||
<div class="app-layout-native-title-bar-link">
|
<div *ngIf="!!loginRes" class="app-layout-native-title-bar-link">
|
||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
class="button app-layout-native-title-bar-setting"
|
class="button app-layout-native-title-bar-setting"
|
||||||
|
|
|
@ -4,12 +4,16 @@ import {
|
||||||
NativeService,
|
NativeService,
|
||||||
WindowState
|
WindowState
|
||||||
} from '@ucap-webmessenger/native';
|
} from '@ucap-webmessenger/native';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable, Subscription } from 'rxjs';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store, select } from '@ngrx/store';
|
||||||
|
|
||||||
|
import * as AppStore from '@app/store';
|
||||||
import * as AuthenticationStore from '@app/store/account/authentication';
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
||||||
import * as SettingsStore from '@app/store/messenger/settings';
|
import * as SettingsStore from '@app/store/messenger/settings';
|
||||||
|
|
||||||
|
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
||||||
|
import { tap } from 'rxjs/operators';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-layout-native-top-bar',
|
selector: 'app-layout-native-top-bar',
|
||||||
templateUrl: './top-bar.component.html',
|
templateUrl: './top-bar.component.html',
|
||||||
|
@ -19,6 +23,8 @@ export class TopBarComponent implements OnInit, OnDestroy {
|
||||||
windowStateChanged$: Observable<WindowState>;
|
windowStateChanged$: Observable<WindowState>;
|
||||||
|
|
||||||
WindowState = WindowState;
|
WindowState = WindowState;
|
||||||
|
loginRes: LoginResponse;
|
||||||
|
loginResSubscription: Subscription;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
|
@ -27,6 +33,15 @@ export class TopBarComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.windowStateChanged$ = this.nativeService.windowStateChanged();
|
this.windowStateChanged$ = this.nativeService.windowStateChanged();
|
||||||
|
|
||||||
|
this.loginResSubscription = this.store
|
||||||
|
.pipe(
|
||||||
|
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
|
||||||
|
tap(loginRes => {
|
||||||
|
this.loginRes = loginRes;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {}
|
ngOnDestroy(): void {}
|
||||||
|
@ -48,6 +63,6 @@ export class TopBarComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickLogout(): void {
|
onClickLogout(): void {
|
||||||
this.store.dispatch(AuthenticationStore.logout());
|
this.store.dispatch(AuthenticationStore.logoutConfirmation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import {
|
||||||
} from '@ucap-webmessenger/web-storage';
|
} from '@ucap-webmessenger/web-storage';
|
||||||
import { LocaleCode } from '@ucap-webmessenger/core';
|
import { LocaleCode } from '@ucap-webmessenger/core';
|
||||||
import { LoginInfo, KEY_LOGIN_INFO } from '../types';
|
import { LoginInfo, KEY_LOGIN_INFO } from '../types';
|
||||||
|
import { KEY_VER_INFO } from '@app/types/ver-info.type';
|
||||||
|
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -44,6 +46,8 @@ export class AppAuthenticationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
|
this.sessionStorageService.remove(KEY_LOGIN_RES_INFO);
|
||||||
|
this.sessionStorageService.remove(KEY_VER_INFO);
|
||||||
this.sessionStorageService.remove(KEY_LOGIN_INFO);
|
this.sessionStorageService.remove(KEY_LOGIN_INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class AppNativeService {
|
||||||
|
|
||||||
subscribe(): void {
|
subscribe(): void {
|
||||||
this.nativeService.logout().subscribe(() => {
|
this.nativeService.logout().subscribe(() => {
|
||||||
this.store.dispatch(AuthenticationStore.logout());
|
this.store.dispatch(AuthenticationStore.logoutConfirmation());
|
||||||
});
|
});
|
||||||
this.nativeService.changeStatus().subscribe(statusCode => {});
|
this.nativeService.changeStatus().subscribe(statusCode => {});
|
||||||
this.nativeService.showSetting().subscribe(() => {
|
this.nativeService.showSetting().subscribe(() => {
|
||||||
|
|
|
@ -53,7 +53,11 @@ import {
|
||||||
ServiceProtocolService,
|
ServiceProtocolService,
|
||||||
UserPasswordSetResponse
|
UserPasswordSetResponse
|
||||||
} from '@ucap-webmessenger/protocol-service';
|
} from '@ucap-webmessenger/protocol-service';
|
||||||
import { AuthenticationProtocolService } from '@ucap-webmessenger/protocol-authentication';
|
import {
|
||||||
|
AuthenticationProtocolService,
|
||||||
|
LoginResponse
|
||||||
|
} from '@ucap-webmessenger/protocol-authentication';
|
||||||
|
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Effects {
|
export class Effects {
|
||||||
|
@ -157,19 +161,26 @@ export class Effects {
|
||||||
this.actions$.pipe(
|
this.actions$.pipe(
|
||||||
ofType(logoutConfirmation),
|
ofType(logoutConfirmation),
|
||||||
exhaustMap(async () => {
|
exhaustMap(async () => {
|
||||||
const result = await this.dialogService.open<
|
const loginRes = this.sessionStorageService.get<LoginResponse>(
|
||||||
ConfirmDialogComponent,
|
KEY_LOGIN_RES_INFO
|
||||||
ConfirmDialogData,
|
);
|
||||||
ConfirmDialogResult
|
|
||||||
>(ConfirmDialogComponent, {
|
|
||||||
width: '220px',
|
|
||||||
data: {
|
|
||||||
title: 'Logout',
|
|
||||||
message: 'Logout ?'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return result.choice;
|
if (!!loginRes && loginRes.userSeq) {
|
||||||
|
const result = await this.dialogService.open<
|
||||||
|
ConfirmDialogComponent,
|
||||||
|
ConfirmDialogData,
|
||||||
|
ConfirmDialogResult
|
||||||
|
>(ConfirmDialogComponent, {
|
||||||
|
data: {
|
||||||
|
title: 'Logout',
|
||||||
|
message: '로그아웃 하시겠습니까?'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return result.choice;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
map(result => (result ? logout() : logoutConfirmationDismiss()))
|
map(result => (result ? logout() : logoutConfirmationDismiss()))
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,6 +15,9 @@ import {
|
||||||
MessengerSettingsDialogData,
|
MessengerSettingsDialogData,
|
||||||
MessengerSettingsDialogResult
|
MessengerSettingsDialogResult
|
||||||
} from '@app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component';
|
} from '@app/layouts/messenger/dialogs/settings/messenger-settings.dialog.component';
|
||||||
|
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||||
|
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
||||||
|
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Effects {
|
export class Effects {
|
||||||
|
@ -23,18 +26,24 @@ export class Effects {
|
||||||
this.actions$.pipe(
|
this.actions$.pipe(
|
||||||
ofType(showDialog),
|
ofType(showDialog),
|
||||||
tap(async () => {
|
tap(async () => {
|
||||||
const result = await this.dialogService.open<
|
const loginRes = this.sessionStorageService.get<LoginResponse>(
|
||||||
MessengerSettingsDialogComponent,
|
KEY_LOGIN_RES_INFO
|
||||||
MessengerSettingsDialogData,
|
);
|
||||||
MessengerSettingsDialogResult
|
|
||||||
>(MessengerSettingsDialogComponent, {
|
if (!!loginRes && loginRes.userSeq) {
|
||||||
width: '800px',
|
const result = await this.dialogService.open<
|
||||||
maxWidth: '800px',
|
MessengerSettingsDialogComponent,
|
||||||
height: '800px',
|
MessengerSettingsDialogData,
|
||||||
minHeight: '800px',
|
MessengerSettingsDialogResult
|
||||||
disableClose: false,
|
>(MessengerSettingsDialogComponent, {
|
||||||
data: {}
|
width: '800px',
|
||||||
});
|
maxWidth: '800px',
|
||||||
|
height: '800px',
|
||||||
|
minHeight: '800px',
|
||||||
|
disableClose: false,
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
{ dispatch: false }
|
{ dispatch: false }
|
||||||
|
@ -44,6 +53,7 @@ export class Effects {
|
||||||
private actions$: Actions,
|
private actions$: Actions,
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
private logger: NGXLogger
|
private logger: NGXLogger,
|
||||||
|
private sessionStorageService: SessionStorageService
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user