From 6a852b4a1a95e873afaee450fd16a9001c288030 Mon Sep 17 00:00:00 2001 From: leejh Date: Tue, 15 Oct 2019 11:50:23 +0900 Subject: [PATCH] =?UTF-8?q?1.=20=ED=83=80=EC=9D=B4=EB=A8=B8=EB=8C=80?= =?UTF-8?q?=ED=99=94=EB=B0=A9=20=EC=A0=95=EB=B3=B4=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC.=202.=20=EC=A0=95=EB=B3=B4=EC=84=B1=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=B6=84=EB=A6=AC=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC.=203.=20=EB=8C=80=ED=99=94=20=ED=9A=8C=EC=88=98=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/messages.component.html | 4 + .../message-box/information.component.ts | 55 +++++++++ .../message-box/recall.component.html | 3 + .../lib/components/messages.component.html | 106 ++++++++++-------- .../src/lib/components/messages.component.ts | 17 +++ 5 files changed, 138 insertions(+), 47 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html index 6f5a0d46..71564180 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html @@ -34,6 +34,10 @@
+ + 비밀 대화방입니다. + + diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.ts b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.ts index 7c3947d8..56e15a84 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.ts +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/information.component.ts @@ -10,6 +10,8 @@ import { Info, EventType } from '@ucap-webmessenger/protocol-event'; export class InformationComponent implements OnInit { @Input() message: Info; + @Input() + senderName?: string; contents: string; @@ -32,6 +34,59 @@ export class InformationComponent implements OnInit { case EventType.Exit: this.contents = `${this.message.sentMessage}님이 퇴장하셨습니다.`; break; + case EventType.RenameRoom: + this.contents = `${this.message.sentMessage.substring( + 0, + this.message.sentMessage.indexOf(',') + )}님이 대화방명을 '${this.message.sentMessage.substring( + this.message.sentMessage.indexOf(',') + 1 + )}'으로 변경하셨습니다.`; + break; + case EventType.NotificationForTimerRoom: + /** + * 타이머대화방 알림으로서 채팅 이벤트에서 처리하지 않고, 대화방 글로벌에서 처리. + */ + this.contents = this.message.sentMessage; + break; + case EventType.GuideForRoomTimerChanged: + const values = this.message.sentMessage.split(','); + if (values && values.length === 2) { + this.contents = `${ + this.senderName + }님이 타이머를 설정하였습니다.(${this.getCalcTimer( + Number(values[1]) * 1000 + )})`; + } + break; + } + } + + getCalcTimer(millisec: number) { + switch (millisec) { + case 5000: + return '5 초'; + case 10000: + return '10 초'; + case 30000: + return '30 초'; + case 60000: + return '1 분'; + case 300000: + return '5 분'; + case 600000: + return '10 분'; + case 1800000: + return '30 분'; + case 3600000: + return '1 시간'; + case 21600000: + return '6 시간'; + case 43200000: + return '12 시간'; + case 86400000: + return '24 시간'; + default: + return '0 초'; } } } diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/recall.component.html b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/recall.component.html index e69de29b..b520dfd4 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/recall.component.html +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/message-box/recall.component.html @@ -0,0 +1,3 @@ +

+ 회수된 메시지 +

diff --git a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html index acc4d56b..eb7b78e3 100644 --- a/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html +++ b/projects/ucap-webmessenger-ui-chat/src/lib/components/messages.component.html @@ -4,59 +4,71 @@ me: message.senderSeq === loginRes.userSeq, contact: message.senderSeq !== loginRes.userSeq }"> + -
-
    -
  • - -
  • -
  • - {{ getUserName(message.senderSeq) }} -
  • -
-
- - - - - - - - - - - - - -
- mass-translation - - notice - - recall - - - translation - - video-conference - - -
- {{ message.sentMessage }} -
+
+ + + + + + + + + + + + + +
+
    +
  • + +
  • +
  • + {{ getUserName(message.senderSeq) }} +
  • +
- -
+ + + + + + + + + + + +
+ mass-translation + + notice + + + translation + + video-conference + + +
+ {{ message.sentMessage }} +
+
+
+
{{ message.sendDate | date: 'a hh:mm' }}
-
- - +
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 666f505f..4aff3239 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 @@ -72,6 +72,23 @@ export class MessagesComponent implements OnInit { return ''; } + /** + * 정보성 Event 인지 판단. + * @description 정보성 event 일 경우 프로필, 일시 를 표현하지 않는다. + */ + getIsInformation(info: Info) { + if ( + info.type === EventType.Join || + info.type === EventType.Exit || + info.type === EventType.RenameRoom || + info.type === EventType.NotificationForTimerRoom || + info.type === EventType.GuideForRoomTimerChanged + ) { + return true; + } + return false; + } + /** Date Splitter check */ getDateSplitter(curIndex: number): boolean { if (curIndex === 0) {