bugfix 스티커 버그 수정.
This commit is contained in:
parent
81f871bea3
commit
f33df67724
|
@ -0,0 +1,5 @@
|
|||
export enum MessageSearchType {
|
||||
Title = 'T',
|
||||
Name = 'N',
|
||||
Contents = 'C'
|
||||
}
|
|
@ -43,12 +43,16 @@ import * as ChatStore from '@app/store/messenger/chat';
|
|||
import * as RoomStore from '@app/store/messenger/room';
|
||||
import * as SyncStore from '@app/store/messenger/sync';
|
||||
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
||||
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||
import {
|
||||
SessionStorageService,
|
||||
LocalStorageService
|
||||
} from '@ucap-webmessenger/web-storage';
|
||||
import {
|
||||
EnvironmentsInfo,
|
||||
KEY_ENVIRONMENTS_INFO,
|
||||
UserSelectDialogType,
|
||||
RightDrawer
|
||||
RightDrawer,
|
||||
KEY_STICKER_HISTORY
|
||||
} from '@app/types';
|
||||
import { RoomInfo, UserInfo, RoomType } from '@ucap-webmessenger/protocol-room';
|
||||
import { tap, take, map, catchError } from 'rxjs/operators';
|
||||
|
@ -83,7 +87,9 @@ import {
|
|||
CONST,
|
||||
FileUtil,
|
||||
StickerFilesInfo,
|
||||
StickerUtil
|
||||
StickerUtil,
|
||||
StickerInfo,
|
||||
StickerMap
|
||||
} from '@ucap-webmessenger/core';
|
||||
import { PerfectScrollbarComponent } from 'ngx-perfect-scrollbar';
|
||||
import { StatusCode } from '@ucap-webmessenger/api';
|
||||
|
@ -162,6 +168,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
constructor(
|
||||
private store: Store<any>,
|
||||
private sessionStorageService: SessionStorageService,
|
||||
private localStorageService: LocalStorageService,
|
||||
private commonApiService: CommonApiService,
|
||||
private clipboardService: ClipboardService,
|
||||
private dialogService: DialogService,
|
||||
|
@ -198,7 +205,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
select(AppStore.MessengerSelector.RoomSelector.roomInfo),
|
||||
tap(roomInfo => {
|
||||
this.roomInfo = roomInfo;
|
||||
|
||||
this.clearView();
|
||||
this.setEventMoreInit();
|
||||
})
|
||||
)
|
||||
|
@ -535,7 +542,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
})
|
||||
);
|
||||
this.isShowStickerSelector = false;
|
||||
StickerUtil.setStickerHistory(this.selectedSticker);
|
||||
this.setStickerHistory(this.selectedSticker);
|
||||
} else if (message.trim().length > CONST.MASSTEXT_LEN) {
|
||||
// MASS TEXT
|
||||
this.store.dispatch(
|
||||
|
@ -1091,4 +1098,24 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
onSelectedSticker(stickerInfo: StickerFilesInfo) {
|
||||
this.selectedSticker = stickerInfo;
|
||||
}
|
||||
setStickerHistory(sticker: StickerFilesInfo) {
|
||||
const history = this.localStorageService.get<string[]>(KEY_STICKER_HISTORY);
|
||||
|
||||
if (!!history && history.length > 0) {
|
||||
const stickers: string[] = [];
|
||||
[sticker.index, ...history.filter(hist => hist !== sticker.index)].map(
|
||||
(s, i) => {
|
||||
if (i < 10) {
|
||||
stickers.push(s);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
this.localStorageService.set<string[]>(KEY_STICKER_HISTORY, stickers);
|
||||
} else {
|
||||
this.localStorageService.set<string[]>(KEY_STICKER_HISTORY, [
|
||||
sticker.index
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,3 +2,4 @@ export * from './environment.type';
|
|||
export * from './login-info.type';
|
||||
export * from './userselect.dialog.type';
|
||||
export * from './right-drawer.type';
|
||||
export * from './sticker-info.type';
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { LocalStorageService } from '@ucap-webmessenger/web-storage';
|
||||
|
||||
export interface StickerInfo {
|
||||
index: string;
|
||||
title: string;
|
||||
|
@ -12,7 +10,7 @@ export interface StickerFilesInfo {
|
|||
index: string;
|
||||
path: string;
|
||||
}
|
||||
const StickerMap: StickerInfo[] = [
|
||||
export const StickerMap: StickerInfo[] = [
|
||||
{
|
||||
index: '00',
|
||||
title: 'History',
|
||||
|
@ -152,11 +150,6 @@ export class StickerUtil {
|
|||
);
|
||||
|
||||
if (!!stickerInfos && stickerInfos.length > 0) {
|
||||
if (idx === '00') {
|
||||
// history.
|
||||
stickerInfos[0].fileInfos = this.getStickerHistory();
|
||||
}
|
||||
|
||||
rtnStickerList.push(stickerInfos[0]);
|
||||
}
|
||||
});
|
||||
|
@ -176,50 +169,4 @@ export class StickerUtil {
|
|||
|
||||
return stickerFilesList;
|
||||
}
|
||||
|
||||
static setStickerHistory(sticker: StickerFilesInfo) {
|
||||
const localStorageService = new LocalStorageService();
|
||||
const history = localStorageService.get<string[]>('ucap::Sticker_History');
|
||||
|
||||
if (!!history && history.length > 0) {
|
||||
const stickers: string[] = [];
|
||||
[sticker.index, ...history.filter(hist => hist !== sticker.index)].map(
|
||||
(s, i) => {
|
||||
if (i < 10) {
|
||||
stickers.push(s);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
localStorageService.set<string[]>('ucap::Sticker_History', stickers);
|
||||
} else {
|
||||
localStorageService.set<string[]>('ucap::Sticker_History', [
|
||||
sticker.index
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
static getStickerHistory(): StickerFilesInfo[] {
|
||||
const rtnArray: StickerFilesInfo[] = [];
|
||||
const localStorageService = new LocalStorageService();
|
||||
const history = localStorageService.get<string[]>('ucap::Sticker_History');
|
||||
if (!!history && history.length > 0) {
|
||||
history.forEach(sticker => {
|
||||
const arr: string[] = sticker.split('_');
|
||||
if (arr.length === 2) {
|
||||
const sInfo: StickerInfo[] = StickerMap.filter(
|
||||
stickerInfo => stickerInfo.index === arr[0]
|
||||
);
|
||||
if (!!sInfo && sInfo.length > 0) {
|
||||
rtnArray.push(
|
||||
...sInfo[0].fileInfos.filter(
|
||||
fileInfo => fileInfo.index === sticker
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return rtnArray;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</ng-template>
|
||||
<div fxFlex fxLayout="row" fxLayoutGap="10px">
|
||||
<div
|
||||
*ngFor="let sticker of stickerInfo.fileInfos"
|
||||
*ngFor="let sticker of getStickerInfos(stickerInfo)"
|
||||
(click)="onClickSelectSticker(sticker)"
|
||||
class="sticker-item"
|
||||
>
|
||||
|
|
|
@ -2,8 +2,11 @@ import { Component, OnInit, Output, EventEmitter } from '@angular/core';
|
|||
import {
|
||||
StickerInfo,
|
||||
StickerFilesInfo,
|
||||
StickerUtil
|
||||
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',
|
||||
|
@ -21,7 +24,7 @@ export class StickerSelectorComponent implements OnInit {
|
|||
|
||||
currentTabIndex: number;
|
||||
|
||||
constructor() {}
|
||||
constructor(private localStorageService: LocalStorageService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.stickerInfoList = StickerUtil.getStickerInfoList();
|
||||
|
@ -48,6 +51,35 @@ 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 => {
|
||||
const arr: string[] = sticker.split('_');
|
||||
if (arr.length === 2) {
|
||||
const sInfo: StickerInfo[] = StickerMap.filter(
|
||||
s => s.index === arr[0]
|
||||
);
|
||||
if (!!sInfo && sInfo.length > 0) {
|
||||
rtnArray.push(
|
||||
...sInfo[0].fileInfos.filter(
|
||||
fileInfo => fileInfo.index === sticker
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return rtnArray;
|
||||
} else {
|
||||
return stickerInfo.fileInfos;
|
||||
}
|
||||
}
|
||||
|
||||
getStickerContentsImage(sticker: StickerFilesInfo) {
|
||||
return this.stickerBasePath + sticker.path;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user