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

View File

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