2019-10-28 09:03:27 +00:00
|
|
|
import {
|
|
|
|
CommonApiService,
|
|
|
|
MassTalkSaveRequest
|
|
|
|
} from '@ucap-webmessenger/api-common';
|
|
|
|
import { KEY_ENVIRONMENTS_INFO } from './../../../types/environment.type';
|
2019-10-08 04:18:05 +00:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
|
|
|
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
|
|
|
|
2019-10-10 04:35:32 +00:00
|
|
|
import { Store, select } from '@ngrx/store';
|
2019-10-08 04:18:05 +00:00
|
|
|
|
|
|
|
import { NGXLogger } from 'ngx-logger';
|
|
|
|
|
|
|
|
import { of } from 'rxjs';
|
2019-10-10 04:35:32 +00:00
|
|
|
import {
|
|
|
|
tap,
|
|
|
|
switchMap,
|
|
|
|
map,
|
|
|
|
catchError,
|
|
|
|
exhaustMap,
|
|
|
|
withLatestFrom
|
|
|
|
} from 'rxjs/operators';
|
2019-10-08 04:18:05 +00:00
|
|
|
import {
|
|
|
|
InfoData,
|
|
|
|
Info,
|
|
|
|
InfoResponse,
|
|
|
|
EventProtocolService,
|
2019-10-29 01:10:08 +00:00
|
|
|
SVC_TYPE_EVENT,
|
2019-10-08 04:18:05 +00:00
|
|
|
SSVC_TYPE_EVENT_INFO_DATA,
|
2019-10-08 05:34:37 +00:00
|
|
|
SSVC_TYPE_EVENT_INFO_RES,
|
2019-10-16 05:52:31 +00:00
|
|
|
SendResponse,
|
2019-10-24 01:45:28 +00:00
|
|
|
ReadResponse,
|
|
|
|
DelResponse,
|
2019-10-28 09:03:27 +00:00
|
|
|
CancelResponse,
|
2019-10-30 07:22:49 +00:00
|
|
|
EventType,
|
|
|
|
ReadNotification,
|
|
|
|
SSVC_TYPE_EVENT_SEND_RES,
|
|
|
|
SSVC_TYPE_EVENT_SEND_NOTI
|
2019-10-08 04:18:05 +00:00
|
|
|
} from '@ucap-webmessenger/protocol-event';
|
|
|
|
|
|
|
|
import * as ChatStore from '@app/store/messenger/chat';
|
2019-10-30 07:22:49 +00:00
|
|
|
import * as RoomStore from '@app/store/messenger/room';
|
2019-10-16 01:21:26 +00:00
|
|
|
import * as SyncStore from '@app/store/messenger/sync';
|
2019-10-08 04:18:05 +00:00
|
|
|
|
2019-10-08 05:34:37 +00:00
|
|
|
import {
|
|
|
|
info,
|
|
|
|
infoSuccess,
|
|
|
|
infoFailure,
|
|
|
|
send,
|
|
|
|
sendSuccess,
|
2019-10-08 05:59:22 +00:00
|
|
|
sendFailure,
|
2019-10-10 04:35:32 +00:00
|
|
|
appendInfoList,
|
2019-10-11 05:01:43 +00:00
|
|
|
newInfo,
|
|
|
|
sendNotification,
|
|
|
|
readNotification,
|
|
|
|
cancelNotification,
|
2019-10-15 10:09:26 +00:00
|
|
|
delNotification,
|
2019-10-16 05:52:31 +00:00
|
|
|
recallInfoList,
|
|
|
|
read,
|
2019-10-24 01:45:28 +00:00
|
|
|
readFailure,
|
|
|
|
del,
|
|
|
|
delFailure,
|
|
|
|
delInfoList,
|
|
|
|
cancel,
|
2019-10-24 08:04:58 +00:00
|
|
|
cancelFailure,
|
|
|
|
forward,
|
|
|
|
forwardFailure,
|
2019-10-28 09:03:27 +00:00
|
|
|
forwardAfterRoomOpen,
|
|
|
|
sendMass,
|
|
|
|
sendMassFailure
|
2019-10-08 05:34:37 +00:00
|
|
|
} from './actions';
|
2019-10-08 04:18:05 +00:00
|
|
|
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
2019-10-24 08:04:58 +00:00
|
|
|
import {
|
|
|
|
RoomInfo,
|
|
|
|
RoomProtocolService,
|
|
|
|
OpenResponse
|
|
|
|
} from '@ucap-webmessenger/protocol-room';
|
2019-10-28 09:03:27 +00:00
|
|
|
import { LoginInfo, KEY_LOGIN_INFO, EnvironmentsInfo } from '@app/types';
|
2019-10-16 05:52:31 +00:00
|
|
|
import { Dictionary } from '@ngrx/entity';
|
2019-10-24 08:04:58 +00:00
|
|
|
import { openSuccess, openFailure } from '../room';
|
2019-10-28 09:03:27 +00:00
|
|
|
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
|
|
|
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
|
|
|
|
import { StatusCode } from '@ucap-webmessenger/api';
|
2019-10-08 04:18:05 +00:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class Effects {
|
|
|
|
selectedRoomForInfo$ = createEffect(() =>
|
|
|
|
this.actions$.pipe(
|
|
|
|
ofType(ChatStore.selectedRoom),
|
|
|
|
map(action => {
|
|
|
|
return info({
|
|
|
|
roomSeq: action.roomSeq,
|
|
|
|
baseSeq: 0,
|
|
|
|
requestCount: 50
|
|
|
|
});
|
|
|
|
})
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
info$ = createEffect(
|
|
|
|
() => {
|
|
|
|
let infoList: Info[];
|
|
|
|
|
|
|
|
return this.actions$.pipe(
|
|
|
|
ofType(info),
|
|
|
|
tap(() => {
|
|
|
|
infoList = [];
|
|
|
|
}),
|
|
|
|
switchMap(req => {
|
|
|
|
return this.eventProtocolService.info(req).pipe(
|
|
|
|
map(res => {
|
2019-10-10 03:14:01 +00:00
|
|
|
switch (res.SSVC_TYPE) {
|
2019-10-08 04:18:05 +00:00
|
|
|
case SSVC_TYPE_EVENT_INFO_DATA:
|
|
|
|
infoList.push(...(res as InfoData).infoList);
|
|
|
|
break;
|
|
|
|
case SSVC_TYPE_EVENT_INFO_RES:
|
2019-10-16 05:52:31 +00:00
|
|
|
{
|
|
|
|
this.store.dispatch(
|
|
|
|
infoSuccess({
|
|
|
|
infoList,
|
|
|
|
res: res as InfoResponse
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
if (req.baseSeq === 0) {
|
|
|
|
// 최초 이벤트 목록 조회시 SSVC_TYPE_EVENT_READ_REQ 수행.
|
|
|
|
const maxSeq = Math.max.apply(
|
|
|
|
Math,
|
|
|
|
infoList.map(v => v.seq)
|
|
|
|
);
|
|
|
|
this.store.dispatch(
|
|
|
|
read({
|
|
|
|
roomSeq: req.roomSeq,
|
|
|
|
lastReadSeq: Number(maxSeq)
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-10-08 04:18:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
catchError(error => of(infoFailure({ error })))
|
|
|
|
);
|
|
|
|
})
|
|
|
|
);
|
|
|
|
},
|
|
|
|
{ dispatch: false }
|
|
|
|
);
|
|
|
|
|
2019-10-24 01:51:50 +00:00
|
|
|
read$ = createEffect(() =>
|
|
|
|
this.actions$.pipe(
|
|
|
|
ofType(read),
|
|
|
|
exhaustMap(req =>
|
|
|
|
this.eventProtocolService.read(req).pipe(
|
|
|
|
map((res: ReadResponse) => {
|
2019-10-30 07:22:49 +00:00
|
|
|
return readNotification(res as ReadNotification);
|
2019-10-24 01:51:50 +00:00
|
|
|
}),
|
|
|
|
catchError(error => of(readFailure({ error })))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2019-10-16 05:52:31 +00:00
|
|
|
);
|
|
|
|
|
2019-10-24 01:45:28 +00:00
|
|
|
readNotification$ = createEffect(
|
|
|
|
() => {
|
|
|
|
return this.actions$.pipe(
|
|
|
|
ofType(readNotification),
|
2019-10-30 07:22:49 +00:00
|
|
|
withLatestFrom(
|
|
|
|
this.store.pipe(
|
|
|
|
select((state: any) => state.messenger.room.roomInfo as RoomInfo)
|
|
|
|
),
|
|
|
|
this.store.pipe(
|
|
|
|
select(
|
|
|
|
(state: any) =>
|
|
|
|
state.account.authentication.loginRes as LoginResponse
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
// map(([action, roomInfo]) => ([action.noti, roomInfo])),
|
|
|
|
tap(([action, roomInfo, loginRes]) => {
|
|
|
|
// 현재 오픈된 방에 대한 read noti/res 가 유입될 경우 roomUserList 의 lastReadSeq 를 갱신한다.
|
2019-10-31 02:57:40 +00:00
|
|
|
if (
|
|
|
|
!!roomInfo &&
|
|
|
|
!!roomInfo.roomSeq &&
|
|
|
|
roomInfo.roomSeq === action.roomSeq
|
|
|
|
) {
|
2019-10-30 07:22:49 +00:00
|
|
|
this.store.dispatch(RoomStore.updateRoomUserLastReadSeq(action));
|
|
|
|
}
|
|
|
|
|
|
|
|
// noti/res 를 일으킨 주체가 본인이라면 현재 오픈된 방 여부에 상관없이 해당방에 대한 noReadCnt 를 초기화 한다.
|
|
|
|
if (action.SENDER_SEQ === loginRes.userSeq) {
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.updateUnreadCount({
|
|
|
|
roomSeq: action.roomSeq,
|
|
|
|
noReadCnt: 0
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
2019-10-24 01:45:28 +00:00
|
|
|
})
|
|
|
|
);
|
|
|
|
},
|
|
|
|
{ dispatch: false }
|
|
|
|
);
|
|
|
|
|
2019-10-08 05:34:37 +00:00
|
|
|
send$ = createEffect(() =>
|
|
|
|
this.actions$.pipe(
|
|
|
|
ofType(send),
|
2019-10-08 05:59:22 +00:00
|
|
|
exhaustMap(action =>
|
|
|
|
this.eventProtocolService.send(action.req).pipe(
|
2019-10-08 05:34:37 +00:00
|
|
|
map((res: SendResponse) => {
|
|
|
|
return sendSuccess({
|
2019-10-08 05:59:22 +00:00
|
|
|
senderSeq: action.senderSeq,
|
2019-10-08 05:34:37 +00:00
|
|
|
res
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
catchError(error => of(sendFailure({ error })))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2019-10-08 05:59:22 +00:00
|
|
|
sendSuccess$ = createEffect(
|
|
|
|
() => {
|
|
|
|
return this.actions$.pipe(
|
|
|
|
ofType(sendSuccess),
|
|
|
|
tap(action => {
|
|
|
|
const res = action.res;
|
|
|
|
const appendInfo: Info = {
|
|
|
|
seq: res.seq,
|
|
|
|
type: res.eventType,
|
|
|
|
senderSeq: action.senderSeq,
|
|
|
|
sendDate: res.sendDate,
|
|
|
|
sentMessage: res.message,
|
|
|
|
receiverCount: res.receiverCount
|
|
|
|
};
|
|
|
|
|
2019-10-10 04:35:32 +00:00
|
|
|
this.store.dispatch(
|
2019-10-29 01:10:08 +00:00
|
|
|
newInfo({
|
|
|
|
roomSeq: res.roomSeq,
|
|
|
|
info: appendInfo,
|
|
|
|
SVC_TYPE: res.SVC_TYPE,
|
|
|
|
SSVC_TYPE: res.SSVC_TYPE
|
|
|
|
})
|
2019-10-10 04:35:32 +00:00
|
|
|
);
|
|
|
|
})
|
|
|
|
);
|
|
|
|
},
|
|
|
|
{ dispatch: false }
|
|
|
|
);
|
|
|
|
|
2019-10-11 05:01:43 +00:00
|
|
|
sendNotification$ = createEffect(
|
|
|
|
() => {
|
|
|
|
return this.actions$.pipe(
|
|
|
|
ofType(sendNotification),
|
|
|
|
map(action => action.noti),
|
|
|
|
tap(noti => {
|
|
|
|
const appendInfo: Info = {
|
|
|
|
seq: noti.seq,
|
|
|
|
type: noti.eventType,
|
|
|
|
senderSeq: noti.SENDER_SEQ,
|
|
|
|
sendDate: noti.sendDate,
|
|
|
|
sentMessage: noti.message,
|
|
|
|
receiverCount: noti.receiverCount
|
|
|
|
};
|
|
|
|
|
|
|
|
this.store.dispatch(
|
2019-10-29 01:10:08 +00:00
|
|
|
newInfo({
|
|
|
|
roomSeq: noti.roomSeq,
|
|
|
|
info: appendInfo,
|
|
|
|
SVC_TYPE: noti.SVC_TYPE,
|
|
|
|
SSVC_TYPE: noti.SSVC_TYPE
|
|
|
|
})
|
2019-10-11 05:01:43 +00:00
|
|
|
);
|
|
|
|
})
|
|
|
|
);
|
|
|
|
},
|
|
|
|
{ dispatch: false }
|
|
|
|
);
|
|
|
|
|
2019-10-24 08:04:58 +00:00
|
|
|
forward$ = createEffect(
|
|
|
|
() => {
|
|
|
|
return this.actions$.pipe(
|
|
|
|
ofType(forward),
|
|
|
|
map(action => {
|
|
|
|
if (!!action.trgtRoomSeq) {
|
|
|
|
this.store.dispatch(
|
|
|
|
ChatStore.selectedRoom({ roomSeq: action.trgtRoomSeq })
|
|
|
|
);
|
|
|
|
this.store.dispatch(
|
2019-10-25 01:09:16 +00:00
|
|
|
send({
|
2019-10-24 08:04:58 +00:00
|
|
|
senderSeq: action.senderSeq,
|
|
|
|
req: {
|
|
|
|
roomSeq: action.trgtRoomSeq,
|
|
|
|
eventType: action.req.eventType,
|
|
|
|
sentMessage: action.req.sentMessage
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
|
|
|
} else if (!!action.trgtUserSeqs && action.trgtUserSeqs.length > 0) {
|
|
|
|
// 방오픈 후 대화전달.
|
|
|
|
this.store.dispatch(forwardAfterRoomOpen(action));
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
|
|
|
},
|
|
|
|
{ dispatch: false }
|
|
|
|
);
|
|
|
|
|
|
|
|
forwardAfterRoomOpen$ = createEffect(() =>
|
|
|
|
this.actions$.pipe(
|
|
|
|
ofType(forwardAfterRoomOpen),
|
|
|
|
exhaustMap(action => {
|
|
|
|
return this.roomProtocolService
|
|
|
|
.open({
|
|
|
|
divCd: 'forwardOpen',
|
|
|
|
userSeqs: action.trgtUserSeqs
|
|
|
|
})
|
|
|
|
.pipe(
|
|
|
|
map((res: OpenResponse) => {
|
|
|
|
return openSuccess({ res });
|
|
|
|
}),
|
|
|
|
map(res => {
|
|
|
|
this.store.dispatch(
|
2019-10-25 01:09:16 +00:00
|
|
|
send({
|
2019-10-24 08:04:58 +00:00
|
|
|
senderSeq: action.senderSeq,
|
|
|
|
req: {
|
|
|
|
roomSeq: res.res.roomSeq,
|
|
|
|
eventType: action.req.eventType,
|
|
|
|
sentMessage: action.req.sentMessage
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
|
|
|
return res;
|
|
|
|
}),
|
|
|
|
catchError(error => of(openFailure({ error })))
|
|
|
|
);
|
|
|
|
})
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2019-10-28 09:03:27 +00:00
|
|
|
sendMass$ = createEffect(
|
|
|
|
() => {
|
|
|
|
return this.actions$.pipe(
|
|
|
|
ofType(sendMass),
|
|
|
|
exhaustMap(action => {
|
|
|
|
const loginResInfo: LoginResponse = this.sessionStorageService.get<
|
|
|
|
LoginResponse
|
|
|
|
>(KEY_LOGIN_RES_INFO);
|
|
|
|
|
|
|
|
const environmentsInfo = this.sessionStorageService.get<
|
|
|
|
EnvironmentsInfo
|
|
|
|
>(KEY_ENVIRONMENTS_INFO);
|
|
|
|
|
|
|
|
const req: MassTalkSaveRequest = {
|
|
|
|
userSeq: loginResInfo.userSeq,
|
|
|
|
deviceType: environmentsInfo.deviceType,
|
|
|
|
token: loginResInfo.tokenString,
|
|
|
|
content: action.req.sentMessage,
|
|
|
|
roomSeq: action.req.roomSeq
|
|
|
|
};
|
|
|
|
|
|
|
|
return this.commonApiService.massTalkSave(req).pipe(
|
|
|
|
map(res => {
|
|
|
|
if (res.statusCode === StatusCode.Success) {
|
|
|
|
this.store.dispatch(
|
|
|
|
send({
|
|
|
|
senderSeq: action.senderSeq,
|
|
|
|
req: {
|
|
|
|
roomSeq: res.roomID,
|
|
|
|
eventType: EventType.MassText,
|
|
|
|
sentMessage: res.returnJson
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
this.store.dispatch(sendMassFailure({ error: res }));
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
catchError(error => of(sendMassFailure({ error })))
|
|
|
|
);
|
|
|
|
})
|
|
|
|
);
|
|
|
|
},
|
|
|
|
{ dispatch: false }
|
|
|
|
);
|
|
|
|
|
2019-10-10 04:35:32 +00:00
|
|
|
newInfo$ = createEffect(
|
|
|
|
() => {
|
|
|
|
return this.actions$.pipe(
|
|
|
|
ofType(newInfo),
|
|
|
|
withLatestFrom(
|
|
|
|
this.store.pipe(
|
|
|
|
select((state: any) => state.messenger.room.roomInfo as RoomInfo)
|
2019-10-16 05:52:31 +00:00
|
|
|
),
|
|
|
|
this.store.pipe(
|
|
|
|
select(
|
|
|
|
(state: any) =>
|
|
|
|
state.messenger.sync.room.entities as Dictionary<RoomInfo>
|
|
|
|
)
|
2019-10-10 04:35:32 +00:00
|
|
|
)
|
|
|
|
),
|
2019-10-16 05:52:31 +00:00
|
|
|
tap(([action, roomInfo, trgtRoomInfos]) => {
|
|
|
|
// opened room :: event add
|
2019-10-11 04:17:52 +00:00
|
|
|
if (!!roomInfo && roomInfo.roomSeq === action.roomSeq) {
|
2019-10-10 04:35:32 +00:00
|
|
|
this.store.dispatch(appendInfoList({ info: action.info }));
|
2019-10-30 07:22:49 +00:00
|
|
|
|
|
|
|
if (
|
|
|
|
action.SVC_TYPE === SVC_TYPE_EVENT &&
|
|
|
|
action.SSVC_TYPE === SSVC_TYPE_EVENT_SEND_NOTI
|
|
|
|
) {
|
|
|
|
this.store.dispatch(
|
|
|
|
read({
|
|
|
|
roomSeq: action.roomSeq,
|
|
|
|
lastReadSeq: action.info.seq
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
2019-10-10 04:35:32 +00:00
|
|
|
}
|
2019-10-10 05:50:58 +00:00
|
|
|
|
2019-10-16 05:52:31 +00:00
|
|
|
// not opened room :: unread count increased
|
2019-10-29 01:10:08 +00:00
|
|
|
if (
|
|
|
|
action.SVC_TYPE === SVC_TYPE_EVENT &&
|
2019-10-30 07:22:49 +00:00
|
|
|
action.SSVC_TYPE === SSVC_TYPE_EVENT_SEND_RES
|
2019-10-29 01:10:08 +00:00
|
|
|
) {
|
|
|
|
/**
|
|
|
|
* 다른 디바이스에서 대화를 송신 할경우 RES 가 noti 로 유입될 수 있다.
|
|
|
|
* 이때 unread count 를 중가하지 않는다.
|
|
|
|
*/
|
|
|
|
} else {
|
|
|
|
if (!roomInfo || roomInfo.roomSeq !== action.roomSeq) {
|
|
|
|
if (!!trgtRoomInfos && !!trgtRoomInfos[action.roomSeq]) {
|
|
|
|
const noReadCnt = trgtRoomInfos[action.roomSeq].noReadCnt;
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.updateUnreadCount({
|
|
|
|
roomSeq: action.roomSeq,
|
|
|
|
noReadCnt: noReadCnt + 1
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
2019-10-18 04:34:24 +00:00
|
|
|
}
|
2019-10-16 05:52:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 대화 > 리스트 :: finalEventMessage refresh
|
2019-10-10 05:50:58 +00:00
|
|
|
this.store.dispatch(ChatStore.newEventMessage(action));
|
2019-10-08 05:59:22 +00:00
|
|
|
})
|
|
|
|
);
|
|
|
|
},
|
|
|
|
{ dispatch: false }
|
|
|
|
);
|
|
|
|
|
2019-10-24 01:45:28 +00:00
|
|
|
cancel$ = createEffect(() =>
|
|
|
|
this.actions$.pipe(
|
|
|
|
ofType(cancel),
|
|
|
|
exhaustMap(req =>
|
|
|
|
this.eventProtocolService.cancel(req).pipe(
|
|
|
|
map((res: CancelResponse) => {
|
|
|
|
return cancelNotification({ noti: res });
|
|
|
|
}),
|
|
|
|
catchError(error => of(cancelFailure({ error })))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2019-10-11 05:01:43 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
cancelNotification$ = createEffect(
|
|
|
|
() => {
|
|
|
|
return this.actions$.pipe(
|
|
|
|
ofType(cancelNotification),
|
2019-10-15 10:09:26 +00:00
|
|
|
withLatestFrom(
|
|
|
|
this.store.pipe(
|
|
|
|
select((state: any) => state.messenger.room.roomInfo as RoomInfo)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
tap(([action, roomInfo]) => {
|
2019-10-16 01:21:26 +00:00
|
|
|
// 현재 방이 오픈되어 있으면 방내용 갱신
|
2019-10-15 10:09:26 +00:00
|
|
|
if (!!roomInfo && roomInfo.roomSeq === action.noti.roomSeq) {
|
|
|
|
this.store.dispatch(
|
|
|
|
recallInfoList({ eventSeq: action.noti.eventSeq })
|
|
|
|
);
|
|
|
|
}
|
2019-10-16 01:21:26 +00:00
|
|
|
// 대화 > 리스트의 항목 갱신
|
|
|
|
const loginInfo = this.sessionStorageService.get<LoginInfo>(
|
|
|
|
KEY_LOGIN_INFO
|
|
|
|
);
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.refreshRoom({
|
|
|
|
roomSeq: action.noti.roomSeq,
|
|
|
|
isDetail: true,
|
|
|
|
localeCode: loginInfo.localeCode
|
|
|
|
})
|
|
|
|
);
|
2019-10-15 10:09:26 +00:00
|
|
|
})
|
2019-10-11 05:01:43 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
{ dispatch: false }
|
|
|
|
);
|
|
|
|
|
2019-10-24 01:45:28 +00:00
|
|
|
del$ = createEffect(() =>
|
|
|
|
this.actions$.pipe(
|
|
|
|
ofType(del),
|
|
|
|
exhaustMap(req =>
|
|
|
|
this.eventProtocolService.del(req).pipe(
|
|
|
|
map((res: DelResponse) => {
|
|
|
|
return delNotification({ noti: res });
|
|
|
|
}),
|
|
|
|
catchError(error => of(delFailure({ error })))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2019-10-11 05:01:43 +00:00
|
|
|
delNotification$ = createEffect(
|
|
|
|
() => {
|
|
|
|
return this.actions$.pipe(
|
|
|
|
ofType(delNotification),
|
|
|
|
map(action => action.noti),
|
2019-10-24 01:45:28 +00:00
|
|
|
withLatestFrom(
|
|
|
|
this.store.pipe(
|
|
|
|
select((state: any) => state.messenger.room.roomInfo as RoomInfo)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
tap(([noti, roomInfo]) => {
|
|
|
|
// 현재 방이 오픈되어 있으면 방내용 갱신
|
|
|
|
if (!!roomInfo && roomInfo.roomSeq === noti.roomSeq) {
|
|
|
|
this.store.dispatch(delInfoList({ eventSeq: noti.eventSeq }));
|
|
|
|
}
|
|
|
|
|
|
|
|
// 대화 > 리스트의 항목 갱신
|
|
|
|
const loginInfo = this.sessionStorageService.get<LoginInfo>(
|
|
|
|
KEY_LOGIN_INFO
|
|
|
|
);
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.refreshRoom({
|
|
|
|
roomSeq: noti.roomSeq,
|
|
|
|
isDetail: true,
|
|
|
|
localeCode: loginInfo.localeCode
|
|
|
|
})
|
|
|
|
);
|
|
|
|
})
|
2019-10-11 05:01:43 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
{ dispatch: false }
|
|
|
|
);
|
|
|
|
|
2019-10-08 04:18:05 +00:00
|
|
|
constructor(
|
|
|
|
private actions$: Actions,
|
|
|
|
private store: Store<any>,
|
2019-10-28 09:03:27 +00:00
|
|
|
private commonApiService: CommonApiService,
|
2019-10-08 04:18:05 +00:00
|
|
|
private eventProtocolService: EventProtocolService,
|
2019-10-24 08:04:58 +00:00
|
|
|
private roomProtocolService: RoomProtocolService,
|
2019-10-08 04:18:05 +00:00
|
|
|
private sessionStorageService: SessionStorageService,
|
|
|
|
private logger: NGXLogger
|
|
|
|
) {}
|
|
|
|
}
|