diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html index 9e1aae3f..44fc1be7 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.html @@ -189,7 +189,7 @@
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts index 2045913b..adf5d7c7 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts @@ -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; } } diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts index 00032a82..a73eb433 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts @@ -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; diff --git a/projects/ucap-webmessenger-ui/src/lib/utils/string.util.ts b/projects/ucap-webmessenger-ui/src/lib/utils/string.util.ts index 939a00eb..90324351 100644 --- a/projects/ucap-webmessenger-ui/src/lib/utils/string.util.ts +++ b/projects/ucap-webmessenger-ui/src/lib/utils/string.util.ts @@ -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: {