bugfix ::

logout 시 에러.
팝업 오픈시에 로그아웃되면 팝업이 남아있는 문제.
This commit is contained in:
leejinho 2020-02-04 11:29:55 +09:00
parent f98acedbb2
commit e38a22d998
7 changed files with 90 additions and 27 deletions

View File

@ -15,6 +15,9 @@ import { FileDownloadItem } from '@ucap-webmessenger/api';
import { CommonApiService } from '@ucap-webmessenger/api-common'; import { CommonApiService } from '@ucap-webmessenger/api-common';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { FileProtocolService } from '@ucap-webmessenger/protocol-file'; import { FileProtocolService } from '@ucap-webmessenger/protocol-file';
import { select, Store } from '@ngrx/store';
import { Subscription } from 'rxjs';
import * as AppStore from '@app/store';
export interface FileViewerDialogData { export interface FileViewerDialogData {
fileInfo: FileEventJson; fileInfo: FileEventJson;
@ -32,6 +35,8 @@ export interface FileViewerDialogResult {}
styleUrls: ['./file-viewer.dialog.component.scss'] styleUrls: ['./file-viewer.dialog.component.scss']
}) })
export class FileViewerDialogComponent implements OnInit, OnDestroy { export class FileViewerDialogComponent implements OnInit, OnDestroy {
loginResSubscription: Subscription;
fileInfo: FileEventJson; fileInfo: FileEventJson;
downloadUrl: string; downloadUrl: string;
userSeq: number; userSeq: number;
@ -51,6 +56,7 @@ export class FileViewerDialogComponent implements OnInit, OnDestroy {
private snackBarService: SnackBarService, private snackBarService: SnackBarService,
private commonApiService: CommonApiService, private commonApiService: CommonApiService,
private fileProtocolService: FileProtocolService, private fileProtocolService: FileProtocolService,
private store: Store<any>,
private logger: NGXLogger private logger: NGXLogger
) { ) {
this.fileInfo = data.fileInfo; this.fileInfo = data.fileInfo;
@ -70,9 +76,24 @@ export class FileViewerDialogComponent implements OnInit, OnDestroy {
); );
} }
ngOnInit() {} ngOnInit() {
this.loginResSubscription = this.store
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
if (!loginRes) {
this.onClosedViewer();
}
})
)
.subscribe();
}
ngOnDestroy(): void {} ngOnDestroy(): void {
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
}
onDownload(fileDownloadItem: FileDownloadItem): void { onDownload(fileDownloadItem: FileDownloadItem): void {
this.commonApiService this.commonApiService

View File

@ -174,6 +174,10 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
.pipe( .pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes), select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => { tap(loginRes => {
if (!loginRes) {
this.onClickCancel();
}
this.loginRes = loginRes; this.loginRes = loginRes;
}) })
) )
@ -197,10 +201,9 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
groupList.forEach(group => { groupList.forEach(group => {
if ( if (
!!environment.productConfig.CommonSetting !!environment.productConfig.CommonSetting.useMyDeptGroup &&
.useMyDeptGroup && environment.productConfig.CommonSetting.myDeptGroupSeq ===
environment.productConfig.CommonSetting group.seq
.myDeptGroupSeq === group.seq
) { ) {
myDeptGroup = group; myDeptGroup = group;
} else if (0 === group.seq) { } else if (0 === group.seq) {

View File

@ -1,6 +1,10 @@
import { Component, OnInit, Inject, ViewChild, OnDestroy } from '@angular/core'; import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { NoticeList } from '@ucap-webmessenger/api-message'; import { NoticeList } from '@ucap-webmessenger/api-message';
import { Subscription } from 'rxjs';
import { select, Store } from '@ngrx/store';
import { tap } from 'rxjs/operators';
import * as AppStore from '@app/store';
export interface NoticeDetailDialogData { export interface NoticeDetailDialogData {
notice: NoticeList; notice: NoticeList;
@ -13,16 +17,36 @@ export interface NoticeDetailDialogResult {}
templateUrl: './notice-detail.dialog.component.html', templateUrl: './notice-detail.dialog.component.html',
styleUrls: ['./notice-detail.dialog.component.scss'] styleUrls: ['./notice-detail.dialog.component.scss']
}) })
export class NoticeDetailDialogComponent implements OnInit { export class NoticeDetailDialogComponent implements OnInit, OnDestroy {
loginResSubscription: Subscription;
constructor( constructor(
public dialogRef: MatDialogRef< public dialogRef: MatDialogRef<
NoticeDetailDialogData, NoticeDetailDialogData,
NoticeDetailDialogResult NoticeDetailDialogResult
>, >,
@Inject(MAT_DIALOG_DATA) public data: NoticeDetailDialogData @Inject(MAT_DIALOG_DATA) public data: NoticeDetailDialogData,
private store: Store<any>
) {} ) {}
ngOnInit() {} ngOnInit() {
this.loginResSubscription = this.store
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
if (!loginRes) {
this.onClickConfirm();
}
})
)
.subscribe();
}
ngOnDestroy(): void {
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
}
onClickConfirm(): void { onClickConfirm(): void {
this.dialogRef.close(); this.dialogRef.close();

View File

@ -3,7 +3,7 @@
[profileImageRoot]="sessionVerinfo.profileRoot" [profileImageRoot]="sessionVerinfo.profileRoot"
[editableProfileImage]="editableProfileImage" [editableProfileImage]="editableProfileImage"
[isMe]="isMe" [isMe]="isMe"
[myMadn]="loginRes.madn" [myMadn]="loginRes?.madn"
[isBuddy]="isBuddy" [isBuddy]="isBuddy"
[isFavorit]="isFavorit" [isFavorit]="isFavorit"
[openProfileOptions]="data.openProfileOptions" [openProfileOptions]="data.openProfileOptions"

View File

@ -119,8 +119,12 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
.pipe( .pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes), select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => { tap(loginRes => {
if (!loginRes) {
this.onClose();
}
this.loginRes = loginRes; this.loginRes = loginRes;
if (loginRes.userSeq === this.data.userInfo.seq) { if (!!loginRes && loginRes.userSeq === this.data.userInfo.seq) {
this.isMe = true; this.isMe = true;
this.userInfo = { this.userInfo = {
...this.userInfo, ...this.userInfo,
@ -129,7 +133,6 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
} else { } else {
this.isMe = false; this.isMe = false;
} }
1;
}) })
) )
.subscribe(); .subscribe();

View File

@ -1,6 +1,6 @@
import { Component, OnInit, Inject, OnDestroy } from '@angular/core'; import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA, PageEvent } from '@angular/material'; import { MatDialogRef, MAT_DIALOG_DATA, PageEvent } from '@angular/material';
import { KEY_LOGIN_RES_INFO, KEY_VER_INFO } from '@app/types'; import { KEY_VER_INFO } from '@app/types';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
@ -16,13 +16,12 @@ import {
DeptUserResponse DeptUserResponse
} from '@ucap-webmessenger/protocol-query'; } from '@ucap-webmessenger/protocol-query';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { map, catchError, take } from 'rxjs/operators'; import { map, catchError, take, tap } from 'rxjs/operators';
import { Subscription, of, Observable } from 'rxjs'; import { Subscription, of, Observable } from 'rxjs';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types'; import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { environment } from '../../../../../environments/environment'; import { environment } from '../../../../../environments/environment';
import { TranslateService } from '@ngx-translate/core';
import { StatusBulkInfo } from '@ucap-webmessenger/protocol-status'; import { StatusBulkInfo } from '@ucap-webmessenger/protocol-status';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { DaesangProtocolService } from '@ucap-webmessenger/daesang'; import { DaesangProtocolService } from '@ucap-webmessenger/daesang';
@ -46,6 +45,7 @@ export interface IntegratedSearchDialogResult {}
}) })
export class IntegratedSearchDialogComponent implements OnInit, OnDestroy { export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
loginRes: LoginResponse; loginRes: LoginResponse;
loginResSubscription: Subscription;
sessionVerinfo: VersionInfo2Response; sessionVerinfo: VersionInfo2Response;
environmentsInfo: EnvironmentsInfo; environmentsInfo: EnvironmentsInfo;
@ -73,9 +73,6 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
private store: Store<any>, private store: Store<any>,
private logger: NGXLogger private logger: NGXLogger
) { ) {
this.loginRes = this.sessionStorageService.get<LoginResponse>(
KEY_LOGIN_RES_INFO
);
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>( this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
KEY_ENVIRONMENTS_INFO KEY_ENVIRONMENTS_INFO
); );
@ -85,6 +82,18 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.loginResSubscription = this.store
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
if (!loginRes) {
this.onCancel();
}
this.loginRes = loginRes;
})
)
.subscribe();
this.onSearch(this.data.keyword); this.onSearch(this.data.keyword);
this.presence$ = this.store.pipe( this.presence$ = this.store.pipe(
@ -92,6 +101,15 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
); );
} }
ngOnDestroy(): void {
if (!!this.searchSubscription) {
this.searchSubscription.unsubscribe();
}
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
}
onReSearch(searchWord: string) { onReSearch(searchWord: string) {
this.pageCurrent = 1; this.pageCurrent = 1;
@ -163,12 +181,6 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
} }
} }
ngOnDestroy(): void {
if (!!this.searchSubscription) {
this.searchSubscription.unsubscribe();
}
}
onCancel(): void { onCancel(): void {
this.dialogRef.close({}); this.dialogRef.close({});
} }
@ -208,7 +220,7 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
if (!!result) { if (!!result) {
if (!!result.closeEvent && result.closeEvent === 'CHAT') { if (!!result.closeEvent && result.closeEvent === 'CHAT') {
this.dialogRef.close({}); this.onCancel();
} }
} }
} }

View File

@ -57,7 +57,7 @@
*ngFor="let message of scroll.viewPortItems; trackBy: trackByEvent" *ngFor="let message of scroll.viewPortItems; trackBy: trackByEvent"
[id]="message.seq" [id]="message.seq"
[message]="message" [message]="message"
[mine]="message.senderSeq === loginRes.userSeq" [mine]="message.senderSeq === loginRes?.userSeq"
[highlight]="isHighlightedEvent(message.seq)" [highlight]="isHighlightedEvent(message.seq)"
[existReadToHere]=" [existReadToHere]="
!!readToHereEvent && readToHereEvent.seq === message.seq !!readToHereEvent && readToHereEvent.seq === message.seq