notification of status is implemented
This commit is contained in:
parent
9b0106a4be
commit
e9088572d5
|
@ -12,8 +12,6 @@ import {
|
|||
LogoutRemoteNotification
|
||||
} from '@ucap-webmessenger/protocol-authentication';
|
||||
|
||||
import * as AuthenticationStore from '@app/store/account/authentication';
|
||||
import * as EventStore from '@app/store/messenger/event';
|
||||
import { NGXLogger } from 'ngx-logger';
|
||||
import {
|
||||
EventProtocolService,
|
||||
|
@ -53,6 +51,12 @@ import {
|
|||
UpdateFontNotification
|
||||
} from '@ucap-webmessenger/protocol-room';
|
||||
|
||||
import * as AuthenticationStore from '@app/store/account/authentication';
|
||||
import * as InfoStore from '@app/store/account/info';
|
||||
import * as EventStore from '@app/store/messenger/event';
|
||||
import * as RoomStore from '@app/store/messenger/room';
|
||||
import * as StatusStore from '@app/store/messenger/status';
|
||||
|
||||
@Injectable()
|
||||
export class AppNotificationService {
|
||||
constructor(
|
||||
|
@ -175,6 +179,11 @@ export class AppNotificationService {
|
|||
'Notification::infoProtocolService::UserNotification',
|
||||
noti
|
||||
);
|
||||
this.store.dispatch(
|
||||
InfoStore.userNotification({
|
||||
noti
|
||||
})
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -194,6 +203,11 @@ export class AppNotificationService {
|
|||
'Notification::roomProtocolService::InviteNotification',
|
||||
noti
|
||||
);
|
||||
this.store.dispatch(
|
||||
RoomStore.inviteNotification({
|
||||
noti
|
||||
})
|
||||
);
|
||||
}
|
||||
break;
|
||||
case SSVC_TYPE_ROOM_EXIT_NOTI:
|
||||
|
@ -203,6 +217,11 @@ export class AppNotificationService {
|
|||
'Notification::roomProtocolService::ExitNotification',
|
||||
noti
|
||||
);
|
||||
this.store.dispatch(
|
||||
RoomStore.exitNotification({
|
||||
noti
|
||||
})
|
||||
);
|
||||
}
|
||||
break;
|
||||
case SSVC_TYPE_ROOM_EXIT_FORCING_NOTI:
|
||||
|
@ -212,6 +231,11 @@ export class AppNotificationService {
|
|||
'Notification::roomProtocolService::ExitForcingNotification',
|
||||
noti
|
||||
);
|
||||
this.store.dispatch(
|
||||
RoomStore.exitForcingNotification({
|
||||
noti
|
||||
})
|
||||
);
|
||||
}
|
||||
break;
|
||||
case SSVC_TYPE_ROOM_FONT_UPD_NOTI:
|
||||
|
@ -221,6 +245,11 @@ export class AppNotificationService {
|
|||
'Notification::roomProtocolService::UpdateFontNotification',
|
||||
noti
|
||||
);
|
||||
this.store.dispatch(
|
||||
RoomStore.updateFontNotification({
|
||||
noti
|
||||
})
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -240,6 +269,11 @@ export class AppNotificationService {
|
|||
'Notification::statusProtocolService::StatusNotification',
|
||||
noti
|
||||
);
|
||||
this.store.dispatch(
|
||||
StatusStore.statusNotification({
|
||||
noti
|
||||
})
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -73,16 +73,16 @@ export class Effects {
|
|||
{ dispatch: false }
|
||||
);
|
||||
|
||||
statusNotification$ = createEffect(
|
||||
() => {
|
||||
return this.actions$.pipe(
|
||||
ofType(statusNotification),
|
||||
map(action => action.noti),
|
||||
tap(noti => {})
|
||||
);
|
||||
},
|
||||
{ dispatch: false }
|
||||
);
|
||||
// statusNotification$ = createEffect(
|
||||
// () => {
|
||||
// return this.actions$.pipe(
|
||||
// ofType(statusNotification),
|
||||
// map(action => action.noti),
|
||||
// tap(noti => {})
|
||||
// );
|
||||
// },
|
||||
// { dispatch: false }
|
||||
// );
|
||||
|
||||
constructor(
|
||||
private actions$: Actions,
|
||||
|
|
|
@ -1,15 +1,41 @@
|
|||
import { createReducer, on } from '@ngrx/store';
|
||||
import { initialState } from './state';
|
||||
import { bulkInfoSuccess } from './actions';
|
||||
import { initialState, State, adapterStatusBulkInfo } from './state';
|
||||
import { bulkInfoSuccess, statusNotification } from './actions';
|
||||
|
||||
import * as AuthenticationStore from '@app/store/account/authentication';
|
||||
import { StatusBulkInfo } from '@ucap-webmessenger/protocol-status';
|
||||
|
||||
export const reducer = createReducer(
|
||||
initialState,
|
||||
on(bulkInfoSuccess, (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
statusBulkInfoList: action.statusBulkInfoList
|
||||
statusBulkInfo: adapterStatusBulkInfo.addAll(action.statusBulkInfoList, {
|
||||
...state.statusBulkInfo
|
||||
})
|
||||
} as State;
|
||||
}),
|
||||
|
||||
on(statusNotification, (state, action) => {
|
||||
const noti = action.noti;
|
||||
|
||||
const statusBulkInfoState: StatusBulkInfo = {
|
||||
...state.statusBulkInfo.entities[noti.userSeq],
|
||||
conferenceStatus: noti.conferenceStatus,
|
||||
imessengerStatus: noti.imessengerStatus,
|
||||
mobileConferenceStatus: noti.mobileConferenceStatus,
|
||||
mobileStatus: noti.mobileStatus,
|
||||
pcStatus: noti.pcStatus,
|
||||
phoneStatus: noti.phoneStatus,
|
||||
statusMessage: noti.statusMessage
|
||||
};
|
||||
|
||||
return {
|
||||
...state,
|
||||
statusBulkInfo: adapterStatusBulkInfo.updateOne(
|
||||
{ id: noti.userSeq, changes: statusBulkInfoState },
|
||||
{ ...state.statusBulkInfo }
|
||||
)
|
||||
};
|
||||
}),
|
||||
|
||||
|
|
|
@ -1,19 +1,48 @@
|
|||
import { Selector, createSelector } from '@ngrx/store';
|
||||
import { StatusBulkInfo } from '@ucap-webmessenger/protocol-status';
|
||||
import { EntityState, createEntityAdapter } from '@ngrx/entity';
|
||||
|
||||
export interface StatusBulkInfoState extends EntityState<StatusBulkInfo> {}
|
||||
|
||||
export interface State {
|
||||
statusBulkInfoList: StatusBulkInfo[];
|
||||
statusBulkInfo: StatusBulkInfoState;
|
||||
}
|
||||
|
||||
export const adapterStatusBulkInfo = createEntityAdapter<StatusBulkInfo>({
|
||||
selectId: statusBulkInfo => statusBulkInfo.userSeq
|
||||
});
|
||||
|
||||
const statusBulkInfoInitialState: StatusBulkInfoState = adapterStatusBulkInfo.getInitialState(
|
||||
{}
|
||||
);
|
||||
|
||||
export const initialState: State = {
|
||||
statusBulkInfoList: []
|
||||
statusBulkInfo: statusBulkInfoInitialState
|
||||
};
|
||||
|
||||
const {
|
||||
selectAll: ngeSelectAllStatusBulkInfo,
|
||||
selectEntities: ngeSelectEntitiesStatusBulkInfo,
|
||||
selectIds: ngeSelectIdsStatusBulkInfo,
|
||||
selectTotal: ngeSelectTotalStatusBulkInfo
|
||||
} = adapterStatusBulkInfo.getSelectors();
|
||||
|
||||
export function selectors<S>(selector: Selector<any, State>) {
|
||||
return {
|
||||
statusBulkInfoList: createSelector(
|
||||
const selectStatusBulkInfo = createSelector(
|
||||
selector,
|
||||
(state: State) => state.statusBulkInfoList
|
||||
(state: State) => state.statusBulkInfo
|
||||
);
|
||||
|
||||
return {
|
||||
selectAllStatusBulkInfo: createSelector(
|
||||
selectStatusBulkInfo,
|
||||
ngeSelectAllStatusBulkInfo
|
||||
),
|
||||
selectStatusBulkInfo: (userSeq: number) =>
|
||||
createSelector(
|
||||
selectStatusBulkInfo,
|
||||
ngeSelectEntitiesStatusBulkInfo,
|
||||
(_, entities) => entities[userSeq]
|
||||
)
|
||||
};
|
||||
}
|
||||
|
|
|
@ -286,6 +286,7 @@ export class RoomProtocolService {
|
|||
})
|
||||
);
|
||||
}
|
||||
|
||||
public updateTimerSet(
|
||||
req: UpdateTimerSetRequest
|
||||
): Observable<UpdateTimerSetResponse> {
|
||||
|
@ -302,6 +303,7 @@ export class RoomProtocolService {
|
|||
})
|
||||
);
|
||||
}
|
||||
|
||||
public updateFont(req: UpdateFontRequest): Observable<UpdateFontResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
|
|
Loading…
Reference in New Issue
Block a user