쪽지 연결.

This commit is contained in:
leejinho 2019-12-11 08:18:32 +09:00
parent b81975be9b
commit 4e5ace1d40
12 changed files with 259 additions and 56 deletions

View File

@ -27,7 +27,7 @@
>
<ucap-group-expansion-panel
#groupExpansionPanel
[groupBuddyList]="groupBuddyList$ | async"
[groupBuddyList]="groupBuddyList"
[favoritBuddyList]="favoritBuddyList$ | async"
[myProfileInfo]="loginRes.userInfo"
(more)="onMoreGroup($event)"
@ -190,8 +190,8 @@
</button>
<button
mat-menu-item
*ngIf="getShowProfileContextMenu('SEND_NOTE', userInfo, group)"
(click)="onClickProfileContextMenu('SEND_NOTE', userInfo)"
*ngIf="getShowProfileContextMenu('SEND_MESSAGE', userInfo, group)"
(click)="onClickProfileContextMenu('SEND_MESSAGE', userInfo)"
>
쪽지 보내기
</button>
@ -227,8 +227,8 @@
</button>
<button
mat-menu-item
*ngIf="getShowGroupContextMenu('SEND_NOTE', group)"
(click)="onClickGroupContextMenu('SEND_NOTE', group)"
*ngIf="getShowGroupContextMenu('SEND_MESSAGE', group)"
(click)="onClickGroupContextMenu('SEND_MESSAGE', group)"
>
그룹 쪽지 보내기
</button>

View File

@ -21,7 +21,13 @@ import { NGXLogger } from 'ngx-logger';
import { Company } from '@ucap-webmessenger/api-external';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { LoginInfo, KEY_LOGIN_INFO, UserSelectDialogType } from '@app/types';
import {
LoginInfo,
KEY_LOGIN_INFO,
UserSelectDialogType,
EnvironmentsInfo,
KEY_ENVIRONMENTS_INFO
} from '@app/types';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
@ -61,6 +67,11 @@ import {
SelectGroupDialogResult,
SelectGroupDialogData
} from '../../dialogs/group/select-group.dialog.component';
import {
MessageWriteDialogComponent,
MessageWriteDialogResult,
MessageWriteDialogData
} from '../../dialogs/message/message-write.dialog.component';
@Component({
selector: 'app-layout-chat-left-sidenav-group',
@ -87,15 +98,16 @@ export class GroupComponent implements OnInit, OnDestroy {
groupContextMenuTrigger: MatMenuTrigger;
groupContextMenuPosition = { x: '0px', y: '0px' };
groupBuddyList$: Observable<
{ group: GroupDetailData; buddyList: UserInfo[] }[]
>;
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }[];
groupBuddyListSubscription: Subscription;
favoritBuddyList$: Observable<UserInfo[]>;
companyList$: Observable<Company[]>;
companyCode: string;
loginRes: LoginResponse;
loginResSubscription: Subscription;
environmentsInfo: EnvironmentsInfo;
sessionVerinfo: VersionInfo2Response;
@ -110,7 +122,11 @@ export class GroupComponent implements OnInit, OnDestroy {
private queryProtocolService: QueryProtocolService,
private statusProtocolService: StatusProtocolService,
private logger: NGXLogger
) {}
) {
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
KEY_ENVIRONMENTS_INFO
);
}
ngOnInit() {
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
@ -132,31 +148,35 @@ export class GroupComponent implements OnInit, OnDestroy {
select(AppStore.SettingSelector.CompanySelector.companyList)
);
this.groupBuddyList$ = combineLatest([
this.groupBuddyListSubscription = combineLatest([
this.store.pipe(
select(AppStore.MessengerSelector.SyncSelector.selectAllBuddy2)
),
this.store.pipe(
select(AppStore.MessengerSelector.SyncSelector.selectAllGroup2)
)
]).pipe(
map(([buddyList, groupList]) => {
const groupBuddyList: {
group: GroupDetailData;
buddyList: UserInfo[];
}[] = [];
for (const group of groupList) {
groupBuddyList.push({
group,
buddyList: buddyList.filter(buddy => {
return group.userSeqs.indexOf(buddy.seq) > -1;
})
});
}
])
.pipe(
map(([buddyList, groupList]) => {
const groupBuddyList: {
group: GroupDetailData;
buddyList: UserInfo[];
}[] = [];
for (const group of groupList) {
groupBuddyList.push({
group,
buddyList: buddyList.filter(buddy => {
return group.userSeqs.indexOf(buddy.seq) > -1;
})
});
}
return groupBuddyList;
})
);
this.groupBuddyList = groupBuddyList;
return groupBuddyList;
})
)
.subscribe();
this.favoritBuddyList$ = this.store
.pipe(select(AppStore.MessengerSelector.SyncSelector.selectAllBuddy2))
@ -173,6 +193,9 @@ export class GroupComponent implements OnInit, OnDestroy {
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
if (!!this.groupBuddyListSubscription) {
this.groupBuddyListSubscription.unsubscribe();
}
this.logger.debug('-----------------------GroupComponent ngOnDestroy');
}
@ -333,7 +356,7 @@ export class GroupComponent implements OnInit, OnDestroy {
if (!group || group === undefined) {
if (
menuType === 'REGISTER_FAVORITE' ||
menuType === 'SEND_NOTE' ||
menuType === 'SEND_MESSAGE' ||
menuType === 'REGISTER_NICKNAME'
) {
// continue;
@ -465,6 +488,25 @@ export class GroupComponent implements OnInit, OnDestroy {
})
);
break;
case 'SEND_MESSAGE':
{
this.dialogService.open<
MessageWriteDialogComponent,
MessageWriteDialogData,
MessageWriteDialogResult
>(MessageWriteDialogComponent, {
width: '600px',
height: '600px',
disableClose: true,
hasBackdrop: false,
data: {
loginRes: this.loginRes,
environmentsInfo: this.environmentsInfo,
receiverList: [userInfo]
}
});
}
break;
}
}
@ -501,7 +543,30 @@ export class GroupComponent implements OnInit, OnDestroy {
ChatStore.openRoom({ userSeqList: group.userSeqs })
);
break;
case 'SEND_NOTE':
case 'SEND_MESSAGE':
{
const curGroupBuddyList = this.groupBuddyList.filter(
groupInfo => groupInfo.group.seq === group.seq
);
if (!!curGroupBuddyList && curGroupBuddyList.length > 0) {
this.dialogService.open<
MessageWriteDialogComponent,
MessageWriteDialogData,
MessageWriteDialogResult
>(MessageWriteDialogComponent, {
width: '600px',
height: '600px',
disableClose: true,
hasBackdrop: false,
data: {
loginRes: this.loginRes,
environmentsInfo: this.environmentsInfo,
receiverList: curGroupBuddyList[0].buddyList
}
});
}
}
break;
case 'RENAME':
{

View File

@ -48,6 +48,7 @@ import {
MessageDetailDialogResult,
MessageDetailDialogData
} from '../../dialogs/message/message-detail.dialog.component';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
@Component({
selector: 'app-layout-chat-left-sidenav-message',
@ -70,6 +71,7 @@ export class MessageBoxComponent
loginRes: LoginResponse;
sessionVerinfo: VersionInfo2Response;
environmentsInfo: EnvironmentsInfo;
messageList: MessageList[] = [];
@ -108,6 +110,9 @@ export class MessageBoxComponent
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
KEY_VER_INFO
);
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
KEY_ENVIRONMENTS_INFO
);
}
ngOnInit() {
@ -357,7 +362,8 @@ export class MessageBoxComponent
width: '600px',
data: {
detail: res,
loginRes: this.loginRes
loginRes: this.loginRes,
environmentsInfo: this.environmentsInfo
}
});

View File

@ -34,10 +34,17 @@ import { NGXLogger } from 'ngx-logger';
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { MessageStatusCode } from '@ucap-webmessenger/api';
import { of } from 'rxjs';
import {
MessageWriteDialogComponent,
MessageWriteDialogResult,
MessageWriteDialogData
} from './message-write.dialog.component';
import { EnvironmentsInfo } from '@app/types';
export interface MessageDetailDialogData {
detail: DetailResponse;
loginRes: LoginResponse;
environmentsInfo: EnvironmentsInfo;
}
export interface MessageDetailDialogResult {
@ -428,6 +435,25 @@ export class MessageDetailDialogComponent implements OnInit {
}
}
break;
case 'MESSAGE_UPDATE':
{
this.dialogService.open<
MessageWriteDialogComponent,
MessageWriteDialogData,
MessageWriteDialogResult
>(MessageWriteDialogComponent, {
width: '600px',
height: '600px',
disableClose: true,
hasBackdrop: false,
data: {
loginRes: this.data.loginRes,
environmentsInfo: this.data.environmentsInfo,
detail: this.data.detail
}
});
}
break;
}
}

View File

@ -7,6 +7,8 @@
<mat-card-content>
<ucap-message-write
#messageWrite
[detail]="data.detail"
[curReceiverList]="data.receiverList"
(send)="onSend($event)"
(selectReceiver)="onSelectReceiver($event)"
(cancel)="onCancel()"

View File

@ -6,7 +6,8 @@ import { DialogService, SnackBarService } from '@ucap-webmessenger/ui';
import {
DetailResponse,
DetailContent,
MessageApiService
MessageApiService,
DetailReceiver
} from '@ucap-webmessenger/api-message';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
@ -29,6 +30,7 @@ export interface MessageWriteDialogData {
loginRes: LoginResponse;
environmentsInfo: EnvironmentsInfo;
detail?: DetailResponse;
receiverList?: UserInfo[];
}
// tslint:disable-next-line: no-empty-interface
@ -117,7 +119,7 @@ export class MessageWriteDialogComponent implements OnInit {
duration: 3000,
verticalPosition: 'bottom'
});
this.dialogRef.close({});
// this.dialogRef.close({});
}
);
}

View File

@ -5,6 +5,7 @@
[isBuddy]="isBuddy"
[isFavorit]="isFavorit"
(openChat)="onClickChat($event)"
(sendMessage)="onClickSendMessage($event)"
(toggleFavorit)="onClickToggleFavorit($event)"
(toggleBuddy)="onClickToggleBuddy($event)"
(uploadProfileImage)="onUploadProfileImage($event)"

View File

@ -36,6 +36,11 @@ import { FileUploadItem } from '@ucap-webmessenger/api';
import { CommonApiService } from '@ucap-webmessenger/api-common';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
import { StatusCode } from '@ucap-webmessenger/api';
import {
MessageWriteDialogComponent,
MessageWriteDialogResult,
MessageWriteDialogData
} from '../message/message-write.dialog.component';
export interface ProfileDialogData {
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
@ -119,6 +124,28 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
this.dialogRef.close();
}
onClickSendMessage(userInfo: UserInfo) {
if (userInfo.seq !== this.loginRes.userSeq) {
this.dialogRef.close();
this.dialogService.open<
MessageWriteDialogComponent,
MessageWriteDialogData,
MessageWriteDialogResult
>(MessageWriteDialogComponent, {
width: '600px',
height: '600px',
disableClose: true,
hasBackdrop: false,
data: {
loginRes: this.loginRes,
environmentsInfo: this.environmentsInfo,
receiverList: [userInfo]
}
});
}
}
onClickToggleFavorit(param: {
userInfo: UserInfo | UserInfoF;
isFavorit: boolean;

View File

@ -20,24 +20,26 @@
</mat-list>
</mat-card-content>
<mat-form-field class="message-receiver-list">
<mat-chip-list #chipList aria-label="receiver selection">
<mat-chip
*ngFor="let receiver of receiverList"
removable="true"
(removed)="onRemovedReceiver(receiver)"
>
{{ receiver.name }}
<span matChipRemove class="mdi mdi-close"></span>
</mat-chip>
<input
[matChipInputFor]="chipList"
placeholder="수신자"
readonly
(click)="onClickReceiverList()"
/>
</mat-chip-list>
</mat-form-field>
<perfect-scrollbar>
<mat-form-field class="message-receiver-list">
<mat-chip-list #chipList aria-label="receiver selection">
<mat-chip
*ngFor="let receiver of receiverList"
removable="true"
(removed)="onRemovedReceiver(receiver)"
>
{{ receiver.name }}
<span matChipRemove class="mdi mdi-close"></span>
</mat-chip>
<input
[matChipInputFor]="chipList"
placeholder="수신자"
readonly
(click)="onClickReceiverList()"
/>
</mat-chip-list>
</mat-form-field>
</perfect-scrollbar>
<mat-card-actions>
<div class="editor-tools">

View File

@ -4,6 +4,7 @@
.message-receiver-list {
width: 100%;
height: 100px;
}
.message-title {
@ -18,7 +19,7 @@
display: inline-block;
width: 100%;
height: 100%;
min-height: 270px;
min-height: 250px;
}
[contenteditable] {

View File

@ -7,7 +7,8 @@ import {
AfterViewInit,
ChangeDetectorRef,
OnDestroy,
ElementRef
ElementRef,
Input
} from '@angular/core';
import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui';
@ -17,11 +18,13 @@ import { NGXLogger } from 'ngx-logger';
import moment from 'moment';
import { FileUtil } from '@ucap-webmessenger/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { FormGroup, FormBuilder } from '@angular/forms';
import {
ContentType,
CategoryType,
MessageType
MessageType,
DetailResponse,
DetailReceiver
} from '@ucap-webmessenger/api-message';
import { FileUploadItem } from '@ucap-webmessenger/api';
import { UserInfo } from '@ucap-webmessenger/protocol-sync';
@ -30,6 +33,8 @@ import {
ScheduleSendDialogData,
ScheduleSendDialogResult
} from '../dialogs/schedule-send.dialog.component';
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
import { EmployeeType } from '@ucap-webmessenger/protocol-room';
const ATTR_FILE = 'UCAP_ATTR_FILE';
@ -58,6 +63,11 @@ export interface Message {
animations: ucapAnimations
})
export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
@Input()
curReceiverList: UserInfo[] = [];
@Input()
detail?: DetailResponse;
@Output()
send = new EventEmitter<Message>();
@ -79,6 +89,8 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
receiverList: UserInfo[] = [];
contentLength = 0;
isModify = false;
constructor(
private formBuilder: FormBuilder,
private dialogService: DialogService,
@ -90,6 +102,27 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
this.messageWriteForm = this.formBuilder.group({
title: ['', []]
});
if (!!this.curReceiverList && this.curReceiverList.length > 0) {
this.receiverList = this.curReceiverList;
} else if (!!this.detail && this.detail.recvList.length > 0) {
this.receiverList = this.detail.recvList.map(recvInfo =>
this.convertDetailReceivertoUserInfo(recvInfo)
);
}
if (!!this.detail && !!this.detail.msgInfo) {
this.isModify = true;
if (!!this.detail.msgInfo.title) {
this.messageWriteForm.setValue({ title: this.detail.msgInfo.title });
}
if (!!this.detail.contents && this.detail.contents.length > 0) {
// 내용이 있다.
this.detail.contents.map(cont => console.log(cont));
}
}
}
ngOnDestroy(): void {}
@ -379,4 +412,38 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
range.insertNode(node);
}
private convertDetailReceivertoUserInfo(base: DetailReceiver): UserInfo {
return {
seq: base.userSeq,
name: base.userName,
profileImageFile: '',
grade: '',
intro: '',
companyCode: '',
hpNumber: '',
lineNumber: '',
email: '',
isMobile: false,
deptName: '',
isFavorit: false,
isBuddy: false,
isActive: false,
roleCd: RoleCode.Self,
employeeNum: '',
madn: '',
hardSadn: '',
fmcSadn: '',
nameEn: '',
nameCn: '',
gradeEn: '',
gradeCn: '',
deptNameEn: '',
deptNameCn: '',
isPrivacyAgree: false,
isValidLogin: false,
employeeType: EmployeeType.Regular,
nickName: ''
};
}
}

View File

@ -33,6 +33,8 @@ export class ProfileComponent implements OnInit {
@Output()
openChat = new EventEmitter<UserInfo | UserInfoF>();
@Output()
sendMessage = new EventEmitter<UserInfo | UserInfoF>();
@Output()
toggleFavorit = new EventEmitter<{
userInfo: UserInfo | UserInfoF;
isFavorit: boolean;
@ -65,7 +67,9 @@ export class ProfileComponent implements OnInit {
onClickVideoConference() {}
onClickMessage() {}
onClickMessage() {
this.sendMessage.emit(this.userInfo);
}
onToggleFavorit() {
this.isFavorit = !this.isFavorit;