merged
This commit is contained in:
commit
337c7b9030
|
@ -4,8 +4,11 @@ import {
|
||||||
APIResponse,
|
APIResponse,
|
||||||
APIEncoder,
|
APIEncoder,
|
||||||
APIDecoder,
|
APIDecoder,
|
||||||
ParameterUtil
|
ParameterUtil,
|
||||||
|
JsonAnalization,
|
||||||
|
StatusCode
|
||||||
} from '@ucap-webmessenger/api';
|
} from '@ucap-webmessenger/api';
|
||||||
|
import { JsonObject } from 'type-fest';
|
||||||
|
|
||||||
export interface MassTalkDownloadRequest extends APIRequest {
|
export interface MassTalkDownloadRequest extends APIRequest {
|
||||||
userSeq: number;
|
userSeq: number;
|
||||||
|
@ -36,11 +39,19 @@ export const encodeMassTalkDownload: APIEncoder<MassTalkDownloadRequest> = (
|
||||||
export const decodeMassTalkDownload: APIDecoder<MassTalkDownloadResponse> = (
|
export const decodeMassTalkDownload: APIDecoder<MassTalkDownloadResponse> = (
|
||||||
res: any
|
res: any
|
||||||
) => {
|
) => {
|
||||||
return {
|
try {
|
||||||
statusCode: res.StatusCode,
|
const json: JsonObject | Error = JsonAnalization.receiveAnalization(res);
|
||||||
errorMessage: res.ErrorMessage,
|
return {
|
||||||
content: res.Content,
|
statusCode: json.StatusCode,
|
||||||
userName: res.UserName,
|
errorMessage: json.ErrorMessage,
|
||||||
regDate: res.RegDate
|
content: json.Content,
|
||||||
} as MassTalkDownloadResponse;
|
userName: json.UserName,
|
||||||
|
regDate: json.RegDate
|
||||||
|
} as MassTalkDownloadResponse;
|
||||||
|
} catch (e) {
|
||||||
|
return {
|
||||||
|
statusCode: StatusCode.Fail,
|
||||||
|
errorMessage: e
|
||||||
|
} as MassTalkDownloadResponse;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,25 +4,35 @@ import {
|
||||||
APIResponse,
|
APIResponse,
|
||||||
APIEncoder,
|
APIEncoder,
|
||||||
APIDecoder,
|
APIDecoder,
|
||||||
ParameterUtil
|
ParameterUtil,
|
||||||
|
StatusCode,
|
||||||
|
JsonAnalization
|
||||||
} from '@ucap-webmessenger/api';
|
} from '@ucap-webmessenger/api';
|
||||||
|
import { JsonObject } from 'type-fest';
|
||||||
|
|
||||||
export interface MassTalkSaveRequest extends APIRequest {
|
export interface MassTalkSaveRequest extends APIRequest {
|
||||||
userSeq: string;
|
userSeq: number;
|
||||||
deviceType: DeviceType;
|
deviceType: DeviceType;
|
||||||
token: string;
|
token: string;
|
||||||
content?: string;
|
content?: string;
|
||||||
roomId?: string;
|
roomSeq?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MassTalkSaveResponse extends APIResponse {
|
export interface MassTalkSaveResponse extends APIResponse {
|
||||||
EventMassSEQ?: string;
|
eventMassSeq?: string;
|
||||||
RoomID?: string;
|
roomID?: string;
|
||||||
RegDate?: string;
|
regDate?: string;
|
||||||
Content?: string;
|
content?: string;
|
||||||
|
returnJson?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
const massTalkSaveEncodeMap = {};
|
const massTalkSaveEncodeMap = {
|
||||||
|
userSeq: 'p_user_seq',
|
||||||
|
deviceType: 'p_device_type',
|
||||||
|
token: 'p_token',
|
||||||
|
content: 'p_content',
|
||||||
|
roomSeq: 'p_room_id'
|
||||||
|
};
|
||||||
|
|
||||||
export const encodeMassTalkSave: APIEncoder<MassTalkSaveRequest> = (
|
export const encodeMassTalkSave: APIEncoder<MassTalkSaveRequest> = (
|
||||||
req: MassTalkSaveRequest
|
req: MassTalkSaveRequest
|
||||||
|
@ -33,5 +43,21 @@ export const encodeMassTalkSave: APIEncoder<MassTalkSaveRequest> = (
|
||||||
export const decodeMassTalkSave: APIDecoder<MassTalkSaveResponse> = (
|
export const decodeMassTalkSave: APIDecoder<MassTalkSaveResponse> = (
|
||||||
res: any
|
res: any
|
||||||
) => {
|
) => {
|
||||||
return {} as MassTalkSaveResponse;
|
try {
|
||||||
|
const json: JsonObject | Error = JsonAnalization.receiveAnalization(res);
|
||||||
|
return {
|
||||||
|
statusCode: json.StatusCode,
|
||||||
|
errorMessage: json.ErrorMessage,
|
||||||
|
content: json.Content,
|
||||||
|
eventMassSeq: json.EventMassSeq,
|
||||||
|
regDate: json.RegDate,
|
||||||
|
roomID: json.RoomID,
|
||||||
|
returnJson: res
|
||||||
|
} as MassTalkSaveResponse;
|
||||||
|
} catch (e) {
|
||||||
|
return {
|
||||||
|
statusCode: StatusCode.Fail,
|
||||||
|
errorMessage: e
|
||||||
|
} as MassTalkSaveResponse;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -134,7 +134,8 @@ export class CommonApiService {
|
||||||
this.moduleConfig.urls.massTalkDownload,
|
this.moduleConfig.urls.massTalkDownload,
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
params: encodeMassTalkDownload(req)
|
params: encodeMassTalkDownload(req),
|
||||||
|
responseType: 'text' as 'json'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.pipe(map(res => decodeMassTalkDownload(res)));
|
.pipe(map(res => decodeMassTalkDownload(res)));
|
||||||
|
@ -148,7 +149,8 @@ export class CommonApiService {
|
||||||
this.moduleConfig.urls.massTalkSave,
|
this.moduleConfig.urls.massTalkSave,
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
params: encodeMassTalkSave(req)
|
params: encodeMassTalkSave(req),
|
||||||
|
responseType: 'text' as 'json'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.pipe(map(res => decodeMassTalkSave(res)));
|
.pipe(map(res => decodeMassTalkSave(res)));
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
export enum StatusCode {
|
export enum StatusCode {
|
||||||
Success = '200'
|
Success = '200',
|
||||||
|
Fail = '500'
|
||||||
}
|
}
|
||||||
|
|
20
projects/ucap-webmessenger-api/src/lib/utils/json.util.ts
Normal file
20
projects/ucap-webmessenger-api/src/lib/utils/json.util.ts
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import { JsonObject } from 'type-fest';
|
||||||
|
|
||||||
|
export class JsonAnalization {
|
||||||
|
public static receiveAnalization(jsonStr: string): JsonObject {
|
||||||
|
const startJson = jsonStr.indexOf('{');
|
||||||
|
const endJson = jsonStr.lastIndexOf('}');
|
||||||
|
|
||||||
|
if (startJson >= 0 && startJson < endJson) {
|
||||||
|
jsonStr = jsonStr
|
||||||
|
.substring(startJson, endJson + 1)
|
||||||
|
.replace(/\n"/gi, '"')
|
||||||
|
.replace(/\n}/gi, '}')
|
||||||
|
.replace(/\n/gi, '\\n');
|
||||||
|
|
||||||
|
return JSON.parse(jsonStr);
|
||||||
|
} else {
|
||||||
|
throw new Error('Invalid Json String');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,5 +6,6 @@ export * from './lib/apis/api';
|
||||||
|
|
||||||
export * from './lib/types/status-code.type';
|
export * from './lib/types/status-code.type';
|
||||||
|
|
||||||
|
export * from './lib/utils/json.util';
|
||||||
export * from './lib/utils/parameter.util';
|
export * from './lib/utils/parameter.util';
|
||||||
export * from './lib/utils/url.util';
|
export * from './lib/utils/url.util';
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { forward } from './../../../store/messenger/event/actions';
|
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
OnInit,
|
OnInit,
|
||||||
|
@ -55,6 +54,7 @@ import {
|
||||||
ImageViewerDialogData,
|
ImageViewerDialogData,
|
||||||
ImageViewerDialogResult
|
ImageViewerDialogResult
|
||||||
} from '@app/layouts/common/dialogs/image-viewer.dialog.component';
|
} from '@app/layouts/common/dialogs/image-viewer.dialog.component';
|
||||||
|
import { Maximum_Range } from '@ucap-webmessenger/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-layout-messenger-messages',
|
selector: 'app-layout-messenger-messages',
|
||||||
|
@ -189,16 +189,31 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewChecked {
|
||||||
selectContact() {}
|
selectContact() {}
|
||||||
|
|
||||||
onSendMessage(message: string) {
|
onSendMessage(message: string) {
|
||||||
this.store.dispatch(
|
if (message.trim().length > Maximum_Range.MassText) {
|
||||||
EventStore.send({
|
// MASS TEXT
|
||||||
senderSeq: this.loginRes.userSeq,
|
this.store.dispatch(
|
||||||
req: {
|
EventStore.sendMass({
|
||||||
roomSeq: this.roomInfo.roomSeq,
|
senderSeq: this.loginRes.userSeq,
|
||||||
eventType: EventType.Character,
|
req: {
|
||||||
sentMessage: message
|
roomSeq: this.roomInfo.roomSeq,
|
||||||
}
|
eventType: EventType.MassText,
|
||||||
})
|
// sentMessage: message.replace(/\n/gi, '\r\n')
|
||||||
);
|
sentMessage: message
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.store.dispatch(
|
||||||
|
EventStore.send({
|
||||||
|
senderSeq: this.loginRes.userSeq,
|
||||||
|
req: {
|
||||||
|
roomSeq: this.roomInfo.roomSeq,
|
||||||
|
eventType: EventType.Character,
|
||||||
|
sentMessage: message
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickReceiveAlarm() {
|
onClickReceiveAlarm() {
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
<mat-card class="confirm-card">
|
|
||||||
<mat-card-header>
|
|
||||||
<mat-card-title>새 그룹 추가</mat-card-title>
|
|
||||||
</mat-card-header>
|
|
||||||
<mat-card-content> </mat-card-content>
|
|
||||||
<mat-card-actions class="button-farm flex-row">
|
|
||||||
<button
|
|
||||||
mat-stroked-button
|
|
||||||
(click)="onClickChoice(false)"
|
|
||||||
class="mat-primary"
|
|
||||||
>
|
|
||||||
No
|
|
||||||
</button>
|
|
||||||
<button mat-flat-button (click)="onClickChoice(true)" class="mat-primary">
|
|
||||||
Yes
|
|
||||||
</button>
|
|
||||||
</mat-card-actions>
|
|
||||||
</mat-card>
|
|
|
@ -1,24 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { CreateGroupDialogComponent } from './create-group.dialog.component';
|
|
||||||
|
|
||||||
describe('app::layouts::messenger::CreateGroupDialogComponent', () => {
|
|
||||||
let component: CreateGroupDialogComponent;
|
|
||||||
let fixture: ComponentFixture<CreateGroupDialogComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [CreateGroupDialogComponent]
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(CreateGroupDialogComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { Component, OnInit, Inject } from '@angular/core';
|
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
|
||||||
|
|
||||||
export interface CreateGroupDialogData {
|
|
||||||
title: string;
|
|
||||||
message?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CreateGroupDialogResult {
|
|
||||||
choice: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-layout-messenger-create-group',
|
|
||||||
templateUrl: './create-group.dialog.component.html',
|
|
||||||
styleUrls: ['./create-group.dialog.component.scss']
|
|
||||||
})
|
|
||||||
export class CreateGroupDialogComponent implements OnInit {
|
|
||||||
constructor(
|
|
||||||
public dialogRef: MatDialogRef<
|
|
||||||
CreateGroupDialogData,
|
|
||||||
CreateGroupDialogResult
|
|
||||||
>,
|
|
||||||
@Inject(MAT_DIALOG_DATA) public data: CreateGroupDialogData
|
|
||||||
) {}
|
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
|
|
||||||
onClickChoice(choice: boolean): void {
|
|
||||||
this.dialogRef.close({
|
|
||||||
choice
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
<mat-card class="confirm-card">
|
|
||||||
<mat-card-header>
|
|
||||||
<mat-card-title>그룹 삭제</mat-card-title>
|
|
||||||
</mat-card-header>
|
|
||||||
<mat-card-content> </mat-card-content>
|
|
||||||
<mat-card-actions class="button-farm flex-row">
|
|
||||||
<button
|
|
||||||
mat-stroked-button
|
|
||||||
(click)="onClickChoice(false)"
|
|
||||||
class="mat-primary"
|
|
||||||
>
|
|
||||||
No
|
|
||||||
</button>
|
|
||||||
<button mat-flat-button (click)="onClickChoice(true)" class="mat-primary">
|
|
||||||
Yes
|
|
||||||
</button>
|
|
||||||
</mat-card-actions>
|
|
||||||
</mat-card>
|
|
|
@ -1,24 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { EditGroupDialogComponent } from './edit-group.dialog.component';
|
|
||||||
|
|
||||||
describe('app::layouts::messenger::EditGroupDialogComponent', () => {
|
|
||||||
let component: EditGroupDialogComponent;
|
|
||||||
let fixture: ComponentFixture<EditGroupDialogComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [EditGroupDialogComponent]
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(EditGroupDialogComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { Component, OnInit, Inject } from '@angular/core';
|
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
|
||||||
|
|
||||||
export interface DeleteGroupDialogData {
|
|
||||||
title: string;
|
|
||||||
message?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DeleteGroupDialogResult {
|
|
||||||
choice: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-layout-messenger-delete-group',
|
|
||||||
templateUrl: './delete-group.dialog.component.html',
|
|
||||||
styleUrls: ['./delete-group.dialog.component.scss']
|
|
||||||
})
|
|
||||||
export class DeleteGroupDialogComponent implements OnInit {
|
|
||||||
constructor(
|
|
||||||
public dialogRef: MatDialogRef<
|
|
||||||
DeleteGroupDialogData,
|
|
||||||
DeleteGroupDialogResult
|
|
||||||
>,
|
|
||||||
@Inject(MAT_DIALOG_DATA) public data: DeleteGroupDialogData
|
|
||||||
) {}
|
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
|
|
||||||
onClickChoice(choice: boolean): void {
|
|
||||||
this.dialogRef.close({
|
|
||||||
choice
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
<mat-card class="confirm-card">
|
|
||||||
<mat-card-header>
|
|
||||||
<mat-card-title>그룹 맴버 수정</mat-card-title>
|
|
||||||
</mat-card-header>
|
|
||||||
<mat-card-content> </mat-card-content>
|
|
||||||
<mat-card-actions class="button-farm flex-row">
|
|
||||||
<button
|
|
||||||
mat-stroked-button
|
|
||||||
(click)="onClickChoice(false)"
|
|
||||||
class="mat-primary"
|
|
||||||
>
|
|
||||||
No
|
|
||||||
</button>
|
|
||||||
<button mat-flat-button (click)="onClickChoice(true)" class="mat-primary">
|
|
||||||
Yes
|
|
||||||
</button>
|
|
||||||
</mat-card-actions>
|
|
||||||
</mat-card>
|
|
|
@ -1,24 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { EditGroupMemberDialogComponent } from './edit-group-member.dialog.component';
|
|
||||||
|
|
||||||
describe('app::layouts::messenger::EditGroupMemberDialogComponent', () => {
|
|
||||||
let component: EditGroupMemberDialogComponent;
|
|
||||||
let fixture: ComponentFixture<EditGroupMemberDialogComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [EditGroupMemberDialogComponent]
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(EditGroupMemberDialogComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { Component, OnInit, Inject } from '@angular/core';
|
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
|
||||||
|
|
||||||
export interface EditGroupMemberDialogData {
|
|
||||||
title: string;
|
|
||||||
message?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EditGroupMemberDialogResult {
|
|
||||||
choice: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-layout-messenger-edit-group-member',
|
|
||||||
templateUrl: './edit-group-member.dialog.component.html',
|
|
||||||
styleUrls: ['./edit-group-member.dialog.component.scss']
|
|
||||||
})
|
|
||||||
export class EditGroupMemberDialogComponent implements OnInit {
|
|
||||||
constructor(
|
|
||||||
public dialogRef: MatDialogRef<
|
|
||||||
EditGroupMemberDialogData,
|
|
||||||
EditGroupMemberDialogResult
|
|
||||||
>,
|
|
||||||
@Inject(MAT_DIALOG_DATA) public data: EditGroupMemberDialogData
|
|
||||||
) {}
|
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
|
|
||||||
onClickChoice(choice: boolean): void {
|
|
||||||
this.dialogRef.close({
|
|
||||||
choice
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +1,4 @@
|
||||||
import { CreateGroupDialogComponent } from './create-group.dialog.component';
|
|
||||||
import { DeleteGroupDialogComponent } from './delete-group.dialog.component';
|
|
||||||
import { SelectGroupDialogComponent } from './select-group.dialog.component';
|
import { SelectGroupDialogComponent } from './select-group.dialog.component';
|
||||||
import { EditGroupDialogComponent } from './edit-group.dialog.component';
|
import { EditGroupDialogComponent } from './edit-group.dialog.component';
|
||||||
import { EditGroupMemberDialogComponent } from './edit-group-member.dialog.component';
|
|
||||||
|
|
||||||
export const DIALOGS = [
|
export const DIALOGS = [SelectGroupDialogComponent, EditGroupDialogComponent];
|
||||||
CreateGroupDialogComponent,
|
|
||||||
DeleteGroupDialogComponent,
|
|
||||||
SelectGroupDialogComponent,
|
|
||||||
EditGroupDialogComponent,
|
|
||||||
EditGroupMemberDialogComponent
|
|
||||||
];
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { DIALOGS as CHAT_DIALOGS } from './chat';
|
import { DIALOGS as CHAT_DIALOGS } from './chat';
|
||||||
import { DIALOGS as GROUP_DIALOGS } from './group';
|
import { DIALOGS as GROUP_DIALOGS } from './group';
|
||||||
import { DIALOGS as MESSAGE_DIALOGS } from './message';
|
|
||||||
|
|
||||||
export const DIALOGS = [...CHAT_DIALOGS, ...GROUP_DIALOGS, ...MESSAGE_DIALOGS];
|
export const DIALOGS = [...CHAT_DIALOGS, ...GROUP_DIALOGS];
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
<mat-card class="confirm-card">
|
|
||||||
<mat-card-header>
|
|
||||||
<mat-card-title>대화 삭제</mat-card-title>
|
|
||||||
</mat-card-header>
|
|
||||||
<mat-card-content> </mat-card-content>
|
|
||||||
<mat-card-actions class="button-farm flex-row">
|
|
||||||
<button
|
|
||||||
mat-stroked-button
|
|
||||||
(click)="onClickChoice(false)"
|
|
||||||
class="mat-primary"
|
|
||||||
>
|
|
||||||
No
|
|
||||||
</button>
|
|
||||||
<button mat-flat-button (click)="onClickChoice(true)" class="mat-primary">
|
|
||||||
Yes
|
|
||||||
</button>
|
|
||||||
</mat-card-actions>
|
|
||||||
</mat-card>
|
|
|
@ -1,24 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { DeleteMessageDialogComponent } from './delete-message.dialog.component';
|
|
||||||
|
|
||||||
describe('app::layouts::messenger::DeleteMessageDialogComponent', () => {
|
|
||||||
let component: DeleteMessageDialogComponent;
|
|
||||||
let fixture: ComponentFixture<DeleteMessageDialogComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [DeleteMessageDialogComponent]
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(DeleteMessageDialogComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { Component, OnInit, Inject } from '@angular/core';
|
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
|
||||||
|
|
||||||
export interface DeleteMessageDialogData {
|
|
||||||
title: string;
|
|
||||||
message?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DeleteMessageDialogResult {
|
|
||||||
choice: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-layout-messenger-delete-message',
|
|
||||||
templateUrl: './delete-message.dialog.component.html',
|
|
||||||
styleUrls: ['./delete-message.dialog.component.scss']
|
|
||||||
})
|
|
||||||
export class DeleteMessageDialogComponent implements OnInit {
|
|
||||||
constructor(
|
|
||||||
public dialogRef: MatDialogRef<
|
|
||||||
DeleteMessageDialogData,
|
|
||||||
DeleteMessageDialogResult
|
|
||||||
>,
|
|
||||||
@Inject(MAT_DIALOG_DATA) public data: DeleteMessageDialogData
|
|
||||||
) {}
|
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
|
|
||||||
onClickChoice(choice: boolean): void {
|
|
||||||
this.dialogRef.close({
|
|
||||||
choice
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
import { DeleteMessageDialogComponent } from './delete-message.dialog.component';
|
|
||||||
import { RelayMessageDialogComponent } from './relay-message.dialog.component';
|
|
||||||
|
|
||||||
export const DIALOGS = [
|
|
||||||
DeleteMessageDialogComponent,
|
|
||||||
RelayMessageDialogComponent
|
|
||||||
];
|
|
|
@ -1,18 +0,0 @@
|
||||||
<mat-card class="confirm-card">
|
|
||||||
<mat-card-header>
|
|
||||||
<mat-card-title>대화 회수</mat-card-title>
|
|
||||||
</mat-card-header>
|
|
||||||
<mat-card-content> </mat-card-content>
|
|
||||||
<mat-card-actions class="button-farm flex-row">
|
|
||||||
<button
|
|
||||||
mat-stroked-button
|
|
||||||
(click)="onClickChoice(false)"
|
|
||||||
class="mat-primary"
|
|
||||||
>
|
|
||||||
No
|
|
||||||
</button>
|
|
||||||
<button mat-flat-button (click)="onClickChoice(true)" class="mat-primary">
|
|
||||||
Yes
|
|
||||||
</button>
|
|
||||||
</mat-card-actions>
|
|
||||||
</mat-card>
|
|
|
@ -1,24 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { RecallMessageDialogComponent } from './recall-message.dialog.component';
|
|
||||||
|
|
||||||
describe('app::layouts::messenger::RecallMessageDialogComponent', () => {
|
|
||||||
let component: RecallMessageDialogComponent;
|
|
||||||
let fixture: ComponentFixture<RecallMessageDialogComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [RecallMessageDialogComponent]
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(RecallMessageDialogComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { Component, OnInit, Inject } from '@angular/core';
|
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
|
||||||
|
|
||||||
export interface RecallMessageDialogData {
|
|
||||||
title: string;
|
|
||||||
message?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RecallMessageDialogResult {
|
|
||||||
choice: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-layout-messenger-recall-message',
|
|
||||||
templateUrl: './recall-message.dialog.component.html',
|
|
||||||
styleUrls: ['./recall-message.dialog.component.scss']
|
|
||||||
})
|
|
||||||
export class RecallMessageDialogComponent implements OnInit {
|
|
||||||
constructor(
|
|
||||||
public dialogRef: MatDialogRef<
|
|
||||||
RecallMessageDialogData,
|
|
||||||
RecallMessageDialogResult
|
|
||||||
>,
|
|
||||||
@Inject(MAT_DIALOG_DATA) public data: RecallMessageDialogData
|
|
||||||
) {}
|
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
|
|
||||||
onClickChoice(choice: boolean): void {
|
|
||||||
this.dialogRef.close({
|
|
||||||
choice
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
<mat-card class="confirm-card">
|
|
||||||
<mat-card-header>
|
|
||||||
<mat-card-title>대화 전달</mat-card-title>
|
|
||||||
</mat-card-header>
|
|
||||||
<mat-card-content> </mat-card-content>
|
|
||||||
<mat-card-actions class="button-farm flex-row">
|
|
||||||
<button
|
|
||||||
mat-stroked-button
|
|
||||||
(click)="onClickChoice(false)"
|
|
||||||
class="mat-primary"
|
|
||||||
>
|
|
||||||
No
|
|
||||||
</button>
|
|
||||||
<button mat-flat-button (click)="onClickChoice(true)" class="mat-primary">
|
|
||||||
Yes
|
|
||||||
</button>
|
|
||||||
</mat-card-actions>
|
|
||||||
</mat-card>
|
|
|
@ -1,24 +0,0 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { RelayMessageDialogComponent } from './relay-message.dialog.component';
|
|
||||||
|
|
||||||
describe('app::layouts::messenger::RelayMessageDialogComponent', () => {
|
|
||||||
let component: RelayMessageDialogComponent;
|
|
||||||
let fixture: ComponentFixture<RelayMessageDialogComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [RelayMessageDialogComponent]
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(RelayMessageDialogComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { Component, OnInit, Inject } from '@angular/core';
|
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
|
||||||
|
|
||||||
export interface RelayMessageDialogData {
|
|
||||||
title: string;
|
|
||||||
message?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RelayMessageDialogResult {
|
|
||||||
choice: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-layout-messenger-relay-message',
|
|
||||||
templateUrl: './relay-message.dialog.component.html',
|
|
||||||
styleUrls: ['./relay-message.dialog.component.scss']
|
|
||||||
})
|
|
||||||
export class RelayMessageDialogComponent implements OnInit {
|
|
||||||
constructor(
|
|
||||||
public dialogRef: MatDialogRef<
|
|
||||||
RelayMessageDialogData,
|
|
||||||
RelayMessageDialogResult
|
|
||||||
>,
|
|
||||||
@Inject(MAT_DIALOG_DATA) public data: RelayMessageDialogData
|
|
||||||
) {}
|
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
|
|
||||||
onClickChoice(choice: boolean): void {
|
|
||||||
this.dialogRef.close({
|
|
||||||
choice
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -95,6 +95,22 @@ export const forwardAfterRoomOpen = createAction(
|
||||||
}>()
|
}>()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const sendMass = createAction(
|
||||||
|
'[Messenger::Event] Send Mass',
|
||||||
|
props<{ senderSeq: number; req: SendRequest }>()
|
||||||
|
);
|
||||||
|
export const sendMassSuccess = createAction(
|
||||||
|
'[Messenger::Event] Send Mass Success',
|
||||||
|
props<{
|
||||||
|
senderSeq: number;
|
||||||
|
res: SendResponse;
|
||||||
|
}>()
|
||||||
|
);
|
||||||
|
export const sendMassFailure = createAction(
|
||||||
|
'[Messenger::Event] Send Mass Failure',
|
||||||
|
props<{ error: any }>()
|
||||||
|
);
|
||||||
|
|
||||||
export const read = createAction(
|
export const read = createAction(
|
||||||
'[Messenger::Event] read',
|
'[Messenger::Event] read',
|
||||||
props<ReadRequest>()
|
props<ReadRequest>()
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
import {
|
||||||
|
CommonApiService,
|
||||||
|
MassTalkSaveRequest
|
||||||
|
} from '@ucap-webmessenger/api-common';
|
||||||
|
import { KEY_ENVIRONMENTS_INFO } from './../../../types/environment.type';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
||||||
|
@ -25,7 +30,8 @@ import {
|
||||||
SendResponse,
|
SendResponse,
|
||||||
ReadResponse,
|
ReadResponse,
|
||||||
DelResponse,
|
DelResponse,
|
||||||
CancelResponse
|
CancelResponse,
|
||||||
|
EventType
|
||||||
} from '@ucap-webmessenger/protocol-event';
|
} from '@ucap-webmessenger/protocol-event';
|
||||||
|
|
||||||
import * as ChatStore from '@app/store/messenger/chat';
|
import * as ChatStore from '@app/store/messenger/chat';
|
||||||
|
@ -54,7 +60,9 @@ import {
|
||||||
cancelFailure,
|
cancelFailure,
|
||||||
forward,
|
forward,
|
||||||
forwardFailure,
|
forwardFailure,
|
||||||
forwardAfterRoomOpen
|
forwardAfterRoomOpen,
|
||||||
|
sendMass,
|
||||||
|
sendMassFailure
|
||||||
} from './actions';
|
} from './actions';
|
||||||
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||||
import {
|
import {
|
||||||
|
@ -62,9 +70,12 @@ import {
|
||||||
RoomProtocolService,
|
RoomProtocolService,
|
||||||
OpenResponse
|
OpenResponse
|
||||||
} from '@ucap-webmessenger/protocol-room';
|
} from '@ucap-webmessenger/protocol-room';
|
||||||
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
|
import { LoginInfo, KEY_LOGIN_INFO, EnvironmentsInfo } from '@app/types';
|
||||||
import { Dictionary } from '@ngrx/entity';
|
import { Dictionary } from '@ngrx/entity';
|
||||||
import { openSuccess, openFailure } from '../room';
|
import { openSuccess, openFailure } from '../room';
|
||||||
|
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
||||||
|
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
|
||||||
|
import { StatusCode } from '@ucap-webmessenger/api';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Effects {
|
export class Effects {
|
||||||
|
@ -289,6 +300,52 @@ export class Effects {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sendMass$ = createEffect(
|
||||||
|
() => {
|
||||||
|
return this.actions$.pipe(
|
||||||
|
ofType(sendMass),
|
||||||
|
exhaustMap(action => {
|
||||||
|
const loginResInfo: LoginResponse = this.sessionStorageService.get<
|
||||||
|
LoginResponse
|
||||||
|
>(KEY_LOGIN_RES_INFO);
|
||||||
|
|
||||||
|
const environmentsInfo = this.sessionStorageService.get<
|
||||||
|
EnvironmentsInfo
|
||||||
|
>(KEY_ENVIRONMENTS_INFO);
|
||||||
|
|
||||||
|
const req: MassTalkSaveRequest = {
|
||||||
|
userSeq: loginResInfo.userSeq,
|
||||||
|
deviceType: environmentsInfo.deviceType,
|
||||||
|
token: loginResInfo.tokenString,
|
||||||
|
content: action.req.sentMessage,
|
||||||
|
roomSeq: action.req.roomSeq
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.commonApiService.massTalkSave(req).pipe(
|
||||||
|
map(res => {
|
||||||
|
if (res.statusCode === StatusCode.Success) {
|
||||||
|
this.store.dispatch(
|
||||||
|
send({
|
||||||
|
senderSeq: action.senderSeq,
|
||||||
|
req: {
|
||||||
|
roomSeq: res.roomID,
|
||||||
|
eventType: EventType.MassText,
|
||||||
|
sentMessage: res.returnJson
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.store.dispatch(sendMassFailure({ error: res }));
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
catchError(error => of(sendMassFailure({ error })))
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
{ dispatch: false }
|
||||||
|
);
|
||||||
|
|
||||||
newInfo$ = createEffect(
|
newInfo$ = createEffect(
|
||||||
() => {
|
() => {
|
||||||
return this.actions$.pipe(
|
return this.actions$.pipe(
|
||||||
|
@ -428,6 +485,7 @@ export class Effects {
|
||||||
constructor(
|
constructor(
|
||||||
private actions$: Actions,
|
private actions$: Actions,
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
|
private commonApiService: CommonApiService,
|
||||||
private eventProtocolService: EventProtocolService,
|
private eventProtocolService: EventProtocolService,
|
||||||
private roomProtocolService: RoomProtocolService,
|
private roomProtocolService: RoomProtocolService,
|
||||||
private sessionStorageService: SessionStorageService,
|
private sessionStorageService: SessionStorageService,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { JsonObject } from 'type-fest';
|
||||||
import { createReducer, on } from '@ngrx/store';
|
import { createReducer, on } from '@ngrx/store';
|
||||||
import {
|
import {
|
||||||
initialState,
|
initialState,
|
||||||
|
@ -30,6 +31,7 @@ import * as RoomStore from '@app/store/messenger/room';
|
||||||
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
|
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
|
||||||
import { EventType } from '@ucap-webmessenger/protocol-event';
|
import { EventType } from '@ucap-webmessenger/protocol-event';
|
||||||
import { FileType } from '@ucap-webmessenger/protocol-file';
|
import { FileType } from '@ucap-webmessenger/protocol-file';
|
||||||
|
import { JsonAnalization } from '@ucap-webmessenger/api';
|
||||||
|
|
||||||
export const reducer = createReducer(
|
export const reducer = createReducer(
|
||||||
initialState,
|
initialState,
|
||||||
|
@ -119,6 +121,18 @@ export const reducer = createReducer(
|
||||||
case EventType.VideoConference:
|
case EventType.VideoConference:
|
||||||
finalEventMessage = '화상회의';
|
finalEventMessage = '화상회의';
|
||||||
break;
|
break;
|
||||||
|
case EventType.MassText:
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
const json: JsonObject | Error = JsonAnalization.receiveAnalization(
|
||||||
|
finalEventMessage
|
||||||
|
);
|
||||||
|
finalEventMessage = json.Content.toString();
|
||||||
|
} catch (e) {
|
||||||
|
finalEventMessage = '대용량 텍스트';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
const roomInfo = {
|
const roomInfo = {
|
||||||
...state.room.entities[action.roomSeq],
|
...state.room.entities[action.roomSeq],
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
export enum Maximum_Range {
|
||||||
|
MassText = 800,
|
||||||
|
ChatRoom = 300
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ export * from './lib/type/device-devision.type';
|
||||||
export * from './lib/type/device-type.type';
|
export * from './lib/type/device-type.type';
|
||||||
export * from './lib/type/file-transfer-permissions.type';
|
export * from './lib/type/file-transfer-permissions.type';
|
||||||
export * from './lib/type/locale-code.type';
|
export * from './lib/type/locale-code.type';
|
||||||
|
export * from './lib/type/maximum-range.type';
|
||||||
export * from './lib/type/notification-method.type';
|
export * from './lib/type/notification-method.type';
|
||||||
export * from './lib/type/organization-chart-permissions.type';
|
export * from './lib/type/organization-chart-permissions.type';
|
||||||
export * from './lib/type/push-type.type';
|
export * from './lib/type/push-type.type';
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { Info } from '@ucap-webmessenger/protocol-event';
|
||||||
import { NGXLogger } from 'ngx-logger';
|
import { NGXLogger } from 'ngx-logger';
|
||||||
import { StatusCode } from '@ucap-webmessenger/api';
|
import { StatusCode } from '@ucap-webmessenger/api';
|
||||||
import { MassTextInfo } from '../../models/mass-talk-info.json';
|
import { MassTextInfo } from '../../models/mass-talk-info.json';
|
||||||
|
import { StringUtil } from '@ucap-webmessenger/ui';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ucap-chat-message-box-mass',
|
selector: 'ucap-chat-message-box-mass',
|
||||||
|
@ -24,7 +25,9 @@ export class MassComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
try {
|
try {
|
||||||
const contentJson: MassTextInfo = JSON.parse(this.message.sentMessage);
|
const contentJson: MassTextInfo = StringUtil.receiveAnalization(
|
||||||
|
this.message.sentMessage
|
||||||
|
);
|
||||||
if (contentJson.StatusCode === StatusCode.Success) {
|
if (contentJson.StatusCode === StatusCode.Success) {
|
||||||
this.content = contentJson.Content;
|
this.content = contentJson.Content;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { JsonObject } from 'type-fest';
|
||||||
|
|
||||||
export class StringUtil {
|
export class StringUtil {
|
||||||
/**
|
/**
|
||||||
* linefeed > <br>
|
* linefeed > <br>
|
||||||
|
@ -33,6 +35,26 @@ export class StringUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Json String Analization.
|
||||||
|
*/
|
||||||
|
public static receiveAnalization(jsonStr: string): JsonObject {
|
||||||
|
const startJson = jsonStr.indexOf('{');
|
||||||
|
const endJson = jsonStr.lastIndexOf('}');
|
||||||
|
|
||||||
|
if (startJson >= 0 && startJson < endJson) {
|
||||||
|
jsonStr = jsonStr
|
||||||
|
.substring(startJson, endJson + 1)
|
||||||
|
.replace(/\n"/gi, '"')
|
||||||
|
.replace(/\n}/gi, '}')
|
||||||
|
.replace(/\n/gi, '\\n');
|
||||||
|
|
||||||
|
return JSON.parse(jsonStr);
|
||||||
|
} else {
|
||||||
|
throw new Error('Invalid Json String');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* date formater
|
* date formater
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user