# 이슈처리 234

This commit is contained in:
leejinho 2020-02-19 10:26:12 +09:00
parent 53e7d5026a
commit cb121b3612
2 changed files with 107 additions and 95 deletions

View File

@ -5,7 +5,8 @@ import {
ViewChild,
OnDestroy,
EventEmitter,
Output
Output,
NgZone
} from '@angular/core';
import {
@ -138,7 +139,8 @@ export class GroupComponent implements OnInit, OnDestroy {
private dialogService: DialogService,
private queryProtocolService: QueryProtocolService,
private translateService: TranslateService,
private logger: NGXLogger
private logger: NGXLogger,
private ngZone: NgZone
) {
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
KEY_ENVIRONMENTS_INFO
@ -689,115 +691,126 @@ export class GroupComponent implements OnInit, OnDestroy {
break;
case 'SEND_MESSAGE':
{
let receiverList: UserInfo[] = [];
const isFavGroup =
group.seq < 0 && group.name === 'Favorit' ? true : false;
this.ngZone.run(() => {
let receiverList: UserInfo[] = [];
const isFavGroup =
group.seq < 0 && group.name === 'Favorit' ? true : false;
if (!!isFavGroup) {
receiverList = this.favoritBuddyList;
} else {
const curGroupBuddyList = this.groupBuddyList.filter(
groupInfo => groupInfo.group.seq === group.seq
);
if (!!curGroupBuddyList && curGroupBuddyList.length > 0) {
receiverList = curGroupBuddyList[0].buddyList;
}
}
if (receiverList.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
if (!!isFavGroup) {
receiverList = this.favoritBuddyList;
} else {
const curGroupBuddyList = this.groupBuddyList.filter(
groupInfo => groupInfo.group.seq === group.seq
);
if (!!curGroupBuddyList && curGroupBuddyList.length > 0) {
receiverList = curGroupBuddyList[0].buddyList;
}
});
}
}
if (receiverList.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
}
});
}
});
}
break;
case 'RENAME':
{
const result = await this.dialogService.open<
EditGroupDialogComponent,
EditGroupDialogData,
EditGroupDialogResult
>(EditGroupDialogComponent, {
data: {
title: this.translateService.instant('group.changeGroupName'),
group
this.ngZone.run(async () => {
const result = await this.dialogService.open<
EditGroupDialogComponent,
EditGroupDialogData,
EditGroupDialogResult
>(EditGroupDialogComponent, {
data: {
title: this.translateService.instant('group.changeGroupName'),
group
}
});
if (!!result && !!result.choice && result.choice) {
if (!!result.groupName && result.groupName.trim().length > 0) {
this.store.dispatch(
SyncStore.updateGroup({
groupSeq: result.group.seq,
groupName: result.groupName,
userSeqs: result.group.userSeqs
})
);
}
}
});
if (!!result && !!result.choice && result.choice) {
if (!!result.groupName && result.groupName.trim().length > 0) {
this.store.dispatch(
SyncStore.updateGroup({
groupSeq: result.group.seq,
groupName: result.groupName,
userSeqs: result.group.userSeqs
})
);
}
}
}
break;
case 'EDIT_MEMBER':
{
const result = await this.dialogService.open<
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
>(CreateChatDialogComponent, {
width: '600px',
data: {
type: UserSelectDialogType.EditMember,
title: this.translateService.instant('group.modifyGroupMember'),
group
this.ngZone.run(async () => {
const result = await this.dialogService.open<
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
>(CreateChatDialogComponent, {
width: '600px',
data: {
type: UserSelectDialogType.EditMember,
title: this.translateService.instant('group.modifyGroupMember'),
group
}
});
if (!!result && !!result.choice && result.choice) {
if (!!result.oldGroup) {
const userSeqs: number[] = [];
result.selectedUserList.map(user => userSeqs.push(user.seq));
this.store.dispatch(
SyncStore.updateGroupMember({
oldGroup: group,
trgtUserSeq: userSeqs
})
);
}
}
});
if (!!result && !!result.choice && result.choice) {
if (!!result.oldGroup) {
const userSeqs: number[] = [];
result.selectedUserList.map(user => userSeqs.push(user.seq));
this.store.dispatch(
SyncStore.updateGroupMember({
oldGroup: group,
trgtUserSeq: userSeqs
})
);
}
}
}
break;
case 'DELETE':
{
const result = await this.dialogService.open<
ConfirmDialogComponent,
ConfirmDialogData,
ConfirmDialogResult
>(ConfirmDialogComponent, {
width: '360px',
data: {
title: this.translateService.instant('group.removeGroup'),
html: this.translateService.instant('group.confirmRemoveGroup', {
nameOfGroup: `${group.name}`
})
this.ngZone.run(async () => {
const result = await this.dialogService.open<
ConfirmDialogComponent,
ConfirmDialogData,
ConfirmDialogResult
>(ConfirmDialogComponent, {
width: '360px',
data: {
title: this.translateService.instant('group.removeGroup'),
html: this.translateService.instant(
'group.confirmRemoveGroup',
{
nameOfGroup: `${group.name}`
}
)
}
});
if (!!result && !!result.choice && result.choice) {
this.store.dispatch(SyncStore.delGroup({ group }));
}
});
if (!!result && !!result.choice && result.choice) {
this.store.dispatch(SyncStore.delGroup({ group }));
}
}
break;
default:

View File

@ -21,10 +21,9 @@ import {
combineLatest,
Subscription,
of,
BehaviorSubject,
forkJoin
BehaviorSubject
} from 'rxjs';
import { map, tap, catchError, take } from 'rxjs/operators';
import { map, tap, catchError } from 'rxjs/operators';
import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store';
@ -67,7 +66,7 @@ import {
AlertDialogResult,
AlertDialogData
} from '@ucap-webmessenger/ui';
import { TranslateService, TranslateParser } from '@ngx-translate/core';
import { TranslateService } from '@ngx-translate/core';
import { environment } from '../../../../../environments/environment';
import { StringUtil } from '@ucap-webmessenger/core';
import { AppService } from '@app/services/app.service';