번역 프로그레스 및 이벤트 처리.

This commit is contained in:
leejinho 2019-12-31 17:02:04 +09:00
parent bcabe99d53
commit a6dd6b1275
4 changed files with 44 additions and 4 deletions

View File

@ -189,7 +189,7 @@
<!-- / CHAT TOOLBAR -->
<div style="position: relative;">
<div
*ngIf="eventListProcessing$ | async"
*ngIf="(eventListProcessing$ | async) || isTranslationProcess"
style="position: absolute; width: 100%;"
>
<mat-progress-bar mode="indeterminate"></mat-progress-bar>

View File

@ -172,6 +172,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
selectedSticker: StickerFilesInfo;
/** About Translation */
isTranslationProcess = false;
isShowTranslation = false;
translationSimpleview = false;
translationPreview = false;
@ -376,6 +377,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.onCloseSearchArea();
// Translate Clear..
this.isTranslationProcess = false;
this.isShowTranslation = false;
this.translationSimpleview = false;
this.translationPreview = false;
@ -628,6 +630,12 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
const destLocale = this.destLocale;
const original = message;
const roomSeq = this.roomInfo.roomSeq;
if (!!this.isTranslationProcess) {
return;
}
this.isTranslationProcess = true;
this.commonApiService
.translationSave({
userSeq: this.loginRes.userSeq,
@ -703,7 +711,9 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
}),
catchError(error => of(this.logger.error(error)))
)
.subscribe();
.subscribe(() => {
this.isTranslationProcess = false;
});
} else if (!!this.selectedSticker) {
/** CASE : Sticker */
if (
@ -1485,6 +1495,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
this.destLocale = destLocale;
}
onCancelTranslation() {
this.isTranslationProcess = false;
this.translationPreviewInfo = null;
}
onSendTranslationMessage(params: {
@ -1517,6 +1528,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
})
);
this.isTranslationProcess = false;
this.translationPreviewInfo = null;
}
}

View File

@ -41,7 +41,9 @@ import {
EventJson,
StickerEventJson,
FileEventJson,
MassTextEventJson
MassTextEventJson,
TranslationEventJson,
MassTranslationEventJson
} from '@ucap-webmessenger/protocol-event';
import * as ChatStore from '@app/store/messenger/chat';
@ -320,6 +322,18 @@ export class Effects {
) {
contents = (event.sentMessageJson as MassTextEventJson)
.content;
} else if (
event.type === EventType.Translation &&
!!event.sentMessageJson
) {
contents = (event.sentMessageJson as TranslationEventJson)
.original;
} else if (
event.type === EventType.MassTranslation &&
!!event.sentMessageJson
) {
contents = (event.sentMessageJson as MassTranslationEventJson)
.original;
}
return contents.indexOf(action.searchText) > -1;

View File

@ -2,7 +2,9 @@ import {
EventType,
EventJson,
FileEventJson,
MassTextEventJson
MassTextEventJson,
TranslationEventJson,
MassTranslationEventJson
} from '@ucap-webmessenger/protocol-event';
import { FileType } from '@ucap-webmessenger/protocol-file';
@ -192,6 +194,18 @@ export class StringUtil {
eventMessage = m.content;
}
break;
case EventType.Translation:
{
const m = finalEventMessage as TranslationEventJson;
eventMessage = m.original;
}
break;
case EventType.MassTranslation:
{
const m = finalEventMessage as MassTranslationEventJson;
eventMessage = m.original;
}
break;
default:
{