From 4d816c6e546b9ecc478911a1469a9b804ed37a83 Mon Sep 17 00:00:00 2001 From: leejinho Date: Fri, 3 Apr 2020 09:49:14 +0900 Subject: [PATCH] =?UTF-8?q?bugfix=20::=20=EA=B0=84=ED=97=90=EC=A0=81?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=ED=94=84=EB=A0=88=EC=A6=8C=EC=8A=A4=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=EC=95=88=EB=90=98=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/app/store/messenger/status/effects.ts | 44 ++++++++++++------- .../app/store/messenger/status/reducers.ts | 14 +++--- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts index 928604e7..bb2ee150 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts @@ -36,6 +36,9 @@ import { MessageUpdateResponse } from '@ucap-webmessenger/protocol-status'; import { of } from 'rxjs'; +import { SessionStorageService } from '@ucap-webmessenger/web-storage'; +import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; +import { KEY_LOGIN_RES_INFO } from '@app/types'; @Injectable() export class Effects { @@ -48,6 +51,14 @@ export class Effects { userSeqList.push(buddy.seq); } + const loginResInfo: LoginResponse = this.sessionStorageService.get< + LoginResponse + >(KEY_LOGIN_RES_INFO); + if (!!loginResInfo) { + // import my status. + userSeqList.push(loginResInfo.userSeq); + } + return bulkInfo({ divCd: 'bulk', userSeqs: userSeqList }); }) ) @@ -128,23 +139,23 @@ export class Effects { ) ); - myStatusCheck$ = createEffect( - () => - this.actions$.pipe( - ofType(AuthStore.loginSuccess), - map(action => action.loginRes), - delay(5000), - tap(loginRes => { - this.store.dispatch( - bulkInfo({ divCd: 'mybulk', userSeqs: [loginRes.userSeq] }) - ); - // return bulkInfo({ divCd: 'bulk', userSeqs: [loginRes.userSeq] }); - }) - ), - { dispatch: false } - ); + // myStatusCheck$ = createEffect( + // () => + // this.actions$.pipe( + // ofType(AuthStore.loginSuccess), + // map(action => action.loginRes), + // delay(5000), + // tap(loginRes => { + // this.store.dispatch( + // bulkInfo({ divCd: 'mybulk', userSeqs: [loginRes.userSeq] }) + // ); + // // return bulkInfo({ divCd: 'bulk', userSeqs: [loginRes.userSeq] }); + // }) + // ), + // { dispatch: false } + // ); - mroomUserStatusCheck$ = createEffect( + roomUserStatusCheck$ = createEffect( () => this.actions$.pipe( ofType(RoomStore.infoSuccess), @@ -167,6 +178,7 @@ export class Effects { private actions$: Actions, private store: Store, private statusProtocolService: StatusProtocolService, + private sessionStorageService: SessionStorageService, private logger: NGXLogger ) {} } diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/status/reducers.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/status/reducers.ts index 58b82aef..79ff836d 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/status/reducers.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/status/reducers.ts @@ -35,22 +35,24 @@ export const reducer = createReducer( const noti = action.noti; const statusBulkInfoState: StatusBulkInfo = { - ...state.statusBulkInfo.entities[noti.userSeq], + userSeq: noti.userSeq, conferenceStatus: noti.conferenceStatus, imessengerStatus: noti.imessengerStatus, mobileConferenceStatus: noti.mobileConferenceStatus, mobileStatus: noti.mobileStatus, pcStatus: noti.pcStatus, phoneStatus: noti.phoneStatus, - statusMessage: noti.statusMessage + statusMessage: noti.statusMessage, + terminalStatus: TerminalStatusInfo.Unknown, + terminalStatusNumber: TerminalStatusNumber.Unknown, + workstatus: noti.workstatus }; return { ...state, - statusBulkInfo: adapterStatusBulkInfo.updateOne( - { id: noti.userSeq, changes: statusBulkInfoState }, - { ...state.statusBulkInfo } - ) + statusBulkInfo: adapterStatusBulkInfo.upsertOne(statusBulkInfoState, { + ...state.statusBulkInfo + }) }; }),