쪽지 발송 취소에 대한 NOTI 작업 >> noti 내용중에 삭제된 쪽지 seq 가 내려와야 삭제 작업을 마저 할 수 있음 (이충열c)

This commit is contained in:
leejinho 2020-01-08 16:53:57 +09:00
parent 2c0a331d26
commit edcf2a48cd
4 changed files with 76 additions and 3 deletions

View File

@ -96,7 +96,9 @@ import { StringUtil } from '@ucap-webmessenger/ui';
import { import {
UmgProtocolService, UmgProtocolService,
SSVC_TYPE_UMG_NOTI, SSVC_TYPE_UMG_NOTI,
UmgNotiNotification UmgNotiNotification,
SSVC_TYPE_UMG_DELETE_NOTI,
UmgDeleteNotiNotification
} from '@ucap-webmessenger/protocol-umg'; } from '@ucap-webmessenger/protocol-umg';
import { import {
LocalStorageService, LocalStorageService,
@ -647,6 +649,24 @@ export class AppNotificationService {
} }
} }
break; break;
case SSVC_TYPE_UMG_DELETE_NOTI:
{
const noti = notiOrRes as UmgDeleteNotiNotification;
this.logger.debug(
'Notification::umgProtocolService::UmgDeleteNotiNotification',
noti
);
console.log('TODO :: remove state logic');
// // Receive Message List refresh..
// this.store.dispatch(
// MessageStore.retrieveMessage({
// messageType: MessageType.Receive
// })
// );
}
break;
default: default:
break; break;
} }

View File

@ -0,0 +1,36 @@
import {
ProtocolDecoder,
ProtocolMessage,
BodyStringDivider,
ProtocolNotification,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol';
import { SenderInfo } from '../models/sender-info';
export interface UmgDeleteNotiNotification extends ProtocolNotification {
/** 송신자SEQ(n) */
senderSeq: number;
/** { 송신자정보 } */
senderInfo: SenderInfo;
}
export const decodeUmgDeleteNotiNotification: ProtocolDecoder<UmgDeleteNotiNotification> = (
message: ProtocolMessage
) => {
let senderInfo: SenderInfo;
if (message.bodyList.length > 1) {
const info = message.bodyList[1].split(BodyStringDivider);
senderInfo = {
seq: Number(info[0]),
name: info[1],
profileImageFile: info[2],
grade: info[3]
};
}
return decodeProtocolMessage(message, {
/** 송신자SEQ(n) */
senderSeq: Number(message.bodyList[0]),
/** { 송신자정보 } */
senderInfo
} as UmgDeleteNotiNotification);
};

View File

@ -6,9 +6,17 @@ import {
} from '../protocols/noti'; } from '../protocols/noti';
import { ProtocolService } from '@ucap-webmessenger/protocol'; import { ProtocolService } from '@ucap-webmessenger/protocol';
import { share, filter, tap } from 'rxjs/operators'; import { share, filter, tap } from 'rxjs/operators';
import { SVC_TYPE_UMG, SSVC_TYPE_UMG_NOTI } from '../types/service'; import {
SVC_TYPE_UMG,
SSVC_TYPE_UMG_NOTI,
SSVC_TYPE_UMG_DELETE_NOTI
} from '../types/service';
import {
decodeUmgDeleteNotiNotification,
UmgDeleteNotiNotification
} from '../protocols/del-noti';
type Notifications = UmgNotiNotification; type Notifications = UmgNotiNotification | UmgDeleteNotiNotification;
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@ -34,6 +42,14 @@ export class UmgProtocolService {
} }
break; break;
case SSVC_TYPE_UMG_DELETE_NOTI:
{
this.notificationSubject.next(
decodeUmgDeleteNotiNotification(message)
);
}
break;
default: default:
break; break;
} }

View File

@ -4,6 +4,7 @@
export * from './lib/models/sender-info'; export * from './lib/models/sender-info';
export * from './lib/protocols/del-noti';
export * from './lib/protocols/noti'; export * from './lib/protocols/noti';
export * from './lib/services/umg-protocol.service'; export * from './lib/services/umg-protocol.service';