기능추가 :: 그룹 > 그룹원 > 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>
<mat-icon>person_add</mat-icon>
</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>
</button>
</div>
@ -84,7 +88,7 @@
mat-menu-item
(click)="onClickProfileContextMenu('REGISTER_FAVORITE', userInfo)"
>
즐겨찾기 등록
즐겨찾기 {{ userInfo.isFavorit ? '해제' : '등록' }}
</button>
<button mat-menu-item (click)="onClickProfileContextMenu('CHAT', userInfo)">
대화하기

View File

@ -1,16 +1,33 @@
import { UserSelectDialogType } from './../../../../types/userselect.dialog.type';
import {
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
} from './../../dialogs/chat/create-chat.dialog.component';
import { MatMenuTrigger } from '@angular/material';
import { Component, OnInit, ViewChild, OnDestroy } from '@angular/core';
import { Observable, combineLatest, Subscription } from 'rxjs';
import { map, tap } from 'rxjs/operators';
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 {
ucapAnimations,
DialogService,
@ -18,48 +35,16 @@ import {
ConfirmDialogComponent,
ConfirmDialogResult
} 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 {
CreateGroupDialogComponent,
CreateGroupDialogData,
CreateGroupDialogResult
} from '@app/layouts/messenger/dialogs/group/create-group.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';
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
} from './../../dialogs/chat/create-chat.dialog.component';
import {
EditGroupDialogComponent,
EditGroupDialogData,
EditGroupDialogResult
} 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({
selector: 'app-layout-chat-left-sidenav-group',
@ -251,10 +236,7 @@ export class GroupComponent implements OnInit, OnDestroy {
);
}
onClickProfileContextMenu(
menuType: string,
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN
) {
onClickProfileContextMenu(menuType: string, userInfo: UserInfo | UserInfoF) {
this.logger.debug(
'onClickProfileContextMenu',
'menuType',
@ -262,6 +244,16 @@ export class GroupComponent implements OnInit, OnDestroy {
'userInfo',
userInfo
);
switch (menuType) {
case 'REGISTER_FAVORITE':
this.store.dispatch(
SyncStore.updateBuddy({
seq: userInfo.seq,
isFavorit: !userInfo.isFavorit
})
);
break;
}
}
onContextMenuProfile(

View File

@ -31,19 +31,21 @@ import {
refreshRoom,
refreshRoomFailure,
refreshRoomSuccess,
createGroup,
createGroupSuccess,
createGroupFailure,
createGroupAndBuddy,
addBuddy,
addBuddyFailure,
delBuddy,
delBuddyFailure,
delBuddySuccess,
updateBuddy,
updateBuddySuccess,
updateBuddyFailure,
createGroup,
createGroupSuccess,
createGroupFailure,
updateGroup,
updateGroupFailure,
updateGroupMember,
updateBuddy,
delBuddySuccess,
delGroup,
delGroupFailure,
delGroupSuccess
@ -92,7 +94,8 @@ import {
import {
BuddyProtocolService,
AddResponse as BuddyAddResponse,
DelResponse as BuddyDelResponse
DelResponse as BuddyDelResponse,
UpdateResponse as BuddyUpdateResponse
} from '@ucap-webmessenger/protocol-buddy';
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(() =>
this.actions$.pipe(
ofType(updateGroup),

View File

@ -17,17 +17,20 @@ import {
createGroupSuccess,
addBuddySuccess,
delBuddySuccess,
delGroupSuccess
delGroupSuccess,
updateBuddySuccess
} from './actions';
import {
RoomUserDetailData,
RoomUserData,
GroupDetailData
GroupDetailData,
UserInfo
} from '@ucap-webmessenger/protocol-sync';
import * as AuthenticationStore from '@app/store/account/authentication';
import * as RoomStore from '@app/store/messenger/room';
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
import { UpdateResponse } from '@ucap-webmessenger/protocol-buddy';
export const reducer = createReducer(
initialState,
@ -222,5 +225,17 @@ export const reducer = createReducer(
...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 })
};
})
);