Added actions and updated middleware and reducer.
parent
886d77216a
commit
06b480f4f4
|
|
@ -1,16 +1,18 @@
|
||||||
const initialState =
|
const initialState =
|
||||||
{
|
{
|
||||||
name : null,
|
name : null,
|
||||||
displayName : null,
|
displayName : null,
|
||||||
displayNameSet : false,
|
displayNameSet : false,
|
||||||
device : null,
|
device : null,
|
||||||
canSendMic : false,
|
canSendMic : false,
|
||||||
canSendWebcam : false,
|
canSendWebcam : false,
|
||||||
canChangeWebcam : false,
|
canShareScreen : true,
|
||||||
webcamInProgress : false,
|
canChangeWebcam : false,
|
||||||
audioOnly : false,
|
webcamInProgress : false,
|
||||||
audioOnlyInProgress : false,
|
screenShareInProgress : false,
|
||||||
restartIceInProgress : false
|
audioOnly : false,
|
||||||
|
audioOnlyInProgress : false,
|
||||||
|
restartIceInProgress : false
|
||||||
};
|
};
|
||||||
|
|
||||||
const me = (state = initialState, action) =>
|
const me = (state = initialState, action) =>
|
||||||
|
|
@ -26,9 +28,9 @@ const me = (state = initialState, action) =>
|
||||||
|
|
||||||
case 'SET_MEDIA_CAPABILITIES':
|
case 'SET_MEDIA_CAPABILITIES':
|
||||||
{
|
{
|
||||||
const { canSendMic, canSendWebcam } = action.payload;
|
const { canSendMic, canSendWebcam, canShareScreen } = action.payload;
|
||||||
|
|
||||||
return { ...state, canSendMic, canSendWebcam };
|
return { ...state, canSendMic, canSendWebcam, canShareScreen };
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'SET_CAN_CHANGE_WEBCAM':
|
case 'SET_CAN_CHANGE_WEBCAM':
|
||||||
|
|
@ -45,6 +47,13 @@ const me = (state = initialState, action) =>
|
||||||
return { ...state, webcamInProgress: flag };
|
return { ...state, webcamInProgress: flag };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'SET_SCREEN_SHARE_IN_PROGRESS':
|
||||||
|
{
|
||||||
|
const { flag } = action.payload;
|
||||||
|
|
||||||
|
return { ...state, screenShareInProgress: flag };
|
||||||
|
}
|
||||||
|
|
||||||
case 'SET_DISPLAY_NAME':
|
case 'SET_DISPLAY_NAME':
|
||||||
{
|
{
|
||||||
let { displayName } = action.payload;
|
let { displayName } = action.payload;
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,20 @@ export const restartIce = () =>
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const enableScreenSharing = () =>
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
type : 'ENABLE_SCREEN_SHARING'
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const disableScreenSharing = () =>
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
type : 'DISABLE_SCREEN_SHARING'
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const sendChatMessage = (text, name) =>
|
export const sendChatMessage = (text, name) =>
|
||||||
{
|
{
|
||||||
const message = createNewMessage(text, 'response', name);
|
const message = createNewMessage(text, 'response', name);
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,20 @@ export default ({ dispatch, getState }) => (next) =>
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'ENABLE_SCREEN_SHARING':
|
||||||
|
{
|
||||||
|
client.enableScreenSharing();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'DISABLE_SCREEN_SHARING':
|
||||||
|
{
|
||||||
|
client.disableScreenSharing();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'SEND_CHAT_MESSAGE':
|
case 'SEND_CHAT_MESSAGE':
|
||||||
{
|
{
|
||||||
const { message } = action.payload;
|
const { message } = action.payload;
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@ export const setMe = ({ peerName, displayName, displayNameSet, device }) =>
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setMediaCapabilities = ({ canSendMic, canSendWebcam }) =>
|
export const setMediaCapabilities = ({ canSendMic, canSendWebcam, canShareScreen }) =>
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
type : 'SET_MEDIA_CAPABILITIES',
|
type : 'SET_MEDIA_CAPABILITIES',
|
||||||
payload : { canSendMic, canSendWebcam }
|
payload : { canSendMic, canSendWebcam, canShareScreen }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -126,6 +126,14 @@ export const setWebcamInProgress = (flag) =>
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const setScreenShareInProgress = (flag) =>
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
type : 'SET_SCREEN_SHARE_IN_PROGRESS',
|
||||||
|
payload : { flag }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const addPeer = (peer) =>
|
export const addPeer = (peer) =>
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue