diff --git a/app/lib/redux/reducers/me.js b/app/lib/redux/reducers/me.js index b692b1d..be24a81 100644 --- a/app/lib/redux/reducers/me.js +++ b/app/lib/redux/reducers/me.js @@ -1,16 +1,18 @@ const initialState = { - name : null, - displayName : null, - displayNameSet : false, - device : null, - canSendMic : false, - canSendWebcam : false, - canChangeWebcam : false, - webcamInProgress : false, - audioOnly : false, - audioOnlyInProgress : false, - restartIceInProgress : false + name : null, + displayName : null, + displayNameSet : false, + device : null, + canSendMic : false, + canSendWebcam : false, + canShareScreen : true, + canChangeWebcam : false, + webcamInProgress : false, + screenShareInProgress : false, + audioOnly : false, + audioOnlyInProgress : false, + restartIceInProgress : false }; const me = (state = initialState, action) => @@ -26,9 +28,9 @@ const me = (state = initialState, action) => 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': @@ -45,6 +47,13 @@ const me = (state = initialState, action) => return { ...state, webcamInProgress: flag }; } + case 'SET_SCREEN_SHARE_IN_PROGRESS': + { + const { flag } = action.payload; + + return { ...state, screenShareInProgress: flag }; + } + case 'SET_DISPLAY_NAME': { let { displayName } = action.payload; diff --git a/app/lib/redux/requestActions.js b/app/lib/redux/requestActions.js index 14210ef..5a53fb5 100644 --- a/app/lib/redux/requestActions.js +++ b/app/lib/redux/requestActions.js @@ -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) => { const message = createNewMessage(text, 'response', name); diff --git a/app/lib/redux/roomClientMiddleware.js b/app/lib/redux/roomClientMiddleware.js index 271d700..9ba36a8 100644 --- a/app/lib/redux/roomClientMiddleware.js +++ b/app/lib/redux/roomClientMiddleware.js @@ -109,6 +109,20 @@ export default ({ dispatch, getState }) => (next) => break; } + case 'ENABLE_SCREEN_SHARING': + { + client.enableScreenSharing(); + + break; + } + + case 'DISABLE_SCREEN_SHARING': + { + client.disableScreenSharing(); + + break; + } + case 'SEND_CHAT_MESSAGE': { const { message } = action.payload; diff --git a/app/lib/redux/stateActions.js b/app/lib/redux/stateActions.js index bd19225..c788b25 100644 --- a/app/lib/redux/stateActions.js +++ b/app/lib/redux/stateActions.js @@ -30,11 +30,11 @@ export const setMe = ({ peerName, displayName, displayNameSet, device }) => }; }; -export const setMediaCapabilities = ({ canSendMic, canSendWebcam }) => +export const setMediaCapabilities = ({ canSendMic, canSendWebcam, canShareScreen }) => { return { 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) => { return {