기능추가 ::

1. 방닫기 기능추가
2. 방나가기 시 현재 열려 있는 방 닫아주는 기능 추가.
This commit is contained in:
leejh 2019-10-24 16:53:21 +09:00
parent e7bbdeb105
commit 14ab59459f
5 changed files with 36 additions and 4 deletions

View File

@ -42,8 +42,8 @@
</button> </button>
<mat-menu #contactMenu="matMenu"> <mat-menu #contactMenu="matMenu">
<button mat-menu-item (click)="selectContact()"> <button mat-menu-item (click)="onClickContextMenu('CLOSE_ROOM')">
Contact Info 방닫기
</button> </button>
</mat-menu> </mat-menu>
</div> </div>

View File

@ -389,4 +389,16 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewChecked {
break; break;
} }
} }
onClickContextMenu(menuType: string) {
switch (menuType) {
case 'CLOSE_ROOM':
{
this.store.dispatch(ChatStore.clearSelectedRoom());
}
break;
default:
break;
}
}
} }

View File

@ -10,6 +10,10 @@ export const selectedRoom = createAction(
props<{ roomSeq: string }>() props<{ roomSeq: string }>()
); );
export const clearSelectedRoom = createAction(
'[Messenger::Chat] clearSelectedRoom'
);
export const newEventMessage = createAction( export const newEventMessage = createAction(
'[Messenger::Chat] newEventMessage', '[Messenger::Chat] newEventMessage',
props<{ props<{

View File

@ -5,7 +5,8 @@ import {
selectedMassDetail, selectedMassDetail,
massTalkDownloadFailure, massTalkDownloadFailure,
massTalkDownload, massTalkDownload,
massTalkDownloadSuccess massTalkDownloadSuccess,
clearSelectedRoom
} from './actions'; } from './actions';
export const reducer = createReducer( export const reducer = createReducer(
@ -17,6 +18,13 @@ export const reducer = createReducer(
}; };
}), }),
on(clearSelectedRoom, (state, action) => {
return {
...state,
selectedRoom: null
};
}),
on(selectedMassDetail, (state, action) => { on(selectedMassDetail, (state, action) => {
return { return {
...state, ...state,

View File

@ -181,9 +181,17 @@ export class Effects {
exit$ = createEffect(() => exit$ = createEffect(() =>
this.actions$.pipe( this.actions$.pipe(
ofType(exit), ofType(exit),
exhaustMap(req => { withLatestFrom(
this.store.pipe(
select((state: any) => state.messenger.room.roomInfo as RoomInfo)
)
),
exhaustMap(([req, roomInfo]) => {
return this.roomProtocolService.exit(req).pipe( return this.roomProtocolService.exit(req).pipe(
map((res: ExitResponse) => { map((res: ExitResponse) => {
if (!!roomInfo && roomInfo.roomSeq === res.roomSeq) {
this.store.dispatch(ChatStore.clearSelectedRoom());
}
return exitSuccess({ res }); return exitSuccess({ res });
}), }),
catchError(error => of(exitFailure({ error }))) catchError(error => of(exitFailure({ error })))