다른디바이스와의 Sync 처리. ::: ROOM_UPT_RES

This commit is contained in:
leejh 2019-10-29 10:46:55 +09:00
parent 7d6ebad5d5
commit 72a6b5b931
5 changed files with 68 additions and 3 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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<UpdateRequest> = (
req: UpdateRequest
) => {
@ -61,6 +72,17 @@ export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
} as UpdateResponse);
};
export const decodeUpdateNotification: ProtocolDecoder<UpdateNotification> = (
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;

View File

@ -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(

View File

@ -85,6 +85,7 @@ export class MessagesComponent implements OnInit {
/**
* Event .
* @description event , .
* Edit with reducers.ts / sync / updateRoomForNewEventMessage
*/
getIsInformation(info: Info) {
if (