From a679f4b2b9d0044f267afe43cbbd0d6af876e4df Mon Sep 17 00:00:00 2001 From: leejh Date: Wed, 16 Oct 2019 09:01:03 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=A0=95=20::=20=EB=8C=80=ED=99=94=20?= =?UTF-8?q?>=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=EC=9D=98=20finalEventMessage=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 --- .../lib/components/list-item.component.html | 3 +- .../src/lib/components/list-item.component.ts | 66 ++++++++++++++++++- 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.html b/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.html index 5d48007e..9627bd11 100644 --- a/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.html +++ b/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.html @@ -1,5 +1,6 @@
{{ getRoomName(roomInfo) }}
{{ roomInfo.finalEventDate }}
-
{{ roomInfo.finalEventMessage }}
+
{{ finalEventMessage }}
+
noReadCnt : {{ roomInfo.noReadCnt }}
diff --git a/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.ts b/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.ts index c351e8f3..c98acf73 100644 --- a/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.ts +++ b/projects/ucap-webmessenger-ui-room/src/lib/components/list-item.component.ts @@ -2,10 +2,18 @@ import { Component, OnInit, Input } from '@angular/core'; import { RoomInfo, UserInfoShort, - UserInfo as RoomUserInfo + UserInfo as RoomUserInfo, + RoomType } from '@ucap-webmessenger/protocol-room'; import { NGXLogger } from 'ngx-logger'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; +import { EventType } from '@ucap-webmessenger/protocol-event'; +import { + FileInfo, + StickerInfo, + MassTextInfo +} from '@ucap-webmessenger/ui-chat'; +import { FileType } from '@ucap-webmessenger/protocol-file'; @Component({ selector: 'ucap-room-list-item', @@ -20,10 +28,60 @@ export class ListItemComponent implements OnInit { @Input() sessionVerinfo: VersionInfo2Response; + finalEventMessage: string; + constructor(private logger: NGXLogger) {} ngOnInit() { - // this.logger.debug(this.roomInfo); + if (this.roomInfo.isTimeRoom) { + this.finalEventMessage = '비밀 대화방입니다.'; + } else { + try { + switch (this.roomInfo.finalEventType) { + case EventType.File: + { + let msg = 'Attach File'; + const contentJson: FileInfo = JSON.parse( + this.roomInfo.finalEventMessage + ); + if (contentJson.FileType === FileType.File) { + msg = '첨부파일'; + } else if (contentJson.FileType === FileType.Image) { + msg = '이미지'; + } else if (contentJson.FileType === FileType.Video) { + msg = '동영상'; + } + this.finalEventMessage = msg; + } + break; + case EventType.Sticker: + { + let msg = '스티커'; + const contentJson: StickerInfo = JSON.parse( + this.roomInfo.finalEventMessage + ); + if (contentJson.chat) { + msg += ' ' + contentJson.chat; + } + this.finalEventMessage = msg; + } + break; + case EventType.MassText: + { + const contentJson: MassTextInfo = JSON.parse( + this.roomInfo.finalEventMessage + ); + this.finalEventMessage = contentJson.Content; + } + break; + default: + this.finalEventMessage = this.roomInfo.finalEventMessage; + } + } catch (e) { + this.logger.error(e); + this.finalEventMessage = this.roomInfo.finalEventMessage; + } + } } getRoomName(roomInfo: RoomInfo): string { @@ -31,6 +89,10 @@ export class ListItemComponent implements OnInit { return roomInfo.roomName; } + if (roomInfo.roomType === RoomType.Mytalk) { + return 'MyTalk'; + } + if (!!this.roomUserInfo && 0 < this.roomUserInfo.length) { let roomName = ''; this.roomUserInfo.forEach((roomUserInfo, index) => {