2019-10-14 15:33:21 +09:00
|
|
|
import { Component, OnInit, Input } from '@angular/core';
|
|
|
|
import { NGXLogger } from 'ngx-logger';
|
|
|
|
import { Info, EventType } from '@ucap-webmessenger/protocol-event';
|
2019-10-07 13:49:12 +09:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'ucap-chat-message-box-information',
|
|
|
|
templateUrl: './information.component.html',
|
|
|
|
styleUrls: ['./information.component.scss']
|
|
|
|
})
|
|
|
|
export class InformationComponent implements OnInit {
|
2019-10-14 15:33:21 +09:00
|
|
|
@Input()
|
|
|
|
message: Info;
|
2019-10-07 13:49:12 +09:00
|
|
|
|
2019-10-14 15:33:21 +09:00
|
|
|
contents: string;
|
|
|
|
|
|
|
|
constructor(private logger: NGXLogger) {}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
switch (this.message.type) {
|
|
|
|
case EventType.Join:
|
|
|
|
let owner: string;
|
|
|
|
const inviter: string[] = [];
|
|
|
|
this.message.sentMessage.split(',').forEach((userName, idx) => {
|
|
|
|
if (idx === 0) {
|
|
|
|
owner = userName + '님';
|
|
|
|
} else {
|
|
|
|
inviter.push(userName + '님');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.contents = `${owner}이 ${inviter.join(',')}을 초대했습니다.`;
|
|
|
|
break;
|
|
|
|
case EventType.Exit:
|
|
|
|
this.contents = `${this.message.sentMessage}님이 퇴장하셨습니다.`;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-10-07 13:49:12 +09:00
|
|
|
}
|