Fixed update picture / displayName finally (hopefully)

master
Stefan Otto 2019-10-31 15:30:20 +01:00
parent 87bcd3a895
commit aac2e5f918
3 changed files with 35 additions and 1 deletions

View File

@ -330,6 +330,11 @@ export default class RoomClient
{
text : 'You are logged in.'
}));
if ( store.getState().room.state !== 'new' ) // no socket yet
{
this.changeDisplayName(displayName);
this.changePicture(picture);
}
}
_soundNotification()
@ -656,6 +661,8 @@ export default class RoomClient
stateActions.addLobbyPeer(peer.peerId));
store.dispatch(
stateActions.setLobbyPeerDisplayName(peer.displayName));
store.dispatch(
stateActions.setLobbyPeerPicture(peer.picture));
});
(accessCode != null) && store.dispatch(
@ -1310,8 +1317,10 @@ export default class RoomClient
store.dispatch(stateActions.setInLobby(true));
const { displayName } = store.getState().settings;
const { picture } = store.getState().me;
await this.sendRequest('changeDisplayName', { displayName });
await this.sendRequest('changePicture', { picture })
break;
}
@ -1412,7 +1421,22 @@ export default class RoomClient
break;
}
case 'lobby:changePicture':
{
const { peerId, picture } = notification.data;
store.dispatch(
stateActions.setLobbyPeerPicture(picture, peerId));
store.dispatch(requestActions.notify(
{
text : `Participant in lobby changed picture.`
}));
break;
}
case 'setAccessCode':
{
const { accessCode } = notification.data;

View File

@ -461,6 +461,14 @@ export const setLobbyPeerDisplayName = (displayName, peerId) =>
};
};
export const setLobbyPeerPicture = (picture, peerId) =>
{
return {
type : 'SET_LOBBY_PEER_PICTURE',
payload : { picture, peerId }
};
};
export const setLobbyPeerPromotionInProgress = (peerId, flag) =>
{
return {

View File

@ -7,7 +7,8 @@ const lobbyPeer = (state = {}, action) =>
case 'SET_LOBBY_PEER_DISPLAY_NAME':
return { ...state, displayName: action.payload.displayName };
case 'SET_LOBBY_PEER_PICTURE':
return { ...state, picture: action.payload.picture };
case 'SET_LOBBY_PEER_PROMOTION_IN_PROGRESS':
return { ...state, promotionInProgress: action.payload.flag };
@ -36,6 +37,7 @@ const lobbyPeers = (state = {}, action) =>
}
case 'SET_LOBBY_PEER_DISPLAY_NAME':
case 'SET_LOBBY_PEER_PICTURE':
case 'SET_LOBBY_PEER_PROMOTION_IN_PROGRESS':
{
const oldLobbyPeer = state[action.payload.peerId];