From 6a3ca4da7ba10a48485b37ba27118172bdfd8ec1 Mon Sep 17 00:00:00 2001 From: leejinho Date: Mon, 9 Dec 2019 09:58:43 +0900 Subject: [PATCH] =?UTF-8?q?#=20=EC=9D=B4=EC=8A=88=EC=B2=98=EB=A6=AC=20[66?= =?UTF-8?q?=20=EB=B9=84=EB=B0=80=EB=8C=80=ED=99=94=EB=B0=A9=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=A0=84=EB=8B=AC=20=EC=8B=9C=20=EC=9D=BC=EB=B0=98?= =?UTF-8?q?=EB=8C=80=ED=99=94=EB=B0=A9=EC=9C=BC=EB=A1=9C=20=EC=A0=84?= =?UTF-8?q?=EB=8B=AC=EB=90=A8]=20::=20=EB=8C=80=ED=99=94=EB=B0=A9=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC=EC=8B=9C=20=EB=8C=80=ED=99=94=EB=B0=A9=20?= =?UTF-8?q?=EC=9D=B8=EC=9B=90=20=EC=88=98=EC=A7=91=ED=9B=84=20=EA=B8=B0?= =?UTF-8?q?=EC=A1=B4=20=EB=A1=9C=EC=A7=81=EC=9D=84=20=ED=83=9C=EC=9A=B0?= =?UTF-8?q?=EB=8D=98=20=EA=B2=83=EC=9D=84=20=EB=8C=80=ED=99=94=EB=B0=A9?= =?UTF-8?q?=EC=97=90=20=EC=9D=BC=EB=8B=A8=20=EC=A0=84=EC=86=A1=20=ED=9B=84?= =?UTF-8?q?=20=EB=8C=80=ED=99=94=EB=B0=A9=EC=9D=84=20=EC=97=AC=EB=8A=94=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=EC=9C=BC=EB=A1=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/event/actions.ts | 9 +++ .../src/app/store/messenger/event/effects.ts | 68 +++++++++---------- 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/event/actions.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/event/actions.ts index 19830be0..cc3a7043 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/event/actions.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/event/actions.ts @@ -131,6 +131,15 @@ export const forwardAfterRoomOpen = createAction( trgtRoomSeq?: string; }>() ); +export const roomOpenAfterForward = createAction( + '[Messenger::Event] roomOpenAfterForward', + props<{ + senderSeq: number; + req: SendRequest; + trgtUserSeqs?: number[]; + trgtRoomSeq?: string; + }>() +); export const sendMass = createAction( '[Messenger::Event] Send Mass', diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts index 5d91b087..a666e67c 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts @@ -74,7 +74,8 @@ import { infoIntervalClear, fileInfo, fileInfoSuccess, - fileInfoFailure + fileInfoFailure, + roomOpenAfterForward } from './actions'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { @@ -394,41 +395,10 @@ export class Effects { () => { return this.actions$.pipe( ofType(forward), - withLatestFrom( - this.store.pipe( - select( - (state: any) => - state.messenger.sync.roomUserShort.entities as Dictionary< - RoomUserData - > - ) - ) - ), - tap(([action, roomUserList]) => { + tap(action => { if (!!action.trgtRoomSeq) { - this.store.dispatch( - forwardAfterRoomOpen({ - senderSeq: action.senderSeq, - req: action.req, - trgtUserSeqs: roomUserList[action.trgtRoomSeq].userInfos.map( - user => user.seq - ) - }) - ); - - // this.store.dispatch( - // ChatStore.selectedRoom({ roomSeq: action.trgtRoomSeq }) - // ); - // this.store.dispatch( - // send({ - // senderSeq: action.senderSeq, - // req: { - // roomSeq: action.trgtRoomSeq, - // eventType: action.req.eventType, - // sentMessage: action.req.sentMessage - // } - // }) - // ); + // 대화전달 후 방오픈. + this.store.dispatch(roomOpenAfterForward(action)); } else if (!!action.trgtUserSeqs && action.trgtUserSeqs.length > 0) { // 방오픈 후 대화전달. this.store.dispatch(forwardAfterRoomOpen(action)); @@ -471,6 +441,34 @@ export class Effects { ) ); + roomOpenAfterForward$ = createEffect(() => + this.actions$.pipe( + ofType(roomOpenAfterForward), + concatMap(action => { + return this.eventProtocolService + .send({ + roomSeq: action.trgtRoomSeq, + eventType: action.req.eventType, + sentMessage: action.req.sentMessage + }) + .pipe( + map((res: SendResponse) => { + this.store.dispatch( + newInfo({ + roomSeq: res.roomSeq, + info: res.info, + SVC_TYPE: res.SVC_TYPE, + SSVC_TYPE: res.SSVC_TYPE + }) + ); + return ChatStore.selectedRoom({ roomSeq: action.trgtRoomSeq }); + }), + catchError(error => of(sendFailure({ error }))) + ); + }) + ) + ); + sendMass$ = createEffect( () => { return this.actions$.pipe(