참조관계 수정.

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