diff --git a/projects/ucap-webmessenger-app/src/app/services/notification.service.ts b/projects/ucap-webmessenger-app/src/app/services/notification.service.ts index ded98f36..c86a5968 100644 --- a/projects/ucap-webmessenger-app/src/app/services/notification.service.ts +++ b/projects/ucap-webmessenger-app/src/app/services/notification.service.ts @@ -20,7 +20,6 @@ import { SSVC_TYPE_EVENT_READ_NOTI, SSVC_TYPE_EVENT_CANCEL_NOTI, SSVC_TYPE_EVENT_DEL_RES, - Info, SSVC_TYPE_EVENT_SEND_RES, SSVC_TYPE_EVENT_READ_RES } from '@ucap-webmessenger/protocol-event'; @@ -35,7 +34,9 @@ import { SSVC_TYPE_ROOM_EXIT_NOTI, SSVC_TYPE_ROOM_EXIT_FORCING_NOTI, SSVC_TYPE_ROOM_FONT_UPD_NOTI, - InviteNotification + InviteNotification, + UpdateNotification, + SSVC_TYPE_ROOM_UPD_RES } from '@ucap-webmessenger/protocol-room'; import { StatusProtocolService, @@ -200,6 +201,28 @@ export class AppNotificationService { .pipe( tap(notiOrRes => { switch (notiOrRes.SSVC_TYPE) { + case SSVC_TYPE_ROOM_UPD_RES: + { + const noti = notiOrRes as UpdateNotification; + this.logger.debug( + 'Notification::roomProtocolService::UpdateNotification', + noti + ); + this.store.dispatch( + RoomStore.updateSuccess({ + res: { + roomSeq: noti.roomSeq, + roomName: + noti.roomName.trim().length === 0 + ? ' ' + : noti.roomName.trim(), + receiveAlarm: noti.receiveAlarm, + syncAll: false + } + }) + ); + } + break; case SSVC_TYPE_ROOM_INVITE_NOTI: { const noti = notiOrRes as InviteNotification; diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts index 71759188..6c72eca8 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts @@ -105,6 +105,19 @@ export const reducer = createReducer( on(updateRoomForNewEventMessage, (state, action) => { let finalEventMessage: string = action.info.sentMessage; switch (action.info.type) { + case EventType.Join: + case EventType.Exit: + case EventType.RenameRoom: + case EventType.NotificationForTimerRoom: + case EventType.GuideForRoomTimerChanged: { + /** + * 해당 타입은 메시지를 갱신하지 않는다. + * @description Edit with ui-chat > messages.component.ts + */ + return { + ...state + }; + } case EventType.Sticker: finalEventMessage = '스티커'; break; diff --git a/projects/ucap-webmessenger-protocol-room/src/lib/protocols/update.ts b/projects/ucap-webmessenger-protocol-room/src/lib/protocols/update.ts index d191ec6c..421544ea 100644 --- a/projects/ucap-webmessenger-protocol-room/src/lib/protocols/update.ts +++ b/projects/ucap-webmessenger-protocol-room/src/lib/protocols/update.ts @@ -32,6 +32,17 @@ export interface UpdateResponse extends ProtocolResponse { syncAll: boolean; } +export interface UpdateNotification extends ProtocolNotification { + /** 대화방SEQ(s) */ + roomSeq: string; + /** 대화방제목(s) */ + roomName: string; + /** 알람여부(y) */ + receiveAlarm: boolean; + /** 동기화여부(s) */ + syncAll: boolean; +} + export const encodeUpdate: ProtocolEncoder = ( req: UpdateRequest ) => { @@ -61,6 +72,17 @@ export const decodeUpdate: ProtocolDecoder = ( } as UpdateResponse); }; +export const decodeUpdateNotification: ProtocolDecoder = ( + message: ProtocolMessage +) => { + return decodeProtocolMessage(message, { + roomSeq: message.bodyList[0], + roomName: message.bodyList[1], + receiveAlarm: message.bodyList[2] === 'Y' ? true : false, + syncAll: message.bodyList[3] === 'Y' ? true : false + } as UpdateNotification); +}; + export interface UpdateTimerSetRequest extends ProtocolRequest { // 대화방SEQ(s) roomSeq: string; diff --git a/projects/ucap-webmessenger-protocol-room/src/lib/services/room-protocol.service.ts b/projects/ucap-webmessenger-protocol-room/src/lib/services/room-protocol.service.ts index 4172c13e..fb658e50 100644 --- a/projects/ucap-webmessenger-protocol-room/src/lib/services/room-protocol.service.ts +++ b/projects/ucap-webmessenger-protocol-room/src/lib/services/room-protocol.service.ts @@ -26,7 +26,8 @@ import { SSVC_TYPE_ROOM_INVITE_NOTI, SSVC_TYPE_ROOM_EXIT_NOTI, SSVC_TYPE_ROOM_EXIT_FORCING_NOTI, - SSVC_TYPE_ROOM_FONT_UPD_NOTI + SSVC_TYPE_ROOM_FONT_UPD_NOTI, + SSVC_TYPE_ROOM_UPD_RES } from '../types/service'; import { OpenRequest, @@ -127,6 +128,11 @@ export class RoomProtocolService { filter(message => message.serviceType === SVC_TYPE_ROOM), tap(message => { switch (message.subServiceType) { + case SSVC_TYPE_ROOM_UPD_RES: + { + this.notificationSubject.next(decodeUpdate(message)); + } + break; case SSVC_TYPE_ROOM_INVITE_NOTI: { this.notificationSubject.next( diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts index baa534eb..082815b0 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.ts @@ -85,6 +85,7 @@ export class MessagesComponent implements OnInit { /** * 정보성 Event 인지 판단. * @description 정보성 event 일 경우 프로필, 일시 를 표현하지 않는다. + * Edit with reducers.ts / sync / updateRoomForNewEventMessage */ getIsInformation(info: Info) { if (