refactoring

This commit is contained in:
병준 박 2019-11-09 13:35:24 +09:00
parent f747490a7c
commit c40bd2484d
5 changed files with 71 additions and 70 deletions

View File

@ -17,7 +17,8 @@ import {
AlertDialogComponent,
AlertDialogData,
AlertDialogResult,
FileUploadQueueComponent
FileUploadQueueComponent,
StringUtil
} from '@ucap-webmessenger/ui';
import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger';
@ -73,7 +74,7 @@ import {
FileViewerDialogData,
FileViewerDialogResult
} from '@app/layouts/common/dialogs/file-viewer.dialog.component';
import { CONST, StringUtil, FileUtil } from '@ucap-webmessenger/core';
import { CONST, FileUtil } from '@ucap-webmessenger/core';
import { PerfectScrollbarComponent } from 'ngx-perfect-scrollbar';
import { StatusCode } from '@ucap-webmessenger/api';
import {

View File

@ -80,11 +80,11 @@ import * as SyncStore from '@app/store/messenger/sync';
import * as RoomStore from '@app/store/messenger/room';
import * as StatusStore from '@app/store/messenger/status';
import {
NotiRequest,
NotificationRequest,
NativeService,
UCAP_NATIVE_SERVICE
} from '@ucap-webmessenger/native';
import { StringUtil } from '@ucap-webmessenger/core';
import { StringUtil } from '@ucap-webmessenger/ui';
@Injectable()
export class AppNotificationService {
@ -153,7 +153,7 @@ export class AppNotificationService {
// notification..
if (notiOrRes.SSVC_TYPE === SSVC_TYPE_EVENT_SEND_NOTI) {
const notiReq: NotiRequest = {
const notiReq: NotificationRequest = {
roomSeq: noti.roomSeq,
title: '메세지가 도착했습니다.',
contents: StringUtil.convertFinalEventMessage(
@ -164,7 +164,7 @@ export class AppNotificationService {
useSound: true,
interval: 0
};
this.nativeService.showNotify(notiReq);
this.nativeService.notify(notiReq);
}
}
break;

View File

@ -28,7 +28,7 @@ import {
import * as RoomStore from '@app/store/messenger/room';
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
import { StringUtil } from '@ucap-webmessenger/core';
import { StringUtil } from '@ucap-webmessenger/ui';
export const reducer = createReducer(
initialState,

View File

@ -1,63 +1 @@
import {
EventType,
EventJson,
FileEventJson,
MassTextEventJson
} from '@ucap-webmessenger/protocol-event';
import { FileType } from '@ucap-webmessenger/protocol-file';
export class StringUtil {
public static convertFinalEventMessage(
eventType: EventType,
finalEventMessage: EventJson
): string | null {
let eventMessage: string = null;
switch (eventType) {
case EventType.Join:
case EventType.Exit:
case EventType.RenameRoom:
case EventType.NotificationForTimerRoom:
case EventType.GuideForRoomTimerChanged:
{
/**
* .
* @description Edit with ui-chat > messages.component.ts
*/
}
break;
case EventType.Sticker:
eventMessage = '스티커';
break;
case EventType.File:
{
const m = finalEventMessage as FileEventJson;
if (FileType.Image === m.fileType) {
eventMessage = '이미지';
} else {
eventMessage = '첨부파일';
}
}
break;
case EventType.VideoConference:
eventMessage = '화상회의';
break;
case EventType.MassText:
{
const m = finalEventMessage as MassTextEventJson;
eventMessage = m.content;
}
break;
default:
{
const m = finalEventMessage as string;
eventMessage = m;
}
break;
}
return eventMessage;
}
}
export class StringUtil {}

View File

@ -1,3 +1,11 @@
import {
EventType,
EventJson,
FileEventJson,
MassTextEventJson
} from '@ucap-webmessenger/protocol-event';
import { FileType } from '@ucap-webmessenger/protocol-file';
export class StringUtil {
/**
* linefeed > <br>
@ -134,4 +142,58 @@ export class StringUtil {
}
});
}
public static convertFinalEventMessage(
eventType: EventType,
finalEventMessage: EventJson
): string | null {
let eventMessage: string = null;
switch (eventType) {
case EventType.Join:
case EventType.Exit:
case EventType.RenameRoom:
case EventType.NotificationForTimerRoom:
case EventType.GuideForRoomTimerChanged:
{
/**
* .
* @description Edit with ui-chat > messages.component.ts
*/
}
break;
case EventType.Sticker:
eventMessage = '스티커';
break;
case EventType.File:
{
const m = finalEventMessage as FileEventJson;
if (FileType.Image === m.fileType) {
eventMessage = '이미지';
} else {
eventMessage = '첨부파일';
}
}
break;
case EventType.VideoConference:
eventMessage = '화상회의';
break;
case EventType.MassText:
{
const m = finalEventMessage as MassTextEventJson;
eventMessage = m.content;
}
break;
default:
{
const m = finalEventMessage as string;
eventMessage = m;
}
break;
}
return eventMessage;
}
}