참조관계 수정.

This commit is contained in:
leejinho 2019-12-16 08:58:33 +09:00
parent 9079361aa5
commit ffb79c7de0
3 changed files with 12 additions and 9 deletions

View File

@ -200,6 +200,7 @@
<ucap-sticker-selector
*ngIf="isShowStickerSelector"
#stickerSelector
[stickerHistory]='getStickerHistory()'
(selectedSticker)="onSelectedSticker($event)"
class="sticker-selector-zone"
></ucap-sticker-selector>

View File

@ -1125,4 +1125,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
]);
}
}
getStickerHistory(): string[] {
return this.localStorageService.get<string[]>(KEY_STICKER_HISTORY);
}
}

View File

@ -1,12 +1,10 @@
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
import {
StickerInfo,
StickerFilesInfo,
StickerUtil,
StickerMap
} from '@ucap-webmessenger/core';
import { LocalStorageService } from '@ucap-webmessenger/web-storage';
import { KEY_STICKER_HISTORY } from '@app/types';
@Component({
selector: 'ucap-sticker-selector',
@ -14,6 +12,9 @@ import { KEY_STICKER_HISTORY } from '@app/types';
styleUrls: ['./sticker-selector.component.scss']
})
export class StickerSelectorComponent implements OnInit {
@Input()
stickerHistory: string[] = [];
@Output()
selectedSticker = new EventEmitter<StickerFilesInfo>();
@ -24,7 +25,7 @@ export class StickerSelectorComponent implements OnInit {
currentTabIndex: number;
constructor(private localStorageService: LocalStorageService) {}
constructor() {}
ngOnInit() {
this.stickerInfoList = StickerUtil.getStickerInfoList();
@ -54,11 +55,9 @@ export class StickerSelectorComponent implements OnInit {
getStickerInfos(stickerInfo: StickerInfo) {
if (stickerInfo.index === '00') {
const rtnArray: StickerFilesInfo[] = [];
const history = this.localStorageService.get<string[]>(
KEY_STICKER_HISTORY
);
if (!!history && history.length > 0) {
history.forEach(sticker => {
if (!!this.stickerHistory && this.stickerHistory.length > 0) {
this.stickerHistory.forEach(sticker => {
const arr: string[] = sticker.split('_');
if (arr.length === 2) {
const sInfo: StickerInfo[] = StickerMap.filter(