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('{');