Merge branch 'master' of http://10.81.13.221:6990/Web/next-ucap-messenger
This commit is contained in:
commit
664a92781f
|
@ -148,10 +148,34 @@ export const decodeRetrieveReservation: APIDecoder<RetrieveResponse> = (
|
|||
export const decodeRetrieveSearch: APIDecoder<RetrieveResponse> = (
|
||||
res: any
|
||||
) => {
|
||||
const messageList: MessageList[] = [];
|
||||
if (!!res.msgList && res.msgList.length > 0) {
|
||||
for (const msgList of res.msgList) {
|
||||
messageList.push({
|
||||
...msgList,
|
||||
|
||||
userCount:
|
||||
!msgList.userCount || msgList.userCount === null
|
||||
? 0
|
||||
: msgList.userCount,
|
||||
userReadCount:
|
||||
!msgList.userReadCount || msgList.userReadCount === null
|
||||
? 0
|
||||
: msgList.userReadCount,
|
||||
titleYn: msgList.titleYn === 'Y' ? true : false,
|
||||
attachmentYn: msgList.attachmentYn === 'Y' ? true : false
|
||||
} as MessageList);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
responseCode: res.responseCode,
|
||||
responseMsg: res.responseMsg,
|
||||
|
||||
pageCount: res.pageCount,
|
||||
pageSize: res.pageSize,
|
||||
totalCount: res.totalCount,
|
||||
messageList: []
|
||||
|
||||
messageList
|
||||
} as RetrieveResponse;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
export enum MessageSearchType {
|
||||
Title = 'T',
|
||||
Name = 'N',
|
||||
Contents = 'C'
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
export enum MessageType {
|
||||
Send = 'S',
|
||||
Receive = 'R',
|
||||
Reservation = 'B'
|
||||
Reservation = 'B',
|
||||
All = 'A'
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ export * from './lib/models/message-list';
|
|||
|
||||
export * from './lib/types/category.type';
|
||||
export * from './lib/types/content.type';
|
||||
export * from './lib/types/message.search.type';
|
||||
export * from './lib/types/message.type';
|
||||
|
||||
export * from './lib/config/urls';
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div *ngIf="!isSearch">
|
||||
<mat-tab-group
|
||||
#tabs
|
||||
mat-stretch-tabs
|
||||
|
@ -143,4 +143,56 @@
|
|||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
<div *ngIf="isSearch">
|
||||
<div class="search-sub">
|
||||
<form [formGroup]="fgSearchType" class="w-100-p">
|
||||
<mat-form-field>
|
||||
<mat-select formControlName="searchMessageType" (selectionChange)="onChangeSelection($event)">
|
||||
<mat-option [value]="MessageType.All">전체</mat-option>
|
||||
<mat-option [value]="MessageType.Receive">수신</mat-option>
|
||||
<mat-option [value]="MessageType.Send">발신</mat-option>
|
||||
<mat-option [value]="MessageType.Reservation">예약</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-radio-group
|
||||
formControlName="searchMessageSearchType"
|
||||
aria-label="Select an searchType"
|
||||
(change)="onChangeSearchType($event)"
|
||||
>
|
||||
<mat-radio-button [value]="MessageSearchType.Name" [checked]="true"
|
||||
>이름</mat-radio-button
|
||||
>
|
||||
<mat-radio-button [value]="MessageSearchType.Title"
|
||||
>제목</mat-radio-button
|
||||
>
|
||||
<mat-radio-button [value]="MessageSearchType.Contents"
|
||||
>내용</mat-radio-button
|
||||
>
|
||||
</mat-radio-group>
|
||||
</form>
|
||||
</div>
|
||||
<div *ngFor="let message of messageList">
|
||||
<dl>
|
||||
<dt>
|
||||
<mat-icon
|
||||
*ngIf="!!message.resType && message.resType === ContentType.Image"
|
||||
>image</mat-icon
|
||||
>
|
||||
<mat-icon
|
||||
*ngIf="
|
||||
!!message.resType && message.resType === ContentType.AttachFile
|
||||
"
|
||||
>attach_file</mat-icon
|
||||
>
|
||||
<ul>
|
||||
<li>{{ message.userName }}</li>
|
||||
<li>{{ message.title }}</li>
|
||||
</ul>
|
||||
</dt>
|
||||
<dd>
|
||||
{{ message.regDate | dateToStringFormat: 'MM:DD' }}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -25,13 +25,19 @@ import {
|
|||
MessageApiService,
|
||||
MessageType,
|
||||
RetrieveRequest,
|
||||
MessageList
|
||||
MessageList,
|
||||
RetrieveSearchRequest,
|
||||
MessageSearchType
|
||||
} from '@ucap-webmessenger/api-message';
|
||||
import { DeviceType } from '@ucap-webmessenger/core';
|
||||
import { MessageStatusCode } from '@ucap-webmessenger/api';
|
||||
import { ContentType } from '@ucap-webmessenger/api-message';
|
||||
import { FormGroup, FormBuilder } from '@angular/forms';
|
||||
import { MatTabGroup } from '@angular/material';
|
||||
import {
|
||||
MatTabGroup,
|
||||
MatSelectChange,
|
||||
MatRadioChange
|
||||
} from '@angular/material';
|
||||
|
||||
@Component({
|
||||
selector: 'app-layout-chat-left-sidenav-message',
|
||||
|
@ -47,9 +53,7 @@ export class MessageBoxComponent
|
|||
isInitTabs = false;
|
||||
|
||||
fgSearch: FormGroup;
|
||||
|
||||
userInfoList: UserInfo[];
|
||||
userInfoListSubscription: Subscription;
|
||||
fgSearchType: FormGroup;
|
||||
|
||||
loginRes: LoginResponse;
|
||||
sessionVerinfo: VersionInfo2Response;
|
||||
|
@ -72,6 +76,9 @@ export class MessageBoxComponent
|
|||
|
||||
ContentType = ContentType;
|
||||
MessageType = MessageType;
|
||||
MessageSearchType = MessageSearchType;
|
||||
|
||||
isSearch = false;
|
||||
|
||||
constructor(
|
||||
private store: Store<any>,
|
||||
|
@ -92,15 +99,10 @@ export class MessageBoxComponent
|
|||
this.fgSearch = this.formBuilder.group({
|
||||
searchInput: null
|
||||
});
|
||||
|
||||
this.userInfoListSubscription = this.store
|
||||
.pipe(
|
||||
select(AppStore.MessengerSelector.RoomSelector.selectUserinfolist),
|
||||
tap(userInfoList => {
|
||||
this.userInfoList = userInfoList;
|
||||
})
|
||||
)
|
||||
.subscribe();
|
||||
this.fgSearchType = this.formBuilder.group({
|
||||
searchMessageType: [MessageType.All],
|
||||
searchMessageSearchType: [MessageSearchType.Name]
|
||||
});
|
||||
|
||||
// 초기 검색은 수신함.
|
||||
this.getRetrieveMessage(MessageType.Receive, this.recieveCurrentPage);
|
||||
|
@ -118,9 +120,6 @@ export class MessageBoxComponent
|
|||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (!!this.userInfoListSubscription) {
|
||||
this.userInfoListSubscription.unsubscribe();
|
||||
}
|
||||
if (!!this.messageRecieveListSubscription) {
|
||||
this.messageRecieveListSubscription.unsubscribe();
|
||||
}
|
||||
|
@ -161,12 +160,74 @@ export class MessageBoxComponent
|
|||
}
|
||||
}
|
||||
|
||||
onChangeSelection(event: MatSelectChange) {
|
||||
this.searchCurrentPage = 0;
|
||||
this.getSearchMessage(
|
||||
event.value,
|
||||
this.fgSearchType.get('searchMessageSearchType').value,
|
||||
this.fgSearch.get('searchInput').value
|
||||
);
|
||||
}
|
||||
onChangeSearchType(event: MatRadioChange) {
|
||||
this.searchCurrentPage = 0;
|
||||
this.getSearchMessage(
|
||||
this.fgSearchType.get('searchMessageType').value,
|
||||
event.value,
|
||||
this.fgSearch.get('searchInput').value
|
||||
);
|
||||
}
|
||||
onKeyDownEnter(event: KeyboardEvent, search: string) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
this.searchCurrentPage = 0;
|
||||
|
||||
this.getSearchMessage(
|
||||
MessageType.All,
|
||||
MessageSearchType.Name,
|
||||
search.trim()
|
||||
);
|
||||
}
|
||||
getSearchMessage(
|
||||
messageType: MessageType,
|
||||
searchType: MessageSearchType,
|
||||
searchStr: string
|
||||
) {
|
||||
this.isSearch = true;
|
||||
this.messageSendListSubscription = this.messageApiService
|
||||
.retrieveSearchMessage({
|
||||
userSeq: this.loginRes.userSeq,
|
||||
deviceType: DeviceType.PC,
|
||||
tokenKey: this.loginRes.tokenString,
|
||||
type: messageType,
|
||||
pageSize: this.defaultPageSize,
|
||||
pageCount: this.searchCurrentPage,
|
||||
|
||||
searchTitle: searchType === MessageSearchType.Title ? searchStr : '',
|
||||
searchName: searchType === MessageSearchType.Name ? searchStr : '',
|
||||
searchContent:
|
||||
searchType === MessageSearchType.Contents ? searchStr : ''
|
||||
} as RetrieveSearchRequest)
|
||||
.pipe(
|
||||
map(res => {
|
||||
console.log(res);
|
||||
if (res.responseCode === MessageStatusCode.Success) {
|
||||
this.currentTotalCount = res.totalCount;
|
||||
this.currentPage = res.pageCount;
|
||||
this.searchCurrentPage = res.pageCount;
|
||||
this.messageList = res.messageList;
|
||||
} else {
|
||||
}
|
||||
}),
|
||||
catchError(error => of(console.log(error)))
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
onClickSearchCancel() {}
|
||||
onClickSearchCancel() {
|
||||
this.isSearch = false;
|
||||
this.getRetrieveMessage(MessageType.Receive, this.recieveCurrentPage);
|
||||
}
|
||||
|
||||
getRetrieveMessage(type: MessageType, trgtPageIndex: number) {
|
||||
switch (type) {
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export const KEY_STICKER_HISTORY = 'ucap::Sticker_History';
|
|
@ -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