129 lines
3.7 KiB
TypeScript
129 lines
3.7 KiB
TypeScript
updateProfileImageNoti$ = createEffect(
|
|
() =>
|
|
this.actions$.pipe(
|
|
ofType(updateProfileImageNoti),
|
|
withLatestFrom(
|
|
this.store.pipe(
|
|
select(
|
|
(state: any) =>
|
|
state.messenger.sync.room.entities as Dictionary<RoomInfo>
|
|
)
|
|
),
|
|
this.store.pipe(
|
|
select(
|
|
(state: any) =>
|
|
state.messenger.sync.roomUserShort.entities as Dictionary<
|
|
RoomUserData
|
|
>
|
|
)
|
|
)
|
|
// this.store.pipe(
|
|
// select(
|
|
// (state: any) => state.messenger.sync.buddy2.syncDate as string
|
|
// )
|
|
// ),
|
|
// this.store.pipe(
|
|
// select(
|
|
// (state: any) => state.messenger.sync.group2.syncDate as string
|
|
// )
|
|
// ),
|
|
// this.store.pipe(
|
|
// select((state: any) => state.messenger.sync.room.syncDate as string)
|
|
// )
|
|
// tap(async ([action, buddy2SyncDate, group2SyncDate, roomSyncDate]) => {
|
|
),
|
|
tap(async ([action, roomInfos, roomUserShorts]) => {
|
|
const userNoti = action.noti as UserNotification;
|
|
|
|
// const loginInfo = this.sessionStorageService.get<LoginInfo>(
|
|
// KEY_LOGIN_INFO
|
|
// );
|
|
|
|
// this.store.dispatch(buddy2({ syncDate: buddy2SyncDate }));
|
|
// this.store.dispatch(group2({ syncDate: group2SyncDate }));
|
|
// this.store.dispatch(
|
|
// room({
|
|
// syncDate: roomSyncDate,
|
|
// localeCode: loginInfo.localeCode
|
|
// })
|
|
// );
|
|
|
|
this.store.dispatch(
|
|
updateBuddyProfile({
|
|
noti: userNoti
|
|
})
|
|
);
|
|
|
|
for (const key in roomUserShorts) {
|
|
if (key === undefined) {
|
|
continue;
|
|
}
|
|
if (roomUserShorts.hasOwnProperty(key)) {
|
|
const element = roomUserShorts[key];
|
|
const tmpRoomInfo = roomInfos[key];
|
|
|
|
if (
|
|
tmpRoomInfo.roomType === RoomType.Single ||
|
|
tmpRoomInfo.roomType === RoomType.Allim_Lbot
|
|
) {
|
|
const findUser = element.userInfos.filter(
|
|
(u) => u.seq === userNoti.SENDER_SEQ
|
|
)[0];
|
|
|
|
if (!!findUser && !!findUser.seq) {
|
|
const tmpUserInfos: UserInfoShort[] = [];
|
|
element.userInfos.map((u) => {
|
|
let user: UserInfoShort;
|
|
|
|
if (!!u && u.seq === userNoti.SENDER_SEQ) {
|
|
user = {
|
|
...u,
|
|
profileImageFile: userNoti.info
|
|
};
|
|
} else {
|
|
user = u;
|
|
}
|
|
tmpUserInfos.push(user);
|
|
});
|
|
const roomData = {
|
|
roomSeq: roomInfos[key].roomSeq,
|
|
userInfos: tmpUserInfos
|
|
} as RoomUserData;
|
|
|
|
this.store.dispatch(
|
|
updateRoomUserShortProfile({
|
|
roomData,
|
|
noti: userNoti
|
|
})
|
|
);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
),
|
|
{ dispatch: false }
|
|
);
|
|
|
|
|
|
|
|
|
|
// updateProfileImageNoti$ = createEffect(() =>
|
|
// this.actions$.pipe(
|
|
// ofType(updateProfileImageNoti),
|
|
// withLatestFrom(
|
|
// this.store.pipe(
|
|
// select(
|
|
// (state: any) =>
|
|
// state.messenger.sync.roomUserShort.entities as Dictionary<
|
|
// RoomUserData
|
|
// >
|
|
// )
|
|
// )
|
|
// ),
|
|
// tap(async ([action, roomUserShorts]) => {
|
|
// const userNoti = action.noti as UserNotification;
|
|
// })
|
|
// )
|
|
// );
|