2019-10-14 15:34:00 +09:00
|
|
|
import { Component, OnInit, Input } from '@angular/core';
|
|
|
|
import { Info } from '@ucap-webmessenger/protocol-event';
|
|
|
|
import { NGXLogger } from 'ngx-logger';
|
|
|
|
import { StickerInfo } from '../../models/sticker-info.json';
|
2019-10-07 13:49:12 +09:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'ucap-chat-message-box-sticker',
|
|
|
|
templateUrl: './sticker.component.html',
|
|
|
|
styleUrls: ['./sticker.component.scss']
|
|
|
|
})
|
|
|
|
export class StickerComponent implements OnInit {
|
2019-10-14 15:34:00 +09:00
|
|
|
@Input()
|
|
|
|
message: Info;
|
2019-10-07 13:49:12 +09:00
|
|
|
|
2019-10-14 15:34:00 +09:00
|
|
|
contentJson?: StickerInfo;
|
|
|
|
stickerUrl?: string;
|
|
|
|
constructor(private logger: NGXLogger) {}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
try {
|
|
|
|
this.contentJson = JSON.parse(this.message.sentMessage);
|
|
|
|
if (!!this.contentJson.file) {
|
|
|
|
this.stickerUrl = `assets/sticker/sticker_s_${this.contentJson.file}.png`;
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
this.logger.error(e);
|
|
|
|
}
|
|
|
|
}
|
2019-10-07 13:49:12 +09:00
|
|
|
}
|