대용량 번역 더보기 기능 수정.
This commit is contained in:
parent
6fde3b5f22
commit
b1fd5a457f
|
@ -17,7 +17,9 @@ export interface TransMassTalkDownloadRequest extends APIRequest {
|
|||
}
|
||||
|
||||
export interface TransMassTalkDownloadResponse extends APIResponse {
|
||||
content?: string;
|
||||
original?: string;
|
||||
translation?: string;
|
||||
locale?: string;
|
||||
userName?: string;
|
||||
regDate?: string;
|
||||
returnJson?: any;
|
||||
|
@ -27,7 +29,7 @@ const transMassTalkDownloadEncodeMap = {
|
|||
userSeq: 'p_user_seq',
|
||||
deviceType: 'p_device_type',
|
||||
token: 'p_token',
|
||||
eventTransSeq: 'p_event_mass_seq'
|
||||
eventTransSeq: 'p_event_trans_seq'
|
||||
};
|
||||
|
||||
export const encodeTransMassTalkDownload: APIEncoder<TransMassTalkDownloadRequest> = (
|
||||
|
@ -40,13 +42,14 @@ export const decodeTransMassTalkDownload: APIDecoder<TransMassTalkDownloadRespon
|
|||
res: any
|
||||
) => {
|
||||
try {
|
||||
const json = JsonAnalization.receiveAnalization(res);
|
||||
return {
|
||||
statusCode: json.StatusCode,
|
||||
content: json.Content,
|
||||
userName: json.UserName,
|
||||
regDate: json.RegDate,
|
||||
returnJson: res
|
||||
statusCode: res.StatusCode,
|
||||
original: res.Original,
|
||||
translation: res.Translation,
|
||||
locale: res.Locale,
|
||||
userName: res.UserName,
|
||||
regDate: res.RegDate,
|
||||
returnJson: JSON.stringify(res)
|
||||
} as TransMassTalkDownloadResponse;
|
||||
} catch (e) {
|
||||
return {
|
||||
|
|
|
@ -244,7 +244,7 @@
|
|||
[translationSimpleview]="translationSimpleview"
|
||||
(moreEvent)="onMoreEvent($event)"
|
||||
(massDetail)="onMassDetail($event)"
|
||||
(massTranslationDetail)="onClickMassTranslationDetail($event)"
|
||||
(massTranslationDetail)="onMassTranslationDetail($event)"
|
||||
(save)="onSave($event)"
|
||||
(fileViewer)="onFileViewer($event)"
|
||||
(contextMenu)="onContextMenuMessage($event)"
|
||||
|
|
|
@ -852,21 +852,42 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
);
|
||||
}
|
||||
|
||||
onClickMassTranslationDetail(params: {
|
||||
contents: string;
|
||||
onMassTranslationDetail(params: {
|
||||
message: Info<MassTranslationEventJson>;
|
||||
contentsType: string;
|
||||
}) {
|
||||
this.commonApiService
|
||||
.transMassTalkDownload({
|
||||
userSeq: this.loginRes.userSeq,
|
||||
deviceType: this.environmentsInfo.deviceType,
|
||||
token: this.loginRes.tokenString,
|
||||
eventTransSeq: params.message.sentMessageJson.translationSeq.toString()
|
||||
})
|
||||
.pipe(take(1))
|
||||
.subscribe(res => {
|
||||
let contents = '';
|
||||
if (res.statusCode === StatusCode.Success) {
|
||||
contents =
|
||||
params.contentsType === 'T' ? res.translation : res.original;
|
||||
} else {
|
||||
contents =
|
||||
params.contentsType === 'T'
|
||||
? params.message.sentMessageJson.translation
|
||||
: params.message.sentMessageJson.original;
|
||||
}
|
||||
|
||||
this.dialogService.open<MassDetailComponent, MassDetailDialogData>(
|
||||
MassDetailComponent,
|
||||
{
|
||||
disableClose: false,
|
||||
width: '550px',
|
||||
data: {
|
||||
title: 'Detail View',
|
||||
contents: params.contents
|
||||
title: this.translateService.instant('chat.detailView'),
|
||||
contents
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
async onFileViewer(fileInfo: FileEventJson) {
|
||||
|
@ -1131,14 +1152,6 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
message: Info<EventJson>,
|
||||
clicktype?: string
|
||||
) {
|
||||
this.logger.debug(
|
||||
'menuType',
|
||||
menuType,
|
||||
'message',
|
||||
message,
|
||||
'clicktype?',
|
||||
clicktype
|
||||
);
|
||||
switch (menuType) {
|
||||
case 'COPY':
|
||||
{
|
||||
|
@ -1194,18 +1207,30 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
case EventType.Translation:
|
||||
case EventType.MassTranslation:
|
||||
{
|
||||
let trgtStr = '';
|
||||
if (clicktype === 'translation') {
|
||||
// translation
|
||||
trgtStr = (message.sentMessageJson as TranslationEventJson)
|
||||
.translation;
|
||||
const sentMessageJson: MassTranslationEventJson = message.sentMessageJson as MassTranslationEventJson;
|
||||
this.commonApiService
|
||||
.transMassTalkDownload({
|
||||
userSeq: this.loginRes.userSeq,
|
||||
deviceType: this.environmentsInfo.deviceType,
|
||||
token: this.loginRes.tokenString,
|
||||
eventTransSeq: sentMessageJson.translationSeq.toString()
|
||||
})
|
||||
.pipe(take(1))
|
||||
.subscribe(res => {
|
||||
let contents = '';
|
||||
if (res.statusCode === StatusCode.Success) {
|
||||
contents =
|
||||
clicktype === 'translation'
|
||||
? res.translation
|
||||
: res.original;
|
||||
} else {
|
||||
// original
|
||||
trgtStr = (message.sentMessageJson as TranslationEventJson)
|
||||
.original;
|
||||
contents =
|
||||
clicktype === 'translation'
|
||||
? sentMessageJson.translation
|
||||
: sentMessageJson.original;
|
||||
}
|
||||
|
||||
if (this.clipboardService.copyFromContent(trgtStr)) {
|
||||
if (this.clipboardService.copyFromContent(contents)) {
|
||||
this.snackBarService.open(
|
||||
this.translateService.instant(
|
||||
'common.clipboard.results.copied'
|
||||
|
@ -1218,6 +1243,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -22,7 +22,7 @@ export class MassTranslationComponent implements OnInit {
|
|||
|
||||
@Output()
|
||||
massTranslationDetail = new EventEmitter<{
|
||||
contents: string;
|
||||
message: Info<MassTranslationEventJson>;
|
||||
contentsType: string;
|
||||
}>();
|
||||
|
||||
|
@ -37,15 +37,8 @@ export class MassTranslationComponent implements OnInit {
|
|||
ngOnInit() {}
|
||||
|
||||
onClickMassDetail(contentsType: string) {
|
||||
let contents = '';
|
||||
if (contentsType === 'O') {
|
||||
contents = this.message.sentMessageJson.original;
|
||||
} else {
|
||||
contents = this.message.sentMessageJson.translation;
|
||||
}
|
||||
|
||||
this.massTranslationDetail.emit({
|
||||
contents,
|
||||
message: this.message,
|
||||
contentsType
|
||||
});
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@
|
|||
[translationSimpleview]="translationSimpleview"
|
||||
[isMe]="message.senderSeq === loginRes.userSeq"
|
||||
(contextMenu)="onContextMenuMessage($event, message)"
|
||||
(massTranslationDetail)="onClickMassTranslationDetail($event)"
|
||||
(massTranslationDetail)="onMassTranslationDetail($event)"
|
||||
>
|
||||
</ucap-chat-message-box-mass-translation>
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ import {
|
|||
EventType,
|
||||
InfoResponse,
|
||||
EventJson,
|
||||
FileEventJson
|
||||
FileEventJson,
|
||||
MassTranslationEventJson
|
||||
} from '@ucap-webmessenger/protocol-event';
|
||||
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
||||
import { UserInfo, RoomInfo, RoomType } from '@ucap-webmessenger/protocol-room';
|
||||
|
@ -63,7 +64,7 @@ export class MessagesComponent implements OnInit {
|
|||
massDetail = new EventEmitter<number>();
|
||||
@Output()
|
||||
massTranslationDetail = new EventEmitter<{
|
||||
contents: string;
|
||||
message: Info<MassTranslationEventJson>;
|
||||
contentsType: string;
|
||||
}>();
|
||||
@Output()
|
||||
|
@ -227,8 +228,8 @@ export class MessagesComponent implements OnInit {
|
|||
this.massDetail.emit(value);
|
||||
}
|
||||
|
||||
onClickMassTranslationDetail(params: {
|
||||
contents: string;
|
||||
onMassTranslationDetail(params: {
|
||||
message: Info<MassTranslationEventJson>;
|
||||
contentsType: string;
|
||||
}) {
|
||||
this.massTranslationDetail.emit(params);
|
||||
|
|
Loading…
Reference in New Issue
Block a user