From edcf2a48cd4a3120f0b3fc5bac54a6e60cd30dfb Mon Sep 17 00:00:00 2001 From: leejinho Date: Wed, 8 Jan 2020 16:53:57 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=EC=AA=BD=EC=A7=80=20=EB=B0=9C=EC=86=A1=20?= =?UTF-8?q?=EC=B7=A8=EC=86=8C=EC=97=90=20=EB=8C=80=ED=95=9C=20NOTI=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=20>>=20noti=20=EB=82=B4=EC=9A=A9=EC=A4=91?= =?UTF-8?q?=EC=97=90=20=EC=82=AD=EC=A0=9C=EB=90=9C=20=EC=AA=BD=EC=A7=80=20?= =?UTF-8?q?seq=20=EA=B0=80=20=EB=82=B4=EB=A0=A4=EC=99=80=EC=95=BC=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20=EC=9E=91=EC=97=85=EC=9D=84=20=EB=A7=88?= =?UTF-8?q?=EC=A0=80=20=ED=95=A0=20=EC=88=98=20=EC=9E=88=EC=9D=8C=20(?= =?UTF-8?q?=EC=9D=B4=EC=B6=A9=EC=97=B4c)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/app/services/notification.service.ts | 22 +++++++++++- .../src/lib/protocols/del-noti.ts | 36 +++++++++++++++++++ .../src/lib/services/umg-protocol.service.ts | 20 +++++++++-- .../src/public-api.ts | 1 + 4 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 projects/ucap-webmessenger-protocol-umg/src/lib/protocols/del-noti.ts 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 2a48dbe0..14963bbb 100644 --- a/projects/ucap-webmessenger-app/src/app/services/notification.service.ts +++ b/projects/ucap-webmessenger-app/src/app/services/notification.service.ts @@ -96,7 +96,9 @@ import { StringUtil } from '@ucap-webmessenger/ui'; import { UmgProtocolService, SSVC_TYPE_UMG_NOTI, - UmgNotiNotification + UmgNotiNotification, + SSVC_TYPE_UMG_DELETE_NOTI, + UmgDeleteNotiNotification } from '@ucap-webmessenger/protocol-umg'; import { LocalStorageService, @@ -647,6 +649,24 @@ export class AppNotificationService { } } 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: break; } diff --git a/projects/ucap-webmessenger-protocol-umg/src/lib/protocols/del-noti.ts b/projects/ucap-webmessenger-protocol-umg/src/lib/protocols/del-noti.ts new file mode 100644 index 00000000..2dd105be --- /dev/null +++ b/projects/ucap-webmessenger-protocol-umg/src/lib/protocols/del-noti.ts @@ -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 = ( + 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); +}; diff --git a/projects/ucap-webmessenger-protocol-umg/src/lib/services/umg-protocol.service.ts b/projects/ucap-webmessenger-protocol-umg/src/lib/services/umg-protocol.service.ts index 5e08eacc..91fa71ec 100644 --- a/projects/ucap-webmessenger-protocol-umg/src/lib/services/umg-protocol.service.ts +++ b/projects/ucap-webmessenger-protocol-umg/src/lib/services/umg-protocol.service.ts @@ -6,9 +6,17 @@ import { } from '../protocols/noti'; import { ProtocolService } from '@ucap-webmessenger/protocol'; 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({ providedIn: 'root' @@ -34,6 +42,14 @@ export class UmgProtocolService { } break; + case SSVC_TYPE_UMG_DELETE_NOTI: + { + this.notificationSubject.next( + decodeUmgDeleteNotiNotification(message) + ); + } + break; + default: break; } diff --git a/projects/ucap-webmessenger-protocol-umg/src/public-api.ts b/projects/ucap-webmessenger-protocol-umg/src/public-api.ts index 4e2e7302..b6ba2f74 100644 --- a/projects/ucap-webmessenger-protocol-umg/src/public-api.ts +++ b/projects/ucap-webmessenger-protocol-umg/src/public-api.ts @@ -4,6 +4,7 @@ export * from './lib/models/sender-info'; +export * from './lib/protocols/del-noti'; export * from './lib/protocols/noti'; export * from './lib/services/umg-protocol.service'; From 8ae5e6831c59da74e3808a243c6e1bcfcea24653 Mon Sep 17 00:00:00 2001 From: leejinho Date: Wed, 8 Jan 2020 16:54:37 +0900 Subject: [PATCH 2/2] =?UTF-8?q?#=20=EC=9D=B4=EC=8A=88=EC=82=AC=ED=95=AD=20?= =?UTF-8?q?133=20=EC=AA=BD=EC=B0=8C=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=ED=99=94=EB=A9=B4=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A7=8C=20=EB=B3=B4=EC=97=AC?= =?UTF-8?q?=EC=A3=BC=EC=A7=80=20=EC=95=8A=EC=9D=8C=20::=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=EB=8A=94=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=EB=A7=8C=20=EB=B3=B4=EC=97=AC=EC=A7=80=EA=B3=A0,=20=EC=B2=A8?= =?UTF-8?q?=EB=B6=80=ED=8C=8C=EC=9D=BC=EC=9D=80=20=EC=A0=84=EC=B2=B4?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EC=9D=84=20=EC=84=A0=ED=83=9D=ED=95=A0=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/components/write.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts index 323cafd9..1e0f69eb 100644 --- a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts +++ b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts @@ -151,6 +151,7 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { } onClickImage() { + this.fileInput.nativeElement.setAttribute('accept', 'image/*'); this.fileInput.nativeElement.click(); const self = this; this.fileInput.nativeElement.onchange = async () => { @@ -172,6 +173,7 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { } onClickAttachment() { + this.fileInput.nativeElement.removeAttribute('accept'); this.fileInput.nativeElement.click(); const self = this; this.fileInput.nativeElement.onchange = () => { @@ -519,7 +521,7 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { employeeType: EmployeeType.Regular, nickName: '', - order:'' + order: '' }; } }