refactoring of chat search
This commit is contained in:
parent
de0a6b016e
commit
6657461150
|
@ -1772,10 +1772,13 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
// CASE :: searching text after retrieve All event Infos.
|
||||
this.store.dispatch(
|
||||
EventStore.infoAll({
|
||||
req: {
|
||||
roomSeq: this.roomInfoSubject.value.roomSeq,
|
||||
baseSeq: this.eventListSubject.value[0].seq,
|
||||
requestCount:
|
||||
environment.productConfig.CommonSetting.eventRequestDefaultCount * 2
|
||||
},
|
||||
infoList: undefined
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ export const infoForSearchEnd = createAction(
|
|||
|
||||
export const infoAll = createAction(
|
||||
'[Messenger::Event] Info All',
|
||||
props<InfoRequest>()
|
||||
props<{ req: InfoRequest; infoList: Info<EventJson>[] }>()
|
||||
);
|
||||
|
||||
export const fileInfo = createAction(
|
||||
|
|
|
@ -412,7 +412,10 @@ export class Effects {
|
|||
)
|
||||
)
|
||||
),
|
||||
switchMap(([req, processing]) => {
|
||||
switchMap(([params, processing]) => {
|
||||
const req = params.req;
|
||||
const mergedInfoList = params.infoList;
|
||||
|
||||
return this.eventProtocolService.info(req).pipe(
|
||||
map(async res => {
|
||||
switch (res.SSVC_TYPE) {
|
||||
|
@ -421,31 +424,36 @@ export class Effects {
|
|||
break;
|
||||
case SSVC_TYPE_EVENT_INFO_RES:
|
||||
{
|
||||
if (
|
||||
infoList.length > 0 &&
|
||||
infoList.length >= req.requestCount &&
|
||||
processing
|
||||
) {
|
||||
// 재귀
|
||||
this.store.dispatch(
|
||||
infoAll({
|
||||
req: {
|
||||
roomSeq: req.roomSeq,
|
||||
baseSeq: infoList[0].seq,
|
||||
requestCount: req.requestCount
|
||||
},
|
||||
infoList: !!mergedInfoList
|
||||
? [...infoList, ...mergedInfoList]
|
||||
: infoList
|
||||
})
|
||||
);
|
||||
} else {
|
||||
this.store.dispatch(
|
||||
infoMoreSuccess({
|
||||
infoList,
|
||||
infoList: !!mergedInfoList
|
||||
? [...infoList, ...mergedInfoList]
|
||||
: infoList,
|
||||
res: res as InfoResponse,
|
||||
remainInfo:
|
||||
infoList.length === req.requestCount ? true : false
|
||||
})
|
||||
);
|
||||
|
||||
if (infoList.length > 0) {
|
||||
if (infoList.length === req.requestCount && processing) {
|
||||
// 재귀
|
||||
this.store.dispatch(
|
||||
infoAll({
|
||||
roomSeq: req.roomSeq,
|
||||
baseSeq: infoList[0].seq,
|
||||
requestCount: req.requestCount
|
||||
})
|
||||
);
|
||||
} else {
|
||||
if (infoList.length < req.requestCount) {
|
||||
this.store.dispatch(infoForSearchEnd({}));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.store.dispatch(infoForSearchEnd({}));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user