bugfix ::

1. 강제퇴장시 state 에서 remove 하지 않고 isJoinRoom 플래그만 변경하도록 수정.
2. 대화상대 초대시 방정보를 갱신하도록 수정. >> INVITE_NOTI 에 초대자 정보가 유입되지 않음.
This commit is contained in:
leejinho 2020-02-04 16:34:27 +09:00
parent b58e52325d
commit 4569202230
8 changed files with 139 additions and 57 deletions

View File

@ -1286,12 +1286,6 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
(message as Info<string>).sentMessage
)
) {
this.snackBarService.open(
this.translateService.instant(
'common.clipboard.results.copied'
),
'확인'
);
this.snackBarService.open(
this.translateService.instant(
'common.clipboard.results.copied'

View File

@ -474,6 +474,20 @@ export class AppNotificationService {
);
}
break;
case SSVC_TYPE_ROOM_INVITE_NOTI:
{
const noti = notiOrRes as InviteNotification;
this.logger.debug(
'Notification::roomProtocolService::InviteNotification',
noti
);
this.store.dispatch(
RoomStore.inviteNotification({
noti
})
);
}
break;
case SSVC_TYPE_ROOM_UPD_RES:
{
const noti = notiOrRes as RoomUpdateNotification;
@ -496,20 +510,6 @@ export class AppNotificationService {
);
}
break;
case SSVC_TYPE_ROOM_INVITE_NOTI:
{
const noti = notiOrRes as InviteNotification;
this.logger.debug(
'Notification::roomProtocolService::InviteNotification',
noti
);
this.store.dispatch(
RoomStore.inviteNotification({
noti
})
);
}
break;
case SSVC_TYPE_ROOM_EXIT_RES:
case SSVC_TYPE_ROOM_EXIT_NOTI:
{
@ -528,7 +528,8 @@ export class AppNotificationService {
} else {
this.store.dispatch(
RoomStore.exitNotificationOthers({
noti
roomSeq: noti.roomSeq,
trgtUser: [noti.SENDER_SEQ]
})
);
@ -560,15 +561,31 @@ export class AppNotificationService {
break;
case SSVC_TYPE_ROOM_EXIT_FORCING_NOTI:
{
// 내가 강퇴 됨.
const noti = notiOrRes as ExitForcingNotification;
this.logger.debug(
'Notification::roomProtocolService::ExitForcingNotification NOTI',
noti
);
if (noti.userSeqs.indexOf(loginResInfo.userSeq) >= 0) {
this.store.dispatch(
RoomStore.exitForcingNotification({
noti
})
);
}
this.store.dispatch(
RoomStore.exitForcingNotification({
noti
RoomStore.exitNotificationOthers({
roomSeq: noti.roomSeq,
trgtUser: noti.userSeqs
})
);
this.store.dispatch(
SyncStore.clearRoomUsers({
roomSeq: noti.roomSeq,
userSeqs: noti.userSeqs
})
);
}

View File

@ -56,9 +56,12 @@ export const exitNotification = createAction(
'[Messenger::Room] Exit Notification',
props<{ noti: ExitNotification }>()
);
/**
* isJoinRoom flag false .
*/
export const exitNotificationOthers = createAction(
'[Messenger::Room] Exit Notification By Others',
props<{ noti: ExitNotification }>()
props<{ roomSeq: string; trgtUser: number[] }>()
);
export const exitForcing = createAction(

View File

@ -310,8 +310,25 @@ export class Effects {
() => {
return this.actions$.pipe(
ofType(inviteNotification),
map(action => action.noti),
tap(noti => {})
withLatestFrom(
this.store.pipe(
select((state: any) => state.messenger.room.roomInfo as RoomInfo)
)
),
tap(([action, roomInfo]) => {
if (!!roomInfo && roomInfo.roomSeq === action.noti.roomSeq) {
const loginInfo = this.sessionStorageService.get<LoginInfo>(
KEY_LOGIN_INFO
);
this.store.dispatch(
info({
roomSeq: action.noti.roomSeq,
isDetail: true,
localeCode: loginInfo.localeCode
})
);
}
})
);
},
{ dispatch: false }
@ -354,13 +371,11 @@ export class Effects {
tap(([action, roomInfo]) => {
if (
!!roomInfo &&
roomInfo.roomSeq === action.noti.roomSeq &&
!!action.noti &&
!!action.noti.SENDER_SEQ
roomInfo.roomSeq === action.roomSeq &&
!!action.trgtUser &&
action.trgtUser.length > 0
) {
this.store.dispatch(
clearRoomUser({ userSeqs: [action.noti.SENDER_SEQ] })
);
this.store.dispatch(clearRoomUser({ userSeqs: action.trgtUser }));
}
})
);

View File

@ -10,7 +10,7 @@ import {
import * as AuthenticationStore from '@app/store/account/authentication';
import * as ChatStore from '@app/store/messenger/chat';
import { UserInfo } from '@ucap-webmessenger/protocol-room';
import { UserInfo, UserInfoShort } from '@ucap-webmessenger/protocol-room';
export const reducer = createReducer(
initialState,
@ -28,14 +28,45 @@ export const reducer = createReducer(
}),
on(clearRoomUser, (state, action) => {
const tmpUserInfoList: UserInfo[] = [];
const tmpUserInfoShortList: UserInfoShort[] = [];
action.userSeqs.forEach(userSeq => {
const userInfo: UserInfo = {
...state.userInfoList.entities[userSeq]
};
if (!!userInfo && !!userInfo.seq) {
tmpUserInfoList.push({
...userInfo,
isJoinRoom: false
});
}
const userInfoShort: UserInfoShort = {
...state.userInfoShortList.entities[userSeq]
};
if (!!userInfoShort && !!userInfoShort.seq) {
tmpUserInfoShortList.push({
...userInfoShort,
isJoinRoom: false
});
}
});
return {
...state,
userInfoList: adapterUserInfo.removeMany(action.userSeqs, {
...state.userInfoList
}),
userInfoShortList: adapterUserInfoShort.removeMany(action.userSeqs, {
...state.userInfoShortList
})
userInfoList:
tmpUserInfoList.length > 0
? adapterUserInfo.upsertMany(tmpUserInfoList, {
...state.userInfoList
})
: state.userInfoList,
userInfoShortList:
tmpUserInfoShortList.length > 0
? adapterUserInfoShort.upsertMany(tmpUserInfoShortList, {
...state.userInfoShortList
})
: state.userInfoShortList
};
}),

View File

@ -264,7 +264,7 @@ export const delGroupFailure = createAction(
props<{ error: any }>()
);
/** 방 인원 클리어 */
/** Sync 되어 있는 방의 방인원의 isJoinRoom flag 를 false 로 변경. */
export const clearRoomUsers = createAction(
'[Messenger::Sync] Clear room users.',
props<{ roomSeq: string; userSeqs: number[] }>()

View File

@ -342,6 +342,10 @@ export class Effects {
let roomSeq = null;
for (const key in roomUsers) {
if (key === undefined) {
continue;
}
if (roomUsers.hasOwnProperty(key)) {
const element = roomUsers[key];
if (userSeqList.length === element.userInfos.length) {
@ -371,6 +375,10 @@ export class Effects {
}
for (const key in roomUserShorts) {
if (key === undefined) {
continue;
}
if (roomUserShorts.hasOwnProperty(key)) {
const element = roomUserShorts[key];
if (userSeqList.length === element.userInfos.length) {

View File

@ -103,35 +103,45 @@ export const reducer = createReducer(
}),
on(clearRoomUsers, (state, action) => {
let roomUserList: RoomUserDetailData = {
const roomUserList: RoomUserDetailData = {
...state.roomUser.entities[action.roomSeq]
};
let trgtRoomUserList: RoomUserDetailData;
if (
!!roomUserList &&
!!roomUserList.userInfos &&
roomUserList.userInfos.length > 0
) {
const userInfos = roomUserList.userInfos.filter(
userInfo => action.userSeqs.indexOf(userInfo.seq) < 0
);
roomUserList = {
const userInfos = roomUserList.userInfos.map(userInfo => {
if (action.userSeqs.indexOf(userInfo.seq) >= 0) {
return { ...userInfo, isJoinRoom: false };
} else {
return userInfo;
}
});
trgtRoomUserList = {
...roomUserList,
userInfos
};
}
let roomUserShortList: RoomUserData = {
const roomUserShortList: RoomUserData = {
...state.roomUserShort.entities[action.roomSeq]
};
let trgtRoomUserShortList: RoomUserData;
if (
!!roomUserShortList &&
!!roomUserShortList.userInfos &&
roomUserShortList.userInfos.length > 0
) {
const userInfos = roomUserShortList.userInfos.filter(
userInfo => action.userSeqs.indexOf(userInfo.seq) < 0
);
roomUserShortList = {
const userInfos = roomUserShortList.userInfos.map(userInfo => {
if (action.userSeqs.indexOf(userInfo.seq) >= 0) {
return { ...userInfo, isJoinRoom: false };
} else {
return userInfo;
}
});
trgtRoomUserShortList = {
...roomUserShortList,
userInfos
};
@ -139,12 +149,16 @@ export const reducer = createReducer(
return {
...state,
roomUser: adapterRoomUser.upsertOne(roomUserList, {
...state.roomUser
}),
roomUserShort: adapterRoomUserShort.upsertOne(roomUserShortList, {
...state.roomUserShort
})
roomUser: !!trgtRoomUserList
? adapterRoomUser.upsertOne(trgtRoomUserList, {
...state.roomUser
})
: state.roomUser,
roomUserShort: !!trgtRoomUserShortList
? adapterRoomUserShort.upsertOne(trgtRoomUserShortList, {
...state.roomUserShort
})
: state.roomUserShort
};
}),