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, AlertDialogComponent,
AlertDialogData, AlertDialogData,
AlertDialogResult, AlertDialogResult,
FileUploadQueueComponent FileUploadQueueComponent,
StringUtil
} from '@ucap-webmessenger/ui'; } from '@ucap-webmessenger/ui';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
@ -73,7 +74,7 @@ import {
FileViewerDialogData, FileViewerDialogData,
FileViewerDialogResult FileViewerDialogResult
} from '@app/layouts/common/dialogs/file-viewer.dialog.component'; } 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 { PerfectScrollbarComponent } from 'ngx-perfect-scrollbar';
import { StatusCode } from '@ucap-webmessenger/api'; import { StatusCode } from '@ucap-webmessenger/api';
import { 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 RoomStore from '@app/store/messenger/room';
import * as StatusStore from '@app/store/messenger/status'; import * as StatusStore from '@app/store/messenger/status';
import { import {
NotiRequest, NotificationRequest,
NativeService, NativeService,
UCAP_NATIVE_SERVICE UCAP_NATIVE_SERVICE
} from '@ucap-webmessenger/native'; } from '@ucap-webmessenger/native';
import { StringUtil } from '@ucap-webmessenger/core'; import { StringUtil } from '@ucap-webmessenger/ui';
@Injectable() @Injectable()
export class AppNotificationService { export class AppNotificationService {
@ -153,7 +153,7 @@ export class AppNotificationService {
// notification.. // notification..
if (notiOrRes.SSVC_TYPE === SSVC_TYPE_EVENT_SEND_NOTI) { if (notiOrRes.SSVC_TYPE === SSVC_TYPE_EVENT_SEND_NOTI) {
const notiReq: NotiRequest = { const notiReq: NotificationRequest = {
roomSeq: noti.roomSeq, roomSeq: noti.roomSeq,
title: '메세지가 도착했습니다.', title: '메세지가 도착했습니다.',
contents: StringUtil.convertFinalEventMessage( contents: StringUtil.convertFinalEventMessage(
@ -164,7 +164,7 @@ export class AppNotificationService {
useSound: true, useSound: true,
interval: 0 interval: 0
}; };
this.nativeService.showNotify(notiReq); this.nativeService.notify(notiReq);
} }
} }
break; break;

View File

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

View File

@ -1,63 +1 @@
import { export class StringUtil {}
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;
}
}

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 { export class StringUtil {
/** /**
* linefeed > <br> * 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;
}
} }