From e38a22d998cdf133070ee9c083a80cc28380f3f9 Mon Sep 17 00:00:00 2001 From: leejinho Date: Tue, 4 Feb 2020 11:29:55 +0900 Subject: [PATCH] =?UTF-8?q?bugfix=20::=20logout=20=EC=8B=9C=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC.=20=ED=8C=9D=EC=97=85=20=EC=98=A4=ED=94=88=EC=8B=9C?= =?UTF-8?q?=EC=97=90=20=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=EB=90=98?= =?UTF-8?q?=EB=A9=B4=20=ED=8C=9D=EC=97=85=EC=9D=B4=20=EB=82=A8=EC=95=84?= =?UTF-8?q?=EC=9E=88=EB=8A=94=20=EB=AC=B8=EC=A0=9C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialogs/file-viewer.dialog.component.ts | 25 +++++++++++- .../chat/create-chat.dialog.component.ts | 11 ++++-- .../notice/notice-detail.dialog.component.ts | 32 ++++++++++++++-- .../profile/profile.dialog.component.html | 2 +- .../profile/profile.dialog.component.ts | 7 +++- .../integrated-search.dialog.component.ts | 38 ++++++++++++------- .../lib/components/messages.component.html | 2 +- 7 files changed, 90 insertions(+), 27 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.ts index 489bd5fc..16e7b11c 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/common/dialogs/file-viewer.dialog.component.ts @@ -15,6 +15,9 @@ import { FileDownloadItem } from '@ucap-webmessenger/api'; import { CommonApiService } from '@ucap-webmessenger/api-common'; import { TranslateService } from '@ngx-translate/core'; 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 { fileInfo: FileEventJson; @@ -32,6 +35,8 @@ export interface FileViewerDialogResult {} styleUrls: ['./file-viewer.dialog.component.scss'] }) export class FileViewerDialogComponent implements OnInit, OnDestroy { + loginResSubscription: Subscription; + fileInfo: FileEventJson; downloadUrl: string; userSeq: number; @@ -51,6 +56,7 @@ export class FileViewerDialogComponent implements OnInit, OnDestroy { private snackBarService: SnackBarService, private commonApiService: CommonApiService, private fileProtocolService: FileProtocolService, + private store: Store, private logger: NGXLogger ) { 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 { this.commonApiService diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts index 5d5e39cf..72c4aa1e 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts @@ -174,6 +174,10 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { .pipe( select(AppStore.AccountSelector.AuthenticationSelector.loginRes), tap(loginRes => { + if (!loginRes) { + this.onClickCancel(); + } + this.loginRes = loginRes; }) ) @@ -197,10 +201,9 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { groupList.forEach(group => { if ( - !!environment.productConfig.CommonSetting - .useMyDeptGroup && - environment.productConfig.CommonSetting - .myDeptGroupSeq === group.seq + !!environment.productConfig.CommonSetting.useMyDeptGroup && + environment.productConfig.CommonSetting.myDeptGroupSeq === + group.seq ) { myDeptGroup = group; } else if (0 === group.seq) { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/notice/notice-detail.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/notice/notice-detail.dialog.component.ts index 79433b77..23f8e6a0 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/notice/notice-detail.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/notice/notice-detail.dialog.component.ts @@ -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 { 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 { notice: NoticeList; @@ -13,16 +17,36 @@ export interface NoticeDetailDialogResult {} templateUrl: './notice-detail.dialog.component.html', styleUrls: ['./notice-detail.dialog.component.scss'] }) -export class NoticeDetailDialogComponent implements OnInit { +export class NoticeDetailDialogComponent implements OnInit, OnDestroy { + loginResSubscription: Subscription; + constructor( public dialogRef: MatDialogRef< NoticeDetailDialogData, NoticeDetailDialogResult >, - @Inject(MAT_DIALOG_DATA) public data: NoticeDetailDialogData + @Inject(MAT_DIALOG_DATA) public data: NoticeDetailDialogData, + private store: Store ) {} - 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 { this.dialogRef.close(); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.html index c5514923..8ed336db 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.html @@ -3,7 +3,7 @@ [profileImageRoot]="sessionVerinfo.profileRoot" [editableProfileImage]="editableProfileImage" [isMe]="isMe" - [myMadn]="loginRes.madn" + [myMadn]="loginRes?.madn" [isBuddy]="isBuddy" [isFavorit]="isFavorit" [openProfileOptions]="data.openProfileOptions" diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts index b06bcf1b..ba5171b9 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/profile/profile.dialog.component.ts @@ -119,8 +119,12 @@ export class ProfileDialogComponent implements OnInit, OnDestroy { .pipe( select(AppStore.AccountSelector.AuthenticationSelector.loginRes), tap(loginRes => { + if (!loginRes) { + this.onClose(); + } + this.loginRes = loginRes; - if (loginRes.userSeq === this.data.userInfo.seq) { + if (!!loginRes && loginRes.userSeq === this.data.userInfo.seq) { this.isMe = true; this.userInfo = { ...this.userInfo, @@ -129,7 +133,6 @@ export class ProfileDialogComponent implements OnInit, OnDestroy { } else { this.isMe = false; } - 1; }) ) .subscribe(); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.ts index 0368cc04..cbb4f68a 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, Inject, OnDestroy } from '@angular/core'; 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 { Store, select } from '@ngrx/store'; @@ -16,13 +16,12 @@ import { DeptUserResponse } from '@ucap-webmessenger/protocol-query'; 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 { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types'; import { NGXLogger } from 'ngx-logger'; import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; import { environment } from '../../../../../environments/environment'; -import { TranslateService } from '@ngx-translate/core'; import { StatusBulkInfo } from '@ucap-webmessenger/protocol-status'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { DaesangProtocolService } from '@ucap-webmessenger/daesang'; @@ -46,6 +45,7 @@ export interface IntegratedSearchDialogResult {} }) export class IntegratedSearchDialogComponent implements OnInit, OnDestroy { loginRes: LoginResponse; + loginResSubscription: Subscription; sessionVerinfo: VersionInfo2Response; environmentsInfo: EnvironmentsInfo; @@ -73,9 +73,6 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy { private store: Store, private logger: NGXLogger ) { - this.loginRes = this.sessionStorageService.get( - KEY_LOGIN_RES_INFO - ); this.environmentsInfo = this.sessionStorageService.get( KEY_ENVIRONMENTS_INFO ); @@ -85,6 +82,18 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy { } 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.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) { this.pageCurrent = 1; @@ -163,12 +181,6 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy { } } - ngOnDestroy(): void { - if (!!this.searchSubscription) { - this.searchSubscription.unsubscribe(); - } - } - onCancel(): void { this.dialogRef.close({}); } @@ -208,7 +220,7 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy { if (!!result) { if (!!result.closeEvent && result.closeEvent === 'CHAT') { - this.dialogRef.close({}); + this.onCancel(); } } } diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html index 3e789259..3a546c03 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html @@ -57,7 +57,7 @@ *ngFor="let message of scroll.viewPortItems; trackBy: trackByEvent" [id]="message.seq" [message]="message" - [mine]="message.senderSeq === loginRes.userSeq" + [mine]="message.senderSeq === loginRes?.userSeq" [highlight]="isHighlightedEvent(message.seq)" [existReadToHere]=" !!readToHereEvent && readToHereEvent.seq === message.seq