기능추가 :: 그룹 > 그룹원 > context Menu > 즐겨찾기 등록/해제

This commit is contained in:
leejh 2019-10-21 17:23:02 +09:00
parent 93ccbb518b
commit 768144ed53
4 changed files with 85 additions and 57 deletions

View File

@ -6,7 +6,11 @@
<button mat-icon-button> <button mat-icon-button>
<mat-icon>person_add</mat-icon> <mat-icon>person_add</mat-icon>
</button> </button>
<button mat-icon-button [matMenuTriggerFor]="groupMenu" aria-label="group menu"> <button
mat-icon-button
[matMenuTriggerFor]="groupMenu"
aria-label="group menu"
>
<mat-icon>more_vert</mat-icon> <mat-icon>more_vert</mat-icon>
</button> </button>
</div> </div>
@ -84,7 +88,7 @@
mat-menu-item mat-menu-item
(click)="onClickProfileContextMenu('REGISTER_FAVORITE', userInfo)" (click)="onClickProfileContextMenu('REGISTER_FAVORITE', userInfo)"
> >
즐겨찾기 등록 즐겨찾기 {{ userInfo.isFavorit ? '해제' : '등록' }}
</button> </button>
<button mat-menu-item (click)="onClickProfileContextMenu('CHAT', userInfo)"> <button mat-menu-item (click)="onClickProfileContextMenu('CHAT', userInfo)">
대화하기 대화하기

View File

@ -1,16 +1,33 @@
import { UserSelectDialogType } from './../../../../types/userselect.dialog.type'; import { UserSelectDialogType } from './../../../../types/userselect.dialog.type';
import { import { MatMenuTrigger } from '@angular/material';
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
} from './../../dialogs/chat/create-chat.dialog.component';
import { Component, OnInit, ViewChild, OnDestroy } from '@angular/core'; import { Component, OnInit, ViewChild, OnDestroy } from '@angular/core';
import { Observable, combineLatest, Subscription } from 'rxjs'; import { Observable, combineLatest, Subscription } from 'rxjs';
import { map, tap } from 'rxjs/operators'; import { map, tap } from 'rxjs/operators';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat';
import * as QueryStore from '@app/store/messenger/query';
import * as SyncStore from '@app/store/messenger/sync';
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 } from '@app/types';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync';
import {
DeptSearchType,
UserInfoSS,
UserInfoF,
UserInfoDN
} from '@ucap-webmessenger/protocol-query';
import { import {
ucapAnimations, ucapAnimations,
DialogService, DialogService,
@ -18,48 +35,16 @@ import {
ConfirmDialogComponent, ConfirmDialogComponent,
ConfirmDialogResult ConfirmDialogResult
} from '@ucap-webmessenger/ui'; } from '@ucap-webmessenger/ui';
import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync';
import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat';
import * as QueryStore from '@app/store/messenger/query';
import * as SyncStore from '@app/store/messenger/sync';
import { NGXLogger } from 'ngx-logger';
import { Company } from '@ucap-webmessenger/api-external';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
import { import {
CreateGroupDialogComponent, CreateChatDialogComponent,
CreateGroupDialogData, CreateChatDialogData,
CreateGroupDialogResult CreateChatDialogResult
} from '@app/layouts/messenger/dialogs/group/create-group.dialog.component'; } from './../../dialogs/chat/create-chat.dialog.component';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import {
DeptSearchType,
UserInfoSS,
UserInfoF,
UserInfoDN
} from '@ucap-webmessenger/protocol-query';
import { MatMenuTrigger } from '@angular/material';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import {
DeleteGroupDialogComponent,
DeleteGroupDialogData,
DeleteGroupDialogResult
} from '@app/layouts/messenger/dialogs/group/delete-group.dialog.component';
import { import {
EditGroupDialogComponent, EditGroupDialogComponent,
EditGroupDialogData, EditGroupDialogData,
EditGroupDialogResult EditGroupDialogResult
} from '@app/layouts/messenger/dialogs/group/edit-group.dialog.component'; } from '@app/layouts/messenger/dialogs/group/edit-group.dialog.component';
import {
EditGroupMemberDialogComponent,
EditGroupMemberDialogData,
EditGroupMemberDialogResult
} from '@app/layouts/messenger/dialogs/group/edit-group-member.dialog.component';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-group', selector: 'app-layout-chat-left-sidenav-group',
@ -251,10 +236,7 @@ export class GroupComponent implements OnInit, OnDestroy {
); );
} }
onClickProfileContextMenu( onClickProfileContextMenu(menuType: string, userInfo: UserInfo | UserInfoF) {
menuType: string,
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN
) {
this.logger.debug( this.logger.debug(
'onClickProfileContextMenu', 'onClickProfileContextMenu',
'menuType', 'menuType',
@ -262,6 +244,16 @@ export class GroupComponent implements OnInit, OnDestroy {
'userInfo', 'userInfo',
userInfo userInfo
); );
switch (menuType) {
case 'REGISTER_FAVORITE':
this.store.dispatch(
SyncStore.updateBuddy({
seq: userInfo.seq,
isFavorit: !userInfo.isFavorit
})
);
break;
}
} }
onContextMenuProfile( onContextMenuProfile(

View File

@ -31,19 +31,21 @@ import {
refreshRoom, refreshRoom,
refreshRoomFailure, refreshRoomFailure,
refreshRoomSuccess, refreshRoomSuccess,
createGroup,
createGroupSuccess,
createGroupFailure,
createGroupAndBuddy, createGroupAndBuddy,
addBuddy, addBuddy,
addBuddyFailure, addBuddyFailure,
delBuddy, delBuddy,
delBuddyFailure, delBuddyFailure,
delBuddySuccess,
updateBuddy,
updateBuddySuccess,
updateBuddyFailure,
createGroup,
createGroupSuccess,
createGroupFailure,
updateGroup, updateGroup,
updateGroupFailure, updateGroupFailure,
updateGroupMember, updateGroupMember,
updateBuddy,
delBuddySuccess,
delGroup, delGroup,
delGroupFailure, delGroupFailure,
delGroupSuccess delGroupSuccess
@ -92,7 +94,8 @@ import {
import { import {
BuddyProtocolService, BuddyProtocolService,
AddResponse as BuddyAddResponse, AddResponse as BuddyAddResponse,
DelResponse as BuddyDelResponse DelResponse as BuddyDelResponse,
UpdateResponse as BuddyUpdateResponse
} from '@ucap-webmessenger/protocol-buddy'; } from '@ucap-webmessenger/protocol-buddy';
import * as ChatStore from '@app/store/messenger/chat'; import * as ChatStore from '@app/store/messenger/chat';
@ -682,6 +685,20 @@ export class Effects {
) )
); );
updateBuddy$ = createEffect(() =>
this.actions$.pipe(
ofType(updateBuddy),
exhaustMap(req =>
this.buddyProtocolService.update(req).pipe(
map((res: BuddyUpdateResponse) => {
return updateBuddySuccess(res);
}),
catchError(error => of(updateBuddyFailure({ error })))
)
)
)
);
updateGroup$ = createEffect(() => updateGroup$ = createEffect(() =>
this.actions$.pipe( this.actions$.pipe(
ofType(updateGroup), ofType(updateGroup),

View File

@ -17,17 +17,20 @@ import {
createGroupSuccess, createGroupSuccess,
addBuddySuccess, addBuddySuccess,
delBuddySuccess, delBuddySuccess,
delGroupSuccess delGroupSuccess,
updateBuddySuccess
} from './actions'; } from './actions';
import { import {
RoomUserDetailData, RoomUserDetailData,
RoomUserData, RoomUserData,
GroupDetailData GroupDetailData,
UserInfo
} from '@ucap-webmessenger/protocol-sync'; } from '@ucap-webmessenger/protocol-sync';
import * as AuthenticationStore from '@app/store/account/authentication'; import * as AuthenticationStore from '@app/store/account/authentication';
import * as RoomStore from '@app/store/messenger/room'; import * as RoomStore from '@app/store/messenger/room';
import { RoomInfo } from '@ucap-webmessenger/protocol-room'; import { RoomInfo } from '@ucap-webmessenger/protocol-room';
import { UpdateResponse } from '@ucap-webmessenger/protocol-buddy';
export const reducer = createReducer( export const reducer = createReducer(
initialState, initialState,
@ -222,5 +225,17 @@ export const reducer = createReducer(
...state.buddy2 ...state.buddy2
}) })
}; };
}),
on(updateBuddySuccess, (state, action) => {
const userInfo: UserInfo = {
...state.buddy2.entities[action.seq],
isFavorit: action.isFavorit
};
return {
...state,
buddy2: adapterBuddy2.upsertOne(userInfo, { ...state.buddy2 })
};
}) })
); );