From eb0f86578db27ac829689495866036bd4c3ab102 Mon Sep 17 00:00:00 2001 From: leejh Date: Tue, 29 Oct 2019 10:10:08 +0900 Subject: [PATCH] =?UTF-8?q?1.=20=EB=8B=A4=EB=A5=B8=EB=94=94=EB=B0=94?= =?UTF-8?q?=EC=9D=B4=EC=8A=A4=EC=99=80=EC=9D=98=20Sync=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC.=20:::=20EVENT=5FRES,=20EVENT=5FREAD=5FRES=202.=20?= =?UTF-8?q?=EB=8C=80=ED=99=94=EB=A6=AC=EC=8A=A4=ED=8A=B8=EC=9D=98=20finalE?= =?UTF-8?q?ventMessage=20=EA=B0=B1=EC=8B=A0=EB=90=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95=20::=20virt?= =?UTF-8?q?ure=20scroll=20=EC=B2=98=EB=A6=AC=20=EC=A0=9C=EA=B1=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/utils/json.util.ts | 4 ++ .../left-sidenav/chat.component.html | 14 +++++- .../src/app/services/notification.service.ts | 6 ++- .../src/app/store/messenger/event/actions.ts | 2 + .../src/app/store/messenger/event/effects.ts | 43 ++++++++++++++----- .../lib/services/event-protocol.service.ts | 6 ++- .../src/lib/utils/string.util.ts | 1 + 7 files changed, 61 insertions(+), 15 deletions(-) diff --git a/projects/ucap-webmessenger-api/src/lib/utils/json.util.ts b/projects/ucap-webmessenger-api/src/lib/utils/json.util.ts index 25f8964a..2f7ccc39 100644 --- a/projects/ucap-webmessenger-api/src/lib/utils/json.util.ts +++ b/projects/ucap-webmessenger-api/src/lib/utils/json.util.ts @@ -1,6 +1,10 @@ import { JsonObject } from 'type-fest'; export class JsonAnalization { + /** + * Raw string Analization for JSON string. + * @description Editing with string.util.ts + */ public static receiveAnalization(jsonStr: string): JsonObject { const startJson = jsonStr.indexOf('{'); const endJson = jsonStr.lastIndexOf('}'); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.html index 9a94a635..ac633a00 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/chat.component.html @@ -21,7 +21,17 @@
- + +
{ switch (notiOrRes.SSVC_TYPE) { + case SSVC_TYPE_EVENT_SEND_RES: case SSVC_TYPE_EVENT_SEND_NOTI: { const noti = notiOrRes as SendNotification; @@ -119,6 +122,7 @@ export class AppNotificationService { ); } break; + case SSVC_TYPE_EVENT_READ_RES: case SSVC_TYPE_EVENT_READ_NOTI: { // 대화방 unread count 처리. 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 7ae76dc2..eeacf52a 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 @@ -39,6 +39,8 @@ export const newInfo = createAction( props<{ roomSeq: string; info: Info; + SVC_TYPE?: number; + SSVC_TYPE?: number; }>() ); 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 7e928630..84cca3d3 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 @@ -25,6 +25,7 @@ import { Info, InfoResponse, EventProtocolService, + SVC_TYPE_EVENT, SSVC_TYPE_EVENT_INFO_DATA, SSVC_TYPE_EVENT_INFO_RES, SendResponse, @@ -207,7 +208,12 @@ export class Effects { }; this.store.dispatch( - newInfo({ roomSeq: res.roomSeq, info: appendInfo }) + newInfo({ + roomSeq: res.roomSeq, + info: appendInfo, + SVC_TYPE: res.SVC_TYPE, + SSVC_TYPE: res.SSVC_TYPE + }) ); }) ); @@ -231,7 +237,12 @@ export class Effects { }; this.store.dispatch( - newInfo({ roomSeq: noti.roomSeq, info: appendInfo }) + newInfo({ + roomSeq: noti.roomSeq, + info: appendInfo, + SVC_TYPE: noti.SVC_TYPE, + SSVC_TYPE: noti.SSVC_TYPE + }) ); }) ); @@ -368,15 +379,25 @@ export class Effects { } // not opened room :: unread count increased - if (!roomInfo || roomInfo.roomSeq !== action.roomSeq) { - if (!!trgtRoomInfos && !!trgtRoomInfos[action.roomSeq]) { - const noReadCnt = trgtRoomInfos[action.roomSeq].noReadCnt; - this.store.dispatch( - SyncStore.updateUnreadCount({ - roomSeq: action.roomSeq, - noReadCnt: noReadCnt + 1 - }) - ); + if ( + action.SVC_TYPE === SVC_TYPE_EVENT && + action.SSVC_TYPE === SSVC_TYPE_EVENT_INFO_RES + ) { + /** + * 다른 디바이스에서 대화를 송신 할경우 RES 가 noti 로 유입될 수 있다. + * 이때 unread count 를 중가하지 않는다. + */ + } else { + if (!roomInfo || roomInfo.roomSeq !== action.roomSeq) { + if (!!trgtRoomInfos && !!trgtRoomInfos[action.roomSeq]) { + const noReadCnt = trgtRoomInfos[action.roomSeq].noReadCnt; + this.store.dispatch( + SyncStore.updateUnreadCount({ + roomSeq: action.roomSeq, + noReadCnt: noReadCnt + 1 + }) + ); + } } } diff --git a/projects/ucap-webmessenger-protocol-event/src/lib/services/event-protocol.service.ts b/projects/ucap-webmessenger-protocol-event/src/lib/services/event-protocol.service.ts index f8d32533..bf1baa70 100644 --- a/projects/ucap-webmessenger-protocol-event/src/lib/services/event-protocol.service.ts +++ b/projects/ucap-webmessenger-protocol-event/src/lib/services/event-protocol.service.ts @@ -34,7 +34,9 @@ import { SSVC_TYPE_EVENT_CANCEL_NOTI, SSVC_TYPE_EVENT_SEND_NOTI, SSVC_TYPE_EVENT_READ_NOTI, - SSVC_TYPE_EVENT_DEL_RES + SSVC_TYPE_EVENT_DEL_RES, + SSVC_TYPE_EVENT_SEND_RES, + SSVC_TYPE_EVENT_READ_RES } from '../types/service'; import { SendRequest, @@ -92,11 +94,13 @@ export class EventProtocolService { filter(message => message.serviceType === SVC_TYPE_EVENT), tap(message => { switch (message.subServiceType) { + case SSVC_TYPE_EVENT_SEND_RES: case SSVC_TYPE_EVENT_SEND_NOTI: { this.notificationSubject.next(decodeSendNotification(message)); } break; + case SSVC_TYPE_EVENT_READ_RES: case SSVC_TYPE_EVENT_READ_NOTI: { this.notificationSubject.next(decodeReadNotification(message)); diff --git a/projects/ucap-webmessenger-ui/src/lib/utils/string.util.ts b/projects/ucap-webmessenger-ui/src/lib/utils/string.util.ts index d8f9f272..7fab2588 100644 --- a/projects/ucap-webmessenger-ui/src/lib/utils/string.util.ts +++ b/projects/ucap-webmessenger-ui/src/lib/utils/string.util.ts @@ -37,6 +37,7 @@ export class StringUtil { /** * Json String Analization. + * @description Editing with json.util.ts */ public static receiveAnalization(jsonStr: string): JsonObject { const startJson = jsonStr.indexOf('{');