From 9153a92dab7d2d5cf6fc9130f613f53af4aab625 Mon Sep 17 00:00:00 2001 From: leejinho Date: Thu, 23 Jan 2020 10:03:48 +0900 Subject: [PATCH] =?UTF-8?q?#=20=EC=9D=B4=EC=8A=88=EC=B2=98=EB=A6=AC=20172?= =?UTF-8?q?=20=EB=B2=88=EC=97=ADon=20=ED=9B=84=20=EC=8A=A4=ED=8B=B0?= =?UTF-8?q?=EC=BB=A4=20=EB=B0=9C=EC=8B=A0=20=EC=8B=9C=20=EB=B0=9C=EC=8B=A0?= =?UTF-8?q?=EB=90=98=EC=A7=80=20=EC=95=8A=EC=9D=8C=20175=20=EC=AA=BD?= =?UTF-8?q?=EC=A7=80=20=EA=B2=80=EC=83=89=20=ED=9B=84=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A1=A4=20=EC=8B=9C=20=ED=94=8C=EB=A1=9C=ED=8C=85=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EA=B3=A0=EC=A0=95=EB=90=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EC=9D=8C=20178=20=EB=8F=99=EC=9D=BC=ED=95=9C=20=EA=B7=B8?= =?UTF-8?q?=EB=A3=B9=EC=97=90=20=EB=8C=80=ED=99=94=20=EC=83=81=EB=8C=80=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99=EC=8B=9C=20=EC=82=AC=EC=9A=A9=EC=9E=90=20?= =?UTF-8?q?=EC=82=AC=EB=9D=BC=EC=A7=90=20182=20=ED=87=B4=EC=9E=A5/?= =?UTF-8?q?=EA=B0=95=ED=87=B4=ED=95=9C=20=EC=82=AC=EC=9A=A9=EC=9E=90=20?= =?UTF-8?q?=EA=B7=B8=EB=A3=B9=EB=A9=A4=EB=B2=84=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=EB=90=98=EC=96=B4=20=EC=9E=88=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../left-sidenav/group.component.ts | 3 +- .../left-sidenav/message.component.html | 20 +- .../left-sidenav/organization.component.html | 2 + .../components/messages.component.ts | 323 ++++++++++-------- .../group/select-group.dialog.component.html | 1 + .../group/select-group.dialog.component.ts | 64 ++++ 6 files changed, 252 insertions(+), 161 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts index f1f11d22..a86d852e 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts @@ -563,7 +563,8 @@ export class GroupComponent implements OnInit, OnDestroy { >(SelectGroupDialogComponent, { width: '600px', data: { - title: this.translateService.instant('group.selectTargetGroup') + title: this.translateService.instant('group.selectTargetGroup'), + ignoreGroup: [group] } }); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html index ea4bcd20..4f968eb7 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.html @@ -88,10 +88,10 @@ -
+
- +
-
- +
+ + +
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html index b00f5106..77995867 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html @@ -81,6 +81,7 @@ (click)="onToggleUser(userInfo)" (contextmenu)="onContextMenuOrgUser($event, userInfo)" [matTooltip]="getTooltip(userInfo)" + matTooltipShowDelay="500" matTooltipPosition="after" > @@ -105,6 +106,7 @@ (click)="onToggleUser(userInfo)" (contextmenu)="onContextMenuOrgUser($event, userInfo)" [matTooltip]="getTooltip(userInfo)" + matTooltipShowDelay="500" matTooltipPosition="after" > 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 ba4ec505..7177bf8f 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 @@ -638,170 +638,190 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { if (!!this.isShowTranslation && this.destLocale.trim().length > 0) { /** CASE : Translation */ - const destLocale = this.destLocale; - const original = message; - const roomSeq = this.roomInfoSubject.value.roomSeq; - - if (!!this.isTranslationProcess) { - return; + // 번역할 대화 없이 스티커만 전송할 경우. + if (!message || message.trim().length === 0) { + this.sendMessageOfSticker(message); + } else { + this.sendMessageOfTranslate(message); } - - this.isTranslationProcess = true; - this.commonApiService - .translationSave({ - userSeq: this.loginResSubject.value.userSeq, - deviceType: this.environmentsInfo.deviceType, - token: this.loginResSubject.value.tokenString, - roomSeq, - original, - srcLocale: '', - destLocale - } as TranslationSaveRequest) - .pipe( - take(1), - map(res => { - if (res.statusCode === StatusCode.Success) { - let sentMessage = ''; - let eventType = EventType.Translation; - let previewObject: - | TranslationEventJson - | MassTranslationEventJson; - - if (res.translationSeq > 0) { - // Mass Text Translation - previewObject = res; - sentMessage = res.returnJson; - eventType = EventType.MassTranslation; - } else { - // Normal Text Translation - previewObject = { - locale: destLocale, - original, - translation: res.translation, - stickername: '', - stickerfile: !!this.selectedSticker - ? this.selectedSticker.index - : '' - }; - - sentMessage = JSON.stringify(previewObject); - eventType = EventType.Translation; - } - - if (!!this.translationPreview) { - // preview - this.translationPreviewInfo = { - previewInfo: res, - translationType: eventType - }; - } else { - // direct send - this.store.dispatch( - EventStore.send({ - senderSeq: this.loginResSubject.value.userSeq, - req: { - roomSeq, - eventType, - sentMessage - } - }) - ); - - if (!!this.translationPreviewInfo) { - this.translationPreviewInfo = null; - } - } - - if (!!this.selectedSticker) { - this.isShowStickerSelector = false; - this.setStickerHistory(this.selectedSticker); - this.selectedSticker = null; - } - } else { - this.logger.error(res); - } - }), - catchError(error => of(this.logger.error(error))) - ) - .subscribe(() => { - this.isTranslationProcess = false; - }); } else if (!!this.selectedSticker) { /** CASE : Sticker */ - if ( - !!message && - message.trim().length > - environment.productConfig.CommonSetting.masstextLength - ) { - const result = await this.dialogService.open< - AlertDialogComponent, - AlertDialogData, - AlertDialogResult - >(AlertDialogComponent, { - width: '360px', - data: { - title: this.translateService.instant('chat.errors.label'), - message: this.translateService.instant( - 'chat.errors.maxLengthOfMassText', - { - maxLength: - environment.productConfig.CommonSetting.masstextLength - } - ) - } - }); - return; - } - - const stickerJson: StickerEventJson = { - name: '스티커', - file: this.selectedSticker.index, - chat: !!message ? message.trim() : '' - }; - this.store.dispatch( - EventStore.send({ - senderSeq: this.loginResSubject.value.userSeq, - req: { - roomSeq: this.roomInfoSubject.value.roomSeq, - eventType: EventType.Sticker, - sentMessage: JSON.stringify(stickerJson) - } - }) - ); - this.isShowStickerSelector = false; - this.setStickerHistory(this.selectedSticker); - this.selectedSticker = null; + this.sendMessageOfSticker(message); } else if ( message.trim().length > environment.productConfig.CommonSetting.masstextLength ) { /** CASE : MASS TEXT */ - this.store.dispatch( - EventStore.sendMass({ - senderSeq: this.loginResSubject.value.userSeq, - req: { - roomSeq: this.roomInfoSubject.value.roomSeq, - eventType: EventType.MassText, - // sentMessage: message.replace(/\n/gi, '\r\n') - sentMessage: message - } - }) - ); + this.sendMessageOfMassText(message); } else { /** CASE : Normal Text */ - this.store.dispatch( - EventStore.send({ - senderSeq: this.loginResSubject.value.userSeq, - req: { - roomSeq: this.roomInfoSubject.value.roomSeq, - eventType: EventType.Character, - sentMessage: message - } - }) - ); + this.sendMessageOfNormal(message); } } + /** Send Normal message */ + sendMessageOfNormal(message: string) { + this.store.dispatch( + EventStore.send({ + senderSeq: this.loginResSubject.value.userSeq, + req: { + roomSeq: this.roomInfoSubject.value.roomSeq, + eventType: EventType.Character, + sentMessage: message + } + }) + ); + } + /** Send Sticker message */ + async sendMessageOfSticker(message: string, isCheck: boolean = true) { + if ( + !!isCheck && + !!message && + message.trim().length > + environment.productConfig.CommonSetting.masstextLength + ) { + const result = await this.dialogService.open< + AlertDialogComponent, + AlertDialogData, + AlertDialogResult + >(AlertDialogComponent, { + width: '360px', + data: { + title: this.translateService.instant('chat.errors.label'), + message: this.translateService.instant( + 'chat.errors.maxLengthOfMassText', + { + maxLength: environment.productConfig.CommonSetting.masstextLength + } + ) + } + }); + return; + } + + const stickerJson: StickerEventJson = { + name: '스티커', + file: this.selectedSticker.index, + chat: !!message ? message.trim() : '' + }; + this.store.dispatch( + EventStore.send({ + senderSeq: this.loginResSubject.value.userSeq, + req: { + roomSeq: this.roomInfoSubject.value.roomSeq, + eventType: EventType.Sticker, + sentMessage: JSON.stringify(stickerJson) + } + }) + ); + this.isShowStickerSelector = false; + this.setStickerHistory(this.selectedSticker); + this.selectedSticker = null; + } + /** Send Masstext message */ + sendMessageOfMassText(message: string) { + this.store.dispatch( + EventStore.sendMass({ + senderSeq: this.loginResSubject.value.userSeq, + req: { + roomSeq: this.roomInfoSubject.value.roomSeq, + eventType: EventType.MassText, + // sentMessage: message.replace(/\n/gi, '\r\n') + sentMessage: message + } + }) + ); + } + /** Send Translation message */ + sendMessageOfTranslate(message: string) { + const destLocale = this.destLocale; + const original = message; + const roomSeq = this.roomInfoSubject.value.roomSeq; + + if (!!this.isTranslationProcess) { + return; + } + + this.isTranslationProcess = true; + this.commonApiService + .translationSave({ + userSeq: this.loginResSubject.value.userSeq, + deviceType: this.environmentsInfo.deviceType, + token: this.loginResSubject.value.tokenString, + roomSeq, + original, + srcLocale: '', + destLocale + } as TranslationSaveRequest) + .pipe( + take(1), + map(res => { + if (res.statusCode === StatusCode.Success) { + let sentMessage = ''; + let eventType = EventType.Translation; + let previewObject: TranslationEventJson | MassTranslationEventJson; + + if (res.translationSeq > 0) { + // Mass Text Translation + previewObject = res; + sentMessage = res.returnJson; + eventType = EventType.MassTranslation; + } else { + // Normal Text Translation + previewObject = { + locale: destLocale, + original, + translation: res.translation, + stickername: '', + stickerfile: !!this.selectedSticker + ? this.selectedSticker.index + : '' + }; + + sentMessage = JSON.stringify(previewObject); + eventType = EventType.Translation; + } + + if (!!this.translationPreview) { + // preview + this.translationPreviewInfo = { + previewInfo: res, + translationType: eventType + }; + } else { + // direct send + this.store.dispatch( + EventStore.send({ + senderSeq: this.loginResSubject.value.userSeq, + req: { + roomSeq, + eventType, + sentMessage + } + }) + ); + + if (!!this.translationPreviewInfo) { + this.translationPreviewInfo = null; + } + } + + if (!!this.selectedSticker) { + this.isShowStickerSelector = false; + this.setStickerHistory(this.selectedSticker); + this.selectedSticker = null; + } + } else { + this.logger.error(res); + } + }), + catchError(error => of(this.logger.error(error))) + ) + .subscribe(() => { + this.isTranslationProcess = false; + }); + } + onClickReceiveAlarm() { this.store.dispatch( RoomStore.updateOnlyAlarm({ roomInfo: this.roomInfoSubject.value }) @@ -1592,6 +1612,7 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit { const trgtUserSeq: number[] = []; result.group.userSeqs.map(seq => trgtUserSeq.push(seq)); this.userInfoListSubject.value + .filter(v => v.isJoinRoom) .filter(v => result.group.userSeqs.indexOf(v.seq) < 0) .forEach(user => { trgtUserSeq.push(user.seq); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.html index 7920b211..bfe1f51d 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.html @@ -63,6 +63,7 @@ {{ groupBuddy.group.name }} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.ts index 20918071..9504004b 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/group/select-group.dialog.component.ts @@ -24,6 +24,7 @@ import { TranslateService } from '@ngx-translate/core'; export interface SelectGroupDialogData { title: string; + ignoreGroup?: GroupDetailData[]; } export interface SelectGroupDialogResult { @@ -71,6 +72,44 @@ export class SelectGroupDialogComponent implements OnInit { ) ]).pipe( map(([buddyList, groupList]) => { + // sort.. + if (!!groupList && groupList.length > 0) { + const tempOrderArr: GroupDetailData[] = []; + let myDeptGroup: GroupDetailData; + let defaultGroup: GroupDetailData; + const normalGroup: GroupDetailData[] = []; + + groupList.forEach(group => { + if ( + !!environment.productConfig.CommonSetting.useMyDeptGroup && + environment.productConfig.CommonSetting.myDeptGroupSeq === + group.seq + ) { + myDeptGroup = group; + } else if (0 === group.seq) { + defaultGroup = group; + } else { + normalGroup.push(group); + } + }); + + if (!!myDeptGroup) { + tempOrderArr.push(myDeptGroup); + } + + tempOrderArr.push( + ...normalGroup.sort((a, b) => + a.name < b.name ? -1 : a.name > b.name ? 1 : 0 + ) + ); + + if (!!defaultGroup) { + tempOrderArr.push(defaultGroup); + } + + groupList = tempOrderArr; + } + /** 수정불가 그룹 */ let fixedGroupSeqs: number[]; if (!!environment.productConfig.CommonSetting.fixedGroupSeqs) { @@ -90,6 +129,17 @@ export class SelectGroupDialogComponent implements OnInit { } } + /** 선택 무시 그룹 필터링. */ + if (!!this.data.ignoreGroup && this.data.ignoreGroup.length > 0) { + if ( + this.data.ignoreGroup.filter( + groupDetail => groupDetail.seq === group.seq + ).length > 0 + ) { + continue; + } + } + groupBuddyList.push({ group, buddyList: buddyList.filter(buddy => { @@ -140,4 +190,18 @@ export class SelectGroupDialogComponent implements OnInit { group: this.selectedGroup }); } + + getDisabled(groupBuddyList: { + group: GroupDetailData; + buddyList: UserInfo[]; + }): boolean { + if (!!this.data.ignoreGroup && this.data.ignoreGroup.length > 0) { + return ( + this.data.ignoreGroup.filter( + groupDetail => groupDetail.seq === groupBuddyList.group.seq + ).length > 0 + ); + } + return false; + } }