파일 전달 로직 수정. >> FileTalkShare.aspx 를 통해서 공유 할 수 있도록 수정.

This commit is contained in:
leejinho 2020-01-08 15:35:48 +09:00
parent 9245a136ef
commit f53535847f
3 changed files with 152 additions and 31 deletions

View File

@ -5,7 +5,6 @@ import {
APIEncoder, APIEncoder,
APIDecoder, APIDecoder,
ParameterUtil, ParameterUtil,
JsonAnalization,
StatusCode StatusCode
} from '@ucap-webmessenger/api'; } from '@ucap-webmessenger/api';
@ -51,20 +50,19 @@ export const decodeFileTalkShare: APIDecoder<FileTalkShareResponse> = (
res: any res: any
) => { ) => {
try { try {
const json = JsonAnalization.receiveAnalization(res);
return { return {
statusCode: json.StatusCode, statusCode: res.StatusCode,
roomSeq: json.RoomID, roomSeq: res.RoomID,
fileName: json.FileName, fileName: res.FileName,
fileExt: json.FileExt, fileExt: res.FileExt,
fileType: json.FileType, fileType: res.FileType,
thumbnailUrl: json.ThumbURL, thumbnailUrl: res.ThumbURL,
attachmentSeq: json.AttSEQ, attachmentSeq: res.AttSEQ,
attachmentSize: json.AttSize, attachmentSize: res.AttSize,
attachmentRegDate: json.AttRegDate, attachmentRegDate: res.AttRegDate,
companyCode: json.CompanyCode, companyCode: res.CompanyCode,
synapKey: json.SynapKey, synapKey: res.SynapKey,
returnJson: res returnJson: JSON.stringify(res)
} as FileTalkShareResponse; } as FileTalkShareResponse;
} catch (e) { } catch (e) {
return { return {

View File

@ -46,7 +46,8 @@ import {
import { import {
RoomInfo, RoomInfo,
UserInfoShort, UserInfoShort,
UserInfo as RoomUserInfo UserInfo as RoomUserInfo,
RoomType
} from '@ucap-webmessenger/protocol-room'; } from '@ucap-webmessenger/protocol-room';
import { import {
ConfirmDialogComponent, ConfirmDialogComponent,
@ -547,6 +548,10 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
} }
} }
onToggleRoom(roomInfo: RoomInfo) { onToggleRoom(roomInfo: RoomInfo) {
if (!this.getCheckableRoom(roomInfo)) {
return;
}
if (!!this.selectedRoom) { if (!!this.selectedRoom) {
if (this.selectedRoom.roomSeq === roomInfo.roomSeq) { if (this.selectedRoom.roomSeq === roomInfo.roomSeq) {
this.selectedRoom = null; this.selectedRoom = null;
@ -591,6 +596,16 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
// .length > 0 // .length > 0
// ); // );
// } // }
if (
roomInfo.roomType === RoomType.Bot ||
roomInfo.roomType === RoomType.Allim ||
roomInfo.roomType === RoomType.Link ||
roomInfo.roomType === RoomType.Allim_Elephant ||
roomInfo.roomType === RoomType.Allim_TMS
) {
return false;
}
return true; return true;
} }
getCheckedRoom(roomInfo: RoomInfo) { getCheckedRoom(roomInfo: RoomInfo) {
@ -611,6 +626,12 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
getBtnValid() { getBtnValid() {
if (this.data.type === UserSelectDialogType.NewGroup) { if (this.data.type === UserSelectDialogType.NewGroup) {
return this.inputForm.invalid; return this.inputForm.invalid;
} else if (this.data.type === UserSelectDialogType.MessageForward) {
if (this.selectedUserList.length === 0 && !this.selectedRoom) {
return true;
}
return false;
} else { } else {
return false; return false;
} }

View File

@ -1,6 +1,7 @@
import { import {
CommonApiService, CommonApiService,
MassTalkSaveRequest MassTalkSaveRequest,
FileTalkShareRequest
} from '@ucap-webmessenger/api-common'; } from '@ucap-webmessenger/api-common';
import { KEY_ENVIRONMENTS_INFO } from './../../../types/environment.type'; import { KEY_ENVIRONMENTS_INFO } from './../../../types/environment.type';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
@ -19,7 +20,8 @@ import {
catchError, catchError,
exhaustMap, exhaustMap,
withLatestFrom, withLatestFrom,
concatMap concatMap,
take
} from 'rxjs/operators'; } from 'rxjs/operators';
import moment from 'moment'; import moment from 'moment';
import { import {
@ -43,7 +45,8 @@ import {
FileEventJson, FileEventJson,
MassTextEventJson, MassTextEventJson,
TranslationEventJson, TranslationEventJson,
MassTranslationEventJson MassTranslationEventJson,
decodeFileEventJson
} 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';
@ -83,7 +86,8 @@ import {
roomOpenAfterForward, roomOpenAfterForward,
infoForSearch, infoForSearch,
infoForSearchEnd, infoForSearchEnd,
infoAll infoAll,
forwardFailure
} from './actions'; } from './actions';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { import {
@ -663,8 +667,52 @@ export class Effects {
ofType(forward), ofType(forward),
tap(action => { tap(action => {
if (!!action.trgtRoomSeq) { if (!!action.trgtRoomSeq) {
// 대화전달 후 방오픈. // 대화전달 후 방오픈. Exist roomSeq.
this.store.dispatch(roomOpenAfterForward(action)); if (action.req.eventType === EventType.File) {
const loginResInfo: LoginResponse = this.sessionStorageService.get<
LoginResponse
>(KEY_LOGIN_RES_INFO);
const environmentsInfo = this.sessionStorageService.get<
EnvironmentsInfo
>(KEY_ENVIRONMENTS_INFO);
const fileEventJson: FileEventJson = decodeFileEventJson(
action.req.sentMessage
);
const req: FileTalkShareRequest = {
userSeq: loginResInfo.userSeq,
deviceType: environmentsInfo.deviceType,
token: loginResInfo.tokenString,
attachmentsSeq: fileEventJson.attachmentSeq.toString(),
roomSeq: action.trgtRoomSeq,
synapKey: ''
};
this.commonApiService
.fileTalkShare(req)
.pipe(
take(1),
map(res => {
if (res.statusCode === StatusCode.Success) {
action = {
...action,
req: {
...action.req,
sentMessage: res.returnJson
}
};
this.store.dispatch(roomOpenAfterForward(action));
} else {
this.store.dispatch(forwardFailure({ error: res }));
}
}),
catchError(error => of(forwardFailure({ error })))
)
.subscribe();
} else {
this.store.dispatch(roomOpenAfterForward(action));
}
} else if (!!action.trgtUserSeqs && action.trgtUserSeqs.length > 0) { } else if (!!action.trgtUserSeqs && action.trgtUserSeqs.length > 0) {
// 방오픈 후 대화전달. // 방오픈 후 대화전달.
this.store.dispatch(forwardAfterRoomOpen(action)); this.store.dispatch(forwardAfterRoomOpen(action));
@ -689,16 +737,70 @@ export class Effects {
return openSuccess({ res }); return openSuccess({ res });
}), }),
map(res => { map(res => {
this.store.dispatch( if (action.req.eventType === EventType.File) {
send({ const loginResInfo: LoginResponse = this.sessionStorageService.get<
senderSeq: action.senderSeq, LoginResponse
req: { >(KEY_LOGIN_RES_INFO);
roomSeq: res.res.roomSeq,
eventType: action.req.eventType, const environmentsInfo = this.sessionStorageService.get<
sentMessage: action.req.sentMessage EnvironmentsInfo
} >(KEY_ENVIRONMENTS_INFO);
})
); const fileEventJson: FileEventJson = decodeFileEventJson(
action.req.sentMessage
);
const req: FileTalkShareRequest = {
userSeq: loginResInfo.userSeq,
deviceType: environmentsInfo.deviceType,
token: loginResInfo.tokenString,
attachmentsSeq: fileEventJson.attachmentSeq.toString(),
roomSeq: action.trgtRoomSeq,
synapKey: ''
};
this.commonApiService
.fileTalkShare(req)
.pipe(
take(1),
map(resFileShare => {
if (resFileShare.statusCode === StatusCode.Success) {
action = {
...action,
req: {
...action.req,
sentMessage: resFileShare.returnJson
}
};
this.store.dispatch(
send({
senderSeq: action.senderSeq,
req: {
roomSeq: res.res.roomSeq,
eventType: action.req.eventType,
sentMessage: action.req.sentMessage
}
})
);
} else {
this.store.dispatch(forwardFailure({ error: res }));
}
}),
catchError(error => of(forwardFailure({ error })))
)
.subscribe();
} else {
this.store.dispatch(
send({
senderSeq: action.senderSeq,
req: {
roomSeq: res.res.roomSeq,
eventType: action.req.eventType,
sentMessage: action.req.sentMessage
}
})
);
}
return res; return res;
}), }),
catchError(error => of(openFailure({ error }))) catchError(error => of(openFailure({ error })))