Refactor stateActions for better overview.

master
Håvar Aambø Fosstveit 2019-11-05 11:53:21 +01:00
parent a9be34aea7
commit 8ab1475fea
31 changed files with 667 additions and 873 deletions

View File

@ -9,7 +9,17 @@ import hark from 'hark';
// import Spotlights from './Spotlights'; // import Spotlights from './Spotlights';
import { getSignalingUrl } from './urlFactory'; import { getSignalingUrl } from './urlFactory';
import * as requestActions from './actions/requestActions'; import * as requestActions from './actions/requestActions';
import * as stateActions from './actions/stateActions'; import * as meActions from './actions/meActions';
import * as roomActions from './actions/roomActions';
import * as peerActions from './actions/peerActions';
import * as peerVolumeActions from './actions/peerVolumeActions';
import * as settingsActions from './actions/settingsActions';
import * as chatActions from './actions/chatActions';
import * as fileActions from './actions/fileActions';
import * as lobbyPeerActions from './actions/lobbyPeerActions';
import * as consumerActions from './actions/consumerActions';
import * as producerActions from './actions/producerActions';
import * as notificationActions from './actions/notificationActions';
let WebTorrent; let WebTorrent;
@ -130,7 +140,7 @@ export default class RoomClient
// The room ID // The room ID
this._roomId = roomId; this._roomId = roomId;
store.dispatch(stateActions.setRoomName(roomId)); store.dispatch(roomActions.setRoomName(roomId));
// mediasoup-client Device instance. // mediasoup-client Device instance.
// @type {mediasoupClient.Device} // @type {mediasoupClient.Device}
@ -200,7 +210,7 @@ export default class RoomClient
if (this._recvTransport) if (this._recvTransport)
this._recvTransport.close(); this._recvTransport.close();
store.dispatch(stateActions.setRoomState('closed')); store.dispatch(roomActions.setRoomState('closed'));
window.location = '/'; window.location = '/';
} }
@ -224,7 +234,7 @@ export default class RoomClient
{ {
case 'a': // Activate advanced mode case 'a': // Activate advanced mode
{ {
store.dispatch(stateActions.toggleAdvancedMode()); store.dispatch(settingsActions.toggleAdvancedMode());
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
text : 'Toggled advanced mode.' text : 'Toggled advanced mode.'
@ -234,7 +244,7 @@ export default class RoomClient
case '1': // Set democratic view case '1': // Set democratic view
{ {
store.dispatch(stateActions.setDisplayMode('democratic')); store.dispatch(roomActions.setDisplayMode('democratic'));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
text : 'Changed layout to democratic view.' text : 'Changed layout to democratic view.'
@ -244,7 +254,7 @@ export default class RoomClient
case '2': // Set filmstrip view case '2': // Set filmstrip view
{ {
store.dispatch(stateActions.setDisplayMode('filmstrip')); store.dispatch(roomActions.setDisplayMode('filmstrip'));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
text : 'Changed layout to filmstrip view.' text : 'Changed layout to filmstrip view.'
@ -333,11 +343,11 @@ export default class RoomClient
} }
else else
{ {
store.dispatch(stateActions.setDisplayName(displayName)); store.dispatch(settingsActions.setDisplayName(displayName));
store.dispatch(stateActions.setPicture(picture)); store.dispatch(meActions.setPicture(picture));
} }
store.dispatch(stateActions.loggedIn(true)); store.dispatch(meActions.loggedIn(true));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -349,7 +359,7 @@ export default class RoomClient
{ {
logger.debug('receiveLogoutChildWindow()'); logger.debug('receiveLogoutChildWindow()');
store.dispatch(stateActions.loggedIn(false)); store.dispatch(meActions.loggedIn(false));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -440,13 +450,13 @@ export default class RoomClient
displayName = 'Guest'; displayName = 'Guest';
store.dispatch( store.dispatch(
stateActions.setDisplayNameInProgress(true)); meActions.setDisplayNameInProgress(true));
try try
{ {
await this.sendRequest('changeDisplayName', { displayName }); await this.sendRequest('changeDisplayName', { displayName });
store.dispatch(stateActions.setDisplayName(displayName)); store.dispatch(settingsActions.setDisplayName(displayName));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -465,7 +475,7 @@ export default class RoomClient
} }
store.dispatch( store.dispatch(
stateActions.setDisplayNameInProgress(false)); meActions.setDisplayNameInProgress(false));
} }
async changePicture(picture) async changePicture(picture)
@ -489,7 +499,7 @@ export default class RoomClient
try try
{ {
store.dispatch( store.dispatch(
stateActions.addUserMessage(chatMessage.text)); chatActions.addUserMessage(chatMessage.text));
await this.sendRequest('chatMessage', { chatMessage }); await this.sendRequest('chatMessage', { chatMessage });
} }
@ -525,7 +535,7 @@ export default class RoomClient
handleDownload(magnetUri) handleDownload(magnetUri)
{ {
store.dispatch( store.dispatch(
stateActions.setFileActive(magnetUri)); fileActions.setFileActive(magnetUri));
const existingTorrent = this._webTorrent.get(magnetUri); const existingTorrent = this._webTorrent.get(magnetUri);
@ -545,7 +555,7 @@ export default class RoomClient
if (torrent.progress === 1) if (torrent.progress === 1)
{ {
return store.dispatch( return store.dispatch(
stateActions.setFileDone( fileActions.setFileDone(
torrent.magnetURI, torrent.magnetURI,
torrent.files torrent.files
)); ));
@ -558,7 +568,7 @@ export default class RoomClient
if (Date.now() - lastMove > 1000) if (Date.now() - lastMove > 1000)
{ {
store.dispatch( store.dispatch(
stateActions.setFileProgress( fileActions.setFileProgress(
torrent.magnetURI, torrent.magnetURI,
torrent.progress torrent.progress
)); ));
@ -570,7 +580,7 @@ export default class RoomClient
torrent.on('done', () => torrent.on('done', () =>
{ {
store.dispatch( store.dispatch(
stateActions.setFileDone( fileActions.setFileDone(
torrent.magnetURI, torrent.magnetURI,
torrent.files torrent.files
)); ));
@ -598,7 +608,7 @@ export default class RoomClient
text : 'File successfully shared.' text : 'File successfully shared.'
})); }));
store.dispatch(stateActions.addFile( store.dispatch(fileActions.addFile(
this._peerId, this._peerId,
torrent.magnetURI torrent.magnetURI
)); ));
@ -644,10 +654,10 @@ export default class RoomClient
} = await this.sendRequest('serverHistory'); } = await this.sendRequest('serverHistory');
(chatHistory.length > 0) && store.dispatch( (chatHistory.length > 0) && store.dispatch(
stateActions.addChatHistory(chatHistory)); chatActions.addChatHistory(chatHistory));
(fileHistory.length > 0) && store.dispatch( (fileHistory.length > 0) && store.dispatch(
stateActions.addFileHistory(fileHistory)); fileActions.addFileHistory(fileHistory));
if (lastNHistory.length > 0) if (lastNHistory.length > 0)
{ {
@ -662,21 +672,21 @@ export default class RoomClient
} }
locked ? locked ?
store.dispatch(stateActions.setRoomLocked()) : store.dispatch(roomActions.setRoomLocked()) :
store.dispatch(stateActions.setRoomUnLocked()); store.dispatch(roomActions.setRoomUnLocked());
(lobbyPeers.length > 0) && lobbyPeers.forEach((peer) => (lobbyPeers.length > 0) && lobbyPeers.forEach((peer) =>
{ {
store.dispatch( store.dispatch(
stateActions.addLobbyPeer(peer.peerId)); lobbyPeerActions.addLobbyPeer(peer.peerId));
store.dispatch( store.dispatch(
stateActions.setLobbyPeerDisplayName(peer.displayName)); lobbyPeerActions.setLobbyPeerDisplayName(peer.displayName));
store.dispatch( store.dispatch(
stateActions.setLobbyPeerPicture(peer.picture)); lobbyPeerActions.setLobbyPeerPicture(peer.picture));
}); });
(accessCode != null) && store.dispatch( (accessCode != null) && store.dispatch(
stateActions.setAccessCode(accessCode)); roomActions.setAccessCode(accessCode));
} }
catch (error) catch (error)
{ {
@ -702,7 +712,7 @@ export default class RoomClient
'pauseProducer', { producerId: this._micProducer.id }); 'pauseProducer', { producerId: this._micProducer.id });
store.dispatch( store.dispatch(
stateActions.setProducerPaused(this._micProducer.id)); producerActions.setProducerPaused(this._micProducer.id));
} }
catch (error) catch (error)
{ {
@ -734,7 +744,7 @@ export default class RoomClient
'resumeProducer', { producerId: this._micProducer.id }); 'resumeProducer', { producerId: this._micProducer.id });
store.dispatch( store.dispatch(
stateActions.setProducerResumed(this._micProducer.id)); producerActions.setProducerResumed(this._micProducer.id));
} }
catch (error) catch (error)
{ {
@ -798,7 +808,7 @@ export default class RoomClient
logger.debug('changeAudioDevice() [deviceId: %s]', deviceId); logger.debug('changeAudioDevice() [deviceId: %s]', deviceId);
store.dispatch( store.dispatch(
stateActions.setAudioInProgress(true)); meActions.setAudioInProgress(true));
try try
{ {
@ -860,14 +870,14 @@ export default class RoomClient
{ {
this._micProducer.volume = volume; this._micProducer.volume = volume;
store.dispatch(stateActions.setPeerVolume(this._peerId, volume)); store.dispatch(peerVolumeActions.setPeerVolume(this._peerId, volume));
} }
}); });
store.dispatch( store.dispatch(
stateActions.setProducerTrack(this._micProducer.id, track)); producerActions.setProducerTrack(this._micProducer.id, track));
store.dispatch(stateActions.setSelectedAudioDevice(deviceId)); store.dispatch(settingsActions.setSelectedAudioDevice(deviceId));
await this._updateAudioDevices(); await this._updateAudioDevices();
} }
@ -877,7 +887,7 @@ export default class RoomClient
} }
store.dispatch( store.dispatch(
stateActions.setAudioInProgress(false)); meActions.setAudioInProgress(false));
} }
async changeVideoResolution(resolution) async changeVideoResolution(resolution)
@ -885,7 +895,7 @@ export default class RoomClient
logger.debug('changeVideoResolution() [resolution: %s]', resolution); logger.debug('changeVideoResolution() [resolution: %s]', resolution);
store.dispatch( store.dispatch(
stateActions.setWebcamInProgress(true)); meActions.setWebcamInProgress(true));
try try
{ {
@ -914,10 +924,10 @@ export default class RoomClient
await this._webcamProducer.replaceTrack({ track }); await this._webcamProducer.replaceTrack({ track });
store.dispatch( store.dispatch(
stateActions.setProducerTrack(this._webcamProducer.id, track)); producerActions.setProducerTrack(this._webcamProducer.id, track));
store.dispatch(stateActions.setSelectedWebcamDevice(deviceId)); store.dispatch(settingsActions.setSelectedWebcamDevice(deviceId));
store.dispatch(stateActions.setVideoResolution(resolution)); store.dispatch(settingsActions.setVideoResolution(resolution));
await this._updateWebcams(); await this._updateWebcams();
} }
@ -927,7 +937,7 @@ export default class RoomClient
} }
store.dispatch( store.dispatch(
stateActions.setWebcamInProgress(false)); meActions.setWebcamInProgress(false));
} }
async changeWebcam(deviceId) async changeWebcam(deviceId)
@ -935,7 +945,7 @@ export default class RoomClient
logger.debug('changeWebcam() [deviceId: %s]', deviceId); logger.debug('changeWebcam() [deviceId: %s]', deviceId);
store.dispatch( store.dispatch(
stateActions.setWebcamInProgress(true)); meActions.setWebcamInProgress(true));
try try
{ {
@ -967,9 +977,9 @@ export default class RoomClient
await this._webcamProducer.replaceTrack({ track }); await this._webcamProducer.replaceTrack({ track });
store.dispatch( store.dispatch(
stateActions.setProducerTrack(this._webcamProducer.id, track)); producerActions.setProducerTrack(this._webcamProducer.id, track));
store.dispatch(stateActions.setSelectedWebcamDevice(deviceId)); store.dispatch(settingsActions.setSelectedWebcamDevice(deviceId));
await this._updateWebcams(); await this._updateWebcams();
} }
@ -979,7 +989,7 @@ export default class RoomClient
} }
store.dispatch( store.dispatch(
stateActions.setWebcamInProgress(false)); meActions.setWebcamInProgress(false));
} }
setSelectedPeer(peerId) setSelectedPeer(peerId)
@ -989,7 +999,7 @@ export default class RoomClient
this._spotlights.setPeerSpotlight(peerId); this._spotlights.setPeerSpotlight(peerId);
store.dispatch( store.dispatch(
stateActions.setSelectedPeer(peerId)); roomActions.setSelectedPeer(peerId));
} }
async promoteLobbyPeer(peerId) async promoteLobbyPeer(peerId)
@ -997,7 +1007,7 @@ export default class RoomClient
logger.debug('promoteLobbyPeer() [peerId:"%s"]', peerId); logger.debug('promoteLobbyPeer() [peerId:"%s"]', peerId);
store.dispatch( store.dispatch(
stateActions.setLobbyPeerPromotionInProgress(peerId, true)); lobbyPeerActions.setLobbyPeerPromotionInProgress(peerId, true));
try try
{ {
@ -1009,7 +1019,7 @@ export default class RoomClient
} }
store.dispatch( store.dispatch(
stateActions.setLobbyPeerPromotionInProgress(peerId, false)); lobbyPeerActions.setLobbyPeerPromotionInProgress(peerId, false));
} }
// type: mic/webcam/screen // type: mic/webcam/screen
@ -1024,13 +1034,13 @@ export default class RoomClient
if (type === 'mic') if (type === 'mic')
store.dispatch( store.dispatch(
stateActions.setPeerAudioInProgress(peerId, true)); peerActions.setPeerAudioInProgress(peerId, true));
else if (type === 'webcam') else if (type === 'webcam')
store.dispatch( store.dispatch(
stateActions.setPeerVideoInProgress(peerId, true)); peerActions.setPeerVideoInProgress(peerId, true));
else if (type === 'screen') else if (type === 'screen')
store.dispatch( store.dispatch(
stateActions.setPeerScreenInProgress(peerId, true)); peerActions.setPeerScreenInProgress(peerId, true));
try try
{ {
@ -1054,13 +1064,13 @@ export default class RoomClient
if (type === 'mic') if (type === 'mic')
store.dispatch( store.dispatch(
stateActions.setPeerAudioInProgress(peerId, false)); peerActions.setPeerAudioInProgress(peerId, false));
else if (type === 'webcam') else if (type === 'webcam')
store.dispatch( store.dispatch(
stateActions.setPeerVideoInProgress(peerId, false)); peerActions.setPeerVideoInProgress(peerId, false));
else if (type === 'screen') else if (type === 'screen')
store.dispatch( store.dispatch(
stateActions.setPeerScreenInProgress(peerId, false)); peerActions.setPeerScreenInProgress(peerId, false));
} }
async _pauseConsumer(consumer) async _pauseConsumer(consumer)
@ -1077,7 +1087,7 @@ export default class RoomClient
consumer.pause(); consumer.pause();
store.dispatch( store.dispatch(
stateActions.setConsumerPaused(consumer.id, 'local')); consumerActions.setConsumerPaused(consumer.id, 'local'));
} }
catch (error) catch (error)
{ {
@ -1099,7 +1109,7 @@ export default class RoomClient
consumer.resume(); consumer.resume();
store.dispatch( store.dispatch(
stateActions.setConsumerResumed(consumer.id, 'local')); consumerActions.setConsumerResumed(consumer.id, 'local'));
} }
catch (error) catch (error)
{ {
@ -1112,14 +1122,14 @@ export default class RoomClient
logger.debug('sendRaiseHandState: ', state); logger.debug('sendRaiseHandState: ', state);
store.dispatch( store.dispatch(
stateActions.setMyRaiseHandStateInProgress(true)); meActions.setMyRaiseHandStateInProgress(true));
try try
{ {
await this.sendRequest('raiseHand', { raiseHandState: state }); await this.sendRequest('raiseHand', { raiseHandState: state });
store.dispatch( store.dispatch(
stateActions.setMyRaiseHandState(state)); meActions.setMyRaiseHandState(state));
} }
catch (error) catch (error)
{ {
@ -1132,11 +1142,11 @@ export default class RoomClient
})); }));
// We need to refresh the component for it to render changed state // We need to refresh the component for it to render changed state
store.dispatch(stateActions.setMyRaiseHandState(!state)); store.dispatch(meActions.setMyRaiseHandState(!state));
} }
store.dispatch( store.dispatch(
stateActions.setMyRaiseHandStateInProgress(false)); meActions.setMyRaiseHandStateInProgress(false));
} }
async _loadDynamicImports() async _loadDynamicImports()
@ -1215,7 +1225,7 @@ export default class RoomClient
this._spotlights = new Spotlights(this._maxSpotlights, this._signalingSocket); this._spotlights = new Spotlights(this._maxSpotlights, this._signalingSocket);
store.dispatch(stateActions.setRoomState('connecting')); store.dispatch(roomActions.setRoomState('connecting'));
this._signalingSocket.on('connect', () => this._signalingSocket.on('connect', () =>
{ {
@ -1244,7 +1254,7 @@ export default class RoomClient
text : 'You are disconnected, attempting to reconnect.' text : 'You are disconnected, attempting to reconnect.'
})); }));
store.dispatch(stateActions.setRoomState('connecting')); store.dispatch(roomActions.setRoomState('connecting'));
}); });
this._signalingSocket.on('reconnect_failed', () => this._signalingSocket.on('reconnect_failed', () =>
@ -1268,7 +1278,7 @@ export default class RoomClient
text : 'You are reconnected.' text : 'You are reconnected.'
})); }));
store.dispatch(stateActions.setRoomState('connected')); store.dispatch(roomActions.setRoomState('connected'));
}); });
this._signalingSocket.on('request', async (request, cb) => this._signalingSocket.on('request', async (request, cb) =>
@ -1324,7 +1334,7 @@ export default class RoomClient
mediasoupClient.parseScalabilityMode( mediasoupClient.parseScalabilityMode(
consumer.rtpParameters.encodings[0].scalabilityMode); consumer.rtpParameters.encodings[0].scalabilityMode);
store.dispatch(stateActions.addConsumer( store.dispatch(consumerActions.addConsumer(
{ {
id : consumer.id, id : consumer.id,
peerId : peerId, peerId : peerId,
@ -1379,7 +1389,7 @@ export default class RoomClient
{ {
consumer.volume = volume; consumer.volume = volume;
store.dispatch(stateActions.setPeerVolume(peerId, volume)); store.dispatch(peerVolumeActions.setPeerVolume(peerId, volume));
} }
}); });
} }
@ -1408,7 +1418,7 @@ export default class RoomClient
{ {
case 'enteredLobby': case 'enteredLobby':
{ {
store.dispatch(stateActions.setInLobby(true)); store.dispatch(roomActions.setInLobby(true));
const { displayName } = store.getState().settings; const { displayName } = store.getState().settings;
const { picture } = store.getState().me; const { picture } = store.getState().me;
@ -1420,15 +1430,15 @@ export default class RoomClient
case 'signInRequired': case 'signInRequired':
{ {
store.dispatch(stateActions.setSignInRequired(true)); store.dispatch(roomActions.setSignInRequired(true));
break; break;
} }
case 'roomReady': case 'roomReady':
{ {
store.dispatch(stateActions.toggleJoined()); store.dispatch(roomActions.toggleJoined());
store.dispatch(stateActions.setInLobby(false)); store.dispatch(roomActions.setInLobby(false));
await this._joinRoom({ joinVideo }); await this._joinRoom({ joinVideo });
@ -1438,7 +1448,7 @@ export default class RoomClient
case 'lockRoom': case 'lockRoom':
{ {
store.dispatch( store.dispatch(
stateActions.setRoomLocked()); roomActions.setRoomLocked());
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1451,7 +1461,7 @@ export default class RoomClient
case 'unlockRoom': case 'unlockRoom':
{ {
store.dispatch( store.dispatch(
stateActions.setRoomUnLocked()); roomActions.setRoomUnLocked());
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1466,9 +1476,9 @@ export default class RoomClient
const { peerId } = notification.data; const { peerId } = notification.data;
store.dispatch( store.dispatch(
stateActions.addLobbyPeer(peerId)); lobbyPeerActions.addLobbyPeer(peerId));
store.dispatch( store.dispatch(
stateActions.setToolbarsVisible(true)); roomActions.setToolbarsVisible(true));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1483,7 +1493,7 @@ export default class RoomClient
const { peerId } = notification.data; const { peerId } = notification.data;
store.dispatch( store.dispatch(
stateActions.removeLobbyPeer(peerId)); lobbyPeerActions.removeLobbyPeer(peerId));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1498,7 +1508,7 @@ export default class RoomClient
const { peerId } = notification.data; const { peerId } = notification.data;
store.dispatch( store.dispatch(
stateActions.removeLobbyPeer(peerId)); lobbyPeerActions.removeLobbyPeer(peerId));
break; break;
} }
@ -1508,7 +1518,7 @@ export default class RoomClient
const { peerId, displayName } = notification.data; const { peerId, displayName } = notification.data;
store.dispatch( store.dispatch(
stateActions.setLobbyPeerDisplayName(displayName, peerId)); lobbyPeerActions.setLobbyPeerDisplayName(displayName, peerId));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1523,7 +1533,7 @@ export default class RoomClient
const { peerId, picture } = notification.data; const { peerId, picture } = notification.data;
store.dispatch( store.dispatch(
stateActions.setLobbyPeerPicture(picture, peerId)); lobbyPeerActions.setLobbyPeerPicture(picture, peerId));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1538,7 +1548,7 @@ export default class RoomClient
const { accessCode } = notification.data; const { accessCode } = notification.data;
store.dispatch( store.dispatch(
stateActions.setAccessCode(accessCode)); roomActions.setAccessCode(accessCode));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1553,7 +1563,7 @@ export default class RoomClient
const { joinByAccessCode } = notification.data; const { joinByAccessCode } = notification.data;
store.dispatch( store.dispatch(
stateActions.setJoinByAccessCode(joinByAccessCode)); roomActions.setJoinByAccessCode(joinByAccessCode));
if (joinByAccessCode) if (joinByAccessCode)
{ {
@ -1578,7 +1588,7 @@ export default class RoomClient
const { peerId } = notification.data; const { peerId } = notification.data;
store.dispatch( store.dispatch(
stateActions.setRoomActiveSpeaker(peerId)); roomActions.setRoomActiveSpeaker(peerId));
if (peerId && peerId !== this._peerId) if (peerId && peerId !== this._peerId)
this._spotlights.handleActiveSpeaker(peerId); this._spotlights.handleActiveSpeaker(peerId);
@ -1591,7 +1601,7 @@ export default class RoomClient
const { peerId, displayName, oldDisplayName } = notification.data; const { peerId, displayName, oldDisplayName } = notification.data;
store.dispatch( store.dispatch(
stateActions.setPeerDisplayName(displayName, peerId)); peerActions.setPeerDisplayName(displayName, peerId));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1605,7 +1615,7 @@ export default class RoomClient
{ {
const { peerId, picture } = notification.data; const { peerId, picture } = notification.data;
store.dispatch(stateActions.setPeerPicture(peerId, picture)); store.dispatch(peerActions.setPeerPicture(peerId, picture));
break; break;
} }
@ -1615,7 +1625,7 @@ export default class RoomClient
const { peerId, chatMessage } = notification.data; const { peerId, chatMessage } = notification.data;
store.dispatch( store.dispatch(
stateActions.addResponseMessage({ ...chatMessage, peerId })); chatActions.addResponseMessage({ ...chatMessage, peerId }));
if ( if (
!store.getState().toolarea.toolAreaOpen || !store.getState().toolarea.toolAreaOpen ||
@ -1624,7 +1634,7 @@ export default class RoomClient
) // Make sound ) // Make sound
{ {
store.dispatch( store.dispatch(
stateActions.setToolbarsVisible(true)); roomActions.setToolbarsVisible(true));
this._soundNotification(); this._soundNotification();
} }
@ -1635,7 +1645,7 @@ export default class RoomClient
{ {
const { peerId, magnetUri } = notification.data; const { peerId, magnetUri } = notification.data;
store.dispatch(stateActions.addFile(peerId, magnetUri)); store.dispatch(fileActions.addFile(peerId, magnetUri));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1649,7 +1659,7 @@ export default class RoomClient
) // Make sound ) // Make sound
{ {
store.dispatch( store.dispatch(
stateActions.setToolbarsVisible(true)); roomActions.setToolbarsVisible(true));
this._soundNotification(); this._soundNotification();
} }
@ -1661,7 +1671,7 @@ export default class RoomClient
const { producerId, score } = notification.data; const { producerId, score } = notification.data;
store.dispatch( store.dispatch(
stateActions.setProducerScore(producerId, score)); producerActions.setProducerScore(producerId, score));
break; break;
} }
@ -1671,7 +1681,7 @@ export default class RoomClient
const { id, displayName, picture, device } = notification.data; const { id, displayName, picture, device } = notification.data;
store.dispatch( store.dispatch(
stateActions.addPeer({ id, displayName, picture, device, consumers: [] })); peerActions.addPeer({ id, displayName, picture, device, consumers: [] }));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1686,7 +1696,7 @@ export default class RoomClient
const { peerId } = notification.data; const { peerId } = notification.data;
store.dispatch( store.dispatch(
stateActions.removePeer(peerId)); peerActions.removePeer(peerId));
break; break;
} }
@ -1709,7 +1719,7 @@ export default class RoomClient
const { peerId } = consumer.appData; const { peerId } = consumer.appData;
store.dispatch( store.dispatch(
stateActions.removeConsumer(consumerId, peerId)); consumerActions.removeConsumer(consumerId, peerId));
break; break;
} }
@ -1723,7 +1733,7 @@ export default class RoomClient
break; break;
store.dispatch( store.dispatch(
stateActions.setConsumerPaused(consumerId, 'remote')); consumerActions.setConsumerPaused(consumerId, 'remote'));
break; break;
} }
@ -1737,7 +1747,7 @@ export default class RoomClient
break; break;
store.dispatch( store.dispatch(
stateActions.setConsumerResumed(consumerId, 'remote')); consumerActions.setConsumerResumed(consumerId, 'remote'));
break; break;
} }
@ -1750,7 +1760,7 @@ export default class RoomClient
if (!consumer) if (!consumer)
break; break;
store.dispatch(stateActions.setConsumerCurrentLayers( store.dispatch(consumerActions.setConsumerCurrentLayers(
consumerId, spatialLayer, temporalLayer)); consumerId, spatialLayer, temporalLayer));
break; break;
@ -1761,7 +1771,7 @@ export default class RoomClient
const { consumerId, score } = notification.data; const { consumerId, score } = notification.data;
store.dispatch( store.dispatch(
stateActions.setConsumerScore(consumerId, score)); consumerActions.setConsumerScore(consumerId, score));
break; break;
} }
@ -1896,7 +1906,7 @@ export default class RoomClient
}); });
// Set our media capabilities. // Set our media capabilities.
store.dispatch(stateActions.setMediaCapabilities( store.dispatch(meActions.setMediaCapabilities(
{ {
canSendMic : this._mediasoupDevice.canProduce('audio'), canSendMic : this._mediasoupDevice.canProduce('audio'),
canSendWebcam : this._mediasoupDevice.canProduce('video'), canSendWebcam : this._mediasoupDevice.canProduce('video'),
@ -1919,14 +1929,14 @@ export default class RoomClient
for (const peer of peers) for (const peer of peers)
{ {
store.dispatch( store.dispatch(
stateActions.addPeer({ ...peer, consumers: [] })); peerActions.addPeer({ ...peer, consumers: [] }));
} }
this._spotlights.addPeers(peers); this._spotlights.addPeers(peers);
this._spotlights.on('spotlights-updated', (spotlights) => this._spotlights.on('spotlights-updated', (spotlights) =>
{ {
store.dispatch(stateActions.setSpotlights(spotlights)); store.dispatch(roomActions.setSpotlights(spotlights));
this.updateSpotlights(spotlights); this.updateSpotlights(spotlights);
}); });
@ -1940,10 +1950,10 @@ export default class RoomClient
this.enableWebcam(); this.enableWebcam();
} }
store.dispatch(stateActions.setRoomState('connected')); store.dispatch(roomActions.setRoomState('connected'));
// Clean all the existing notifcations. // Clean all the existing notifcations.
store.dispatch(stateActions.removeAllNotifications()); store.dispatch(notificationActions.removeAllNotifications());
this.getServerHistory(); this.getServerHistory();
@ -1956,7 +1966,7 @@ export default class RoomClient
} }
catch (error) catch (error)
{ {
logger.error('_joinRoom() failed:%o', error); logger.error('_joinRoom() failed:"%o"', error);
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1977,7 +1987,7 @@ export default class RoomClient
await this.sendRequest('lockRoom'); await this.sendRequest('lockRoom');
store.dispatch( store.dispatch(
stateActions.setRoomLocked()); roomActions.setRoomLocked());
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -2005,7 +2015,7 @@ export default class RoomClient
await this.sendRequest('unlockRoom'); await this.sendRequest('unlockRoom');
store.dispatch( store.dispatch(
stateActions.setRoomUnLocked()); roomActions.setRoomUnLocked());
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -2033,7 +2043,7 @@ export default class RoomClient
await this.sendRequest('setAccessCode', { accessCode: code }); await this.sendRequest('setAccessCode', { accessCode: code });
store.dispatch( store.dispatch(
stateActions.setAccessCode(code)); roomActions.setAccessCode(code));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -2060,7 +2070,7 @@ export default class RoomClient
await this.sendRequest('setJoinByAccessCode', { joinByAccessCode: value }); await this.sendRequest('setJoinByAccessCode', { joinByAccessCode: value });
store.dispatch( store.dispatch(
stateActions.setJoinByAccessCode(value)); roomActions.setJoinByAccessCode(value));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -2093,7 +2103,7 @@ export default class RoomClient
let track; let track;
store.dispatch( store.dispatch(
stateActions.setAudioInProgress(true)); meActions.setAudioInProgress(true));
try try
{ {
@ -2132,7 +2142,7 @@ export default class RoomClient
{ source: 'mic' } { source: 'mic' }
}); });
store.dispatch(stateActions.addProducer( store.dispatch(producerActions.addProducer(
{ {
id : this._micProducer.id, id : this._micProducer.id,
source : 'mic', source : 'mic',
@ -2142,7 +2152,7 @@ export default class RoomClient
codec : this._micProducer.rtpParameters.codecs[0].mimeType.split('/')[1] codec : this._micProducer.rtpParameters.codecs[0].mimeType.split('/')[1]
})); }));
store.dispatch(stateActions.setSelectedAudioDevice(deviceId)); store.dispatch(settingsActions.setSelectedAudioDevice(deviceId));
await this._updateAudioDevices(); await this._updateAudioDevices();
@ -2196,7 +2206,7 @@ export default class RoomClient
{ {
this._micProducer.volume = volume; this._micProducer.volume = volume;
store.dispatch(stateActions.setPeerVolume(this._peerId, volume)); store.dispatch(peerVolumeActions.setPeerVolume(this._peerId, volume));
} }
}); });
} }
@ -2216,7 +2226,7 @@ export default class RoomClient
} }
store.dispatch( store.dispatch(
stateActions.setAudioInProgress(false)); meActions.setAudioInProgress(false));
} }
async disableMic() async disableMic()
@ -2226,12 +2236,12 @@ export default class RoomClient
if (!this._micProducer) if (!this._micProducer)
return; return;
store.dispatch(stateActions.setAudioInProgress(true)); store.dispatch(meActions.setAudioInProgress(true));
this._micProducer.close(); this._micProducer.close();
store.dispatch( store.dispatch(
stateActions.removeProducer(this._micProducer.id)); producerActions.removeProducer(this._micProducer.id));
try try
{ {
@ -2249,7 +2259,7 @@ export default class RoomClient
this._micProducer = null; this._micProducer = null;
store.dispatch(stateActions.setAudioInProgress(false)); store.dispatch(meActions.setAudioInProgress(false));
} }
async enableScreenSharing() async enableScreenSharing()
@ -2266,7 +2276,7 @@ export default class RoomClient
let track; let track;
store.dispatch(stateActions.setScreenShareInProgress(true)); store.dispatch(meActions.setScreenShareInProgress(true));
try try
{ {
@ -2312,7 +2322,7 @@ export default class RoomClient
}); });
} }
store.dispatch(stateActions.addProducer( store.dispatch(producerActions.addProducer(
{ {
id : this._screenSharingProducer.id, id : this._screenSharingProducer.id,
deviceLabel : 'screen', deviceLabel : 'screen',
@ -2356,7 +2366,7 @@ export default class RoomClient
track.stop(); track.stop();
} }
store.dispatch(stateActions.setScreenShareInProgress(false)); store.dispatch(meActions.setScreenShareInProgress(false));
} }
async disableScreenSharing() async disableScreenSharing()
@ -2366,12 +2376,12 @@ export default class RoomClient
if (!this._screenSharingProducer) if (!this._screenSharingProducer)
return; return;
store.dispatch(stateActions.setScreenShareInProgress(true)); store.dispatch(meActions.setScreenShareInProgress(true));
this._screenSharingProducer.close(); this._screenSharingProducer.close();
store.dispatch( store.dispatch(
stateActions.removeProducer(this._screenSharingProducer.id)); producerActions.removeProducer(this._screenSharingProducer.id));
try try
{ {
@ -2389,7 +2399,7 @@ export default class RoomClient
this._screenSharingProducer = null; this._screenSharingProducer = null;
store.dispatch(stateActions.setScreenShareInProgress(false)); store.dispatch(meActions.setScreenShareInProgress(false));
} }
async enableWebcam() async enableWebcam()
@ -2408,7 +2418,7 @@ export default class RoomClient
let track; let track;
store.dispatch( store.dispatch(
stateActions.setWebcamInProgress(true)); meActions.setWebcamInProgress(true));
try try
{ {
@ -2464,7 +2474,7 @@ export default class RoomClient
}); });
} }
store.dispatch(stateActions.addProducer( store.dispatch(producerActions.addProducer(
{ {
id : this._webcamProducer.id, id : this._webcamProducer.id,
deviceLabel : device.label, deviceLabel : device.label,
@ -2475,7 +2485,7 @@ export default class RoomClient
codec : this._webcamProducer.rtpParameters.codecs[0].mimeType.split('/')[1] codec : this._webcamProducer.rtpParameters.codecs[0].mimeType.split('/')[1]
})); }));
store.dispatch(stateActions.setSelectedWebcamDevice(deviceId)); store.dispatch(settingsActions.setSelectedWebcamDevice(deviceId));
await this._updateWebcams(); await this._updateWebcams();
@ -2513,7 +2523,7 @@ export default class RoomClient
} }
store.dispatch( store.dispatch(
stateActions.setWebcamInProgress(false)); meActions.setWebcamInProgress(false));
} }
async disableWebcam() async disableWebcam()
@ -2523,12 +2533,12 @@ export default class RoomClient
if (!this._webcamProducer) if (!this._webcamProducer)
return; return;
store.dispatch(stateActions.setWebcamInProgress(true)); store.dispatch(meActions.setWebcamInProgress(true));
this._webcamProducer.close(); this._webcamProducer.close();
store.dispatch( store.dispatch(
stateActions.removeProducer(this._webcamProducer.id)); producerActions.removeProducer(this._webcamProducer.id));
try try
{ {
@ -2546,7 +2556,7 @@ export default class RoomClient
this._webcamProducer = null; this._webcamProducer = null;
store.dispatch(stateActions.setWebcamInProgress(false)); store.dispatch(meActions.setWebcamInProgress(false));
} }
async _updateAudioDevices() async _updateAudioDevices()
@ -2571,7 +2581,7 @@ export default class RoomClient
} }
store.dispatch( store.dispatch(
stateActions.setAudioDevices(this._audioDevices)); meActions.setAudioDevices(this._audioDevices));
} }
catch (error) catch (error)
{ {
@ -2601,7 +2611,7 @@ export default class RoomClient
} }
store.dispatch( store.dispatch(
stateActions.setWebcamDevices(this._webcams)); meActions.setWebcamDevices(this._webcams));
} }
catch (error) catch (error)
{ {

View File

@ -0,0 +1,17 @@
export const addUserMessage = (text) =>
({
type : 'ADD_NEW_USER_MESSAGE',
payload : { text }
});
export const addResponseMessage = (message) =>
({
type : 'ADD_NEW_RESPONSE_MESSAGE',
payload : { message }
});
export const addChatHistory = (chatHistory) =>
({
type : 'ADD_CHAT_HISTORY',
payload : { chatHistory }
});

View File

@ -0,0 +1,47 @@
export const addConsumer = (consumer, peerId) =>
({
type : 'ADD_CONSUMER',
payload : { consumer, peerId }
});
export const removeConsumer = (consumerId, peerId) =>
({
type : 'REMOVE_CONSUMER',
payload : { consumerId, peerId }
});
export const setConsumerPaused = (consumerId, originator) =>
({
type : 'SET_CONSUMER_PAUSED',
payload : { consumerId, originator }
});
export const setConsumerResumed = (consumerId, originator) =>
({
type : 'SET_CONSUMER_RESUMED',
payload : { consumerId, originator }
});
export const setConsumerCurrentLayers = (consumerId, spatialLayer, temporalLayer) =>
({
type : 'SET_CONSUMER_CURRENT_LAYERS',
payload : { consumerId, spatialLayer, temporalLayer }
});
export const setConsumerPreferredLayers = (consumerId, spatialLayer, temporalLayer) =>
({
type : 'SET_CONSUMER_PREFERRED_LAYERS',
payload : { consumerId, spatialLayer, temporalLayer }
});
export const setConsumerTrack = (consumerId, track) =>
({
type : 'SET_CONSUMER_TRACK',
payload : { consumerId, track }
});
export const setConsumerScore = (consumerId, score) =>
({
type : 'SET_CONSUMER_SCORE',
payload : { consumerId, score }
});

View File

@ -0,0 +1,35 @@
export const addFile = (peerId, magnetUri) =>
({
type : 'ADD_FILE',
payload : { peerId, magnetUri }
});
export const addFileHistory = (fileHistory) =>
({
type : 'ADD_FILE_HISTORY',
payload : { fileHistory }
});
export const setFileActive = (magnetUri) =>
({
type : 'SET_FILE_ACTIVE',
payload : { magnetUri }
});
export const setFileInActive = (magnetUri) =>
({
type : 'SET_FILE_INACTIVE',
payload : { magnetUri }
});
export const setFileProgress = (magnetUri, progress) =>
({
type : 'SET_FILE_PROGRESS',
payload : { magnetUri, progress }
});
export const setFileDone = (magnetUri, sharedFiles) =>
({
type : 'SET_FILE_DONE',
payload : { magnetUri, sharedFiles }
});

View File

@ -0,0 +1,29 @@
export const addLobbyPeer = (peerId) =>
({
type : 'ADD_LOBBY_PEER',
payload : { peerId }
});
export const removeLobbyPeer = (peerId) =>
({
type : 'REMOVE_LOBBY_PEER',
payload : { peerId }
});
export const setLobbyPeerDisplayName = (displayName, peerId) =>
({
type : 'SET_LOBBY_PEER_DISPLAY_NAME',
payload : { displayName, peerId }
});
export const setLobbyPeerPicture = (picture, peerId) =>
({
type : 'SET_LOBBY_PEER_PICTURE',
payload : { picture, peerId }
});
export const setLobbyPeerPromotionInProgress = (peerId, flag) =>
({
type : 'SET_LOBBY_PEER_PROMOTION_IN_PROGRESS',
payload : { peerId, flag }
});

View File

@ -0,0 +1,76 @@
export const setMe = ({ peerId, device, loginEnabled }) =>
({
type : 'SET_ME',
payload : { peerId, device, loginEnabled }
});
export const loggedIn = (flag) =>
({
type : 'LOGGED_IN',
payload : { flag }
});
export const setPicture = (picture) =>
({
type : 'SET_PICTURE',
payload : { picture }
});
export const setMediaCapabilities = ({
canSendMic,
canSendWebcam,
canShareScreen,
canShareFiles
}) =>
({
type : 'SET_MEDIA_CAPABILITIES',
payload : { canSendMic, canSendWebcam, canShareScreen, canShareFiles }
});
export const setAudioDevices = (devices) =>
({
type : 'SET_AUDIO_DEVICES',
payload : { devices }
});
export const setWebcamDevices = (devices) =>
({
type : 'SET_WEBCAM_DEVICES',
payload : { devices }
});
export const setMyRaiseHandState = (flag) =>
({
type : 'SET_MY_RAISE_HAND_STATE',
payload : { flag }
});
export const setAudioInProgress = (flag) =>
({
type : 'SET_AUDIO_IN_PROGRESS',
payload : { flag }
});
export const setWebcamInProgress = (flag) =>
({
type : 'SET_WEBCAM_IN_PROGRESS',
payload : { flag }
});
export const setScreenShareInProgress = (flag) =>
({
type : 'SET_SCREEN_SHARE_IN_PROGRESS',
payload : { flag }
});
export const setMyRaiseHandStateInProgress = (flag) =>
({
type : 'SET_MY_RAISE_HAND_STATE_IN_PROGRESS',
payload : { flag }
});
export const setDisplayNameInProgress = (flag) =>
({
type : 'SET_DISPLAY_NAME_IN_PROGRESS',
payload : { flag }
});

View File

@ -0,0 +1,16 @@
export const addNotification = (notification) =>
({
type : 'ADD_NOTIFICATION',
payload : { notification }
});
export const removeNotification = (notificationId) =>
({
type : 'REMOVE_NOTIFICATION',
payload : { notificationId }
});
export const removeAllNotifications = () =>
({
type : 'REMOVE_ALL_NOTIFICATIONS'
});

View File

@ -0,0 +1,47 @@
export const addPeer = (peer) =>
({
type : 'ADD_PEER',
payload : { peer }
});
export const removePeer = (peerId) =>
({
type : 'REMOVE_PEER',
payload : { peerId }
});
export const setPeerDisplayName = (displayName, peerId) =>
({
type : 'SET_PEER_DISPLAY_NAME',
payload : { displayName, peerId }
});
export const setPeerVideoInProgress = (peerId, flag) =>
({
type : 'SET_PEER_VIDEO_IN_PROGRESS',
payload : { peerId, flag }
});
export const setPeerAudioInProgress = (peerId, flag) =>
({
type : 'SET_PEER_AUDIO_IN_PROGRESS',
payload : { peerId, flag }
});
export const setPeerScreenInProgress = (peerId, flag) =>
({
type : 'SET_PEER_SCREEN_IN_PROGRESS',
payload : { peerId, flag }
});
export const setPeerRaiseHandState = (peerId, raiseHandState) =>
({
type : 'SET_PEER_RAISE_HAND_STATE',
payload : { peerId, raiseHandState }
});
export const setPeerPicture = (peerId, picture) =>
({
type : 'SET_PEER_PICTURE',
payload : { peerId, picture }
});

View File

@ -0,0 +1,5 @@
export const setPeerVolume = (peerId, volume) =>
({
type : 'SET_PEER_VOLUME',
payload : { peerId, volume }
});

View File

@ -0,0 +1,35 @@
export const addProducer = (producer) =>
({
type : 'ADD_PRODUCER',
payload : { producer }
});
export const removeProducer = (producerId) =>
({
type : 'REMOVE_PRODUCER',
payload : { producerId }
});
export const setProducerPaused = (producerId, originator) =>
({
type : 'SET_PRODUCER_PAUSED',
payload : { producerId, originator }
});
export const setProducerResumed = (producerId, originator) =>
({
type : 'SET_PRODUCER_RESUMED',
payload : { producerId, originator }
});
export const setProducerTrack = (producerId, track) =>
({
type : 'SET_PRODUCER_TRACK',
payload : { producerId, track }
});
export const setProducerScore = (producerId, score) =>
({
type : 'SET_PRODUCER_SCORE',
payload : { producerId, score }
});

View File

@ -1,5 +1,5 @@
import randomString from 'random-string'; import randomString from 'random-string';
import * as stateActions from './stateActions'; import * as notificationActions from './notificationActions';
// This returns a redux-thunk action (a function). // This returns a redux-thunk action (a function).
export const notify = ({ type = 'info', text, timeout }) => export const notify = ({ type = 'info', text, timeout }) =>
@ -30,11 +30,11 @@ export const notify = ({ type = 'info', text, timeout }) =>
return (dispatch) => return (dispatch) =>
{ {
dispatch(stateActions.addNotification(notification)); dispatch(notificationActions.addNotification(notification));
setTimeout(() => setTimeout(() =>
{ {
dispatch(stateActions.removeNotification(notification.id)); dispatch(notificationActions.removeNotification(notification.id));
}, timeout); }, timeout);
}; };
}; };

View File

@ -0,0 +1,118 @@
export const setRoomUrl = (url) =>
({
type : 'SET_ROOM_URL',
payload : { url }
});
export const setRoomName = (name) =>
({
type : 'SET_ROOM_NAME',
payload : { name }
});
export const setRoomState = (state) =>
({
type : 'SET_ROOM_STATE',
payload : { state }
});
export const setRoomActiveSpeaker = (peerId) =>
({
type : 'SET_ROOM_ACTIVE_SPEAKER',
payload : { peerId }
});
export const setRoomLocked = () =>
({
type : 'SET_ROOM_LOCKED'
});
export const setRoomUnLocked = () =>
({
type : 'SET_ROOM_UNLOCKED'
});
export const setInLobby = (inLobby) =>
({
type : 'SET_IN_LOBBY',
payload : { inLobby }
});
export const setSignInRequired = (signInRequired) =>
({
type : 'SET_SIGN_IN_REQUIRED',
payload : { signInRequired }
});
export const setAccessCode = (accessCode) =>
({
type : 'SET_ACCESS_CODE',
payload : { accessCode }
});
export const setJoinByAccessCode = (joinByAccessCode) =>
({
type : 'SET_JOIN_BY_ACCESS_CODE',
payload : { joinByAccessCode }
});
export const setSettingsOpen = ({ settingsOpen }) =>
({
type : 'SET_SETTINGS_OPEN',
payload : { settingsOpen }
});
export const setLockDialogOpen = ({ lockDialogOpen }) =>
({
type : 'SET_LOCK_DIALOG_OPEN',
payload : { lockDialogOpen }
});
export const setFileSharingSupported = (supported) =>
({
type : 'FILE_SHARING_SUPPORTED',
payload : { supported }
});
export const toggleConsumerWindow = (consumerId) =>
({
type : 'TOGGLE_WINDOW_CONSUMER',
payload : { consumerId }
});
export const setToolbarsVisible = (toolbarsVisible) =>
({
type : 'SET_TOOLBARS_VISIBLE',
payload : { toolbarsVisible }
});
export const setDisplayMode = (mode) =>
({
type : 'SET_DISPLAY_MODE',
payload : { mode }
});
export const setSelectedPeer = (selectedPeerId) =>
({
type : 'SET_SELECTED_PEER',
payload : { selectedPeerId }
});
export const setSpotlights = (spotlights) =>
({
type : 'SET_SPOTLIGHTS',
payload : { spotlights }
});
export const toggleJoined = () =>
({
type : 'TOGGLE_JOINED'
});
export const toggleConsumerFullscreen = (consumerId) =>
({
type : 'TOGGLE_FULLSCREEN_CONSUMER',
payload : { consumerId }
});

View File

@ -0,0 +1,28 @@
export const setSelectedAudioDevice = (deviceId) =>
({
type : 'CHANGE_AUDIO_DEVICE',
payload : { deviceId }
});
export const setSelectedWebcamDevice = (deviceId) =>
({
type : 'CHANGE_WEBCAM',
payload : { deviceId }
});
export const setVideoResolution = (resolution) =>
({
type : 'SET_VIDEO_RESOLUTION',
payload : { resolution }
});
export const setDisplayName = (displayName) =>
({
type : 'SET_DISPLAY_NAME',
payload : { displayName }
});
export const toggleAdvancedMode = () =>
({
type : 'TOGGLE_ADVANCED_MODE'
});

View File

@ -1,673 +0,0 @@
export const setRoomUrl = (url) =>
{
return {
type : 'SET_ROOM_URL',
payload : { url }
};
};
export const setRoomName = (name) =>
{
return {
type : 'SET_ROOM_NAME',
payload : { name }
};
};
export const setRoomState = (state) =>
{
return {
type : 'SET_ROOM_STATE',
payload : { state }
};
};
export const setRoomActiveSpeaker = (peerId) =>
{
return {
type : 'SET_ROOM_ACTIVE_SPEAKER',
payload : { peerId }
};
};
export const setRoomLocked = () =>
{
return {
type : 'SET_ROOM_LOCKED'
};
};
export const setRoomUnLocked = () =>
{
return {
type : 'SET_ROOM_UNLOCKED'
};
};
export const setInLobby = (inLobby) =>
{
return {
type : 'SET_IN_LOBBY',
payload : { inLobby }
};
};
export const setSignInRequired = (signInRequired) =>
{
return {
type : 'SET_SIGN_IN_REQUIRED',
payload : { signInRequired }
};
};
export const setAccessCode = (accessCode) =>
{
return {
type : 'SET_ACCESS_CODE',
payload : { accessCode }
};
};
export const setJoinByAccessCode = (joinByAccessCode) =>
{
return {
type : 'SET_JOIN_BY_ACCESS_CODE',
payload : { joinByAccessCode }
};
};
export const setSettingsOpen = ({ settingsOpen }) =>
({
type : 'SET_SETTINGS_OPEN',
payload : { settingsOpen }
});
export const setLockDialogOpen = ({ lockDialogOpen }) =>
({
type : 'SET_LOCK_DIALOG_OPEN',
payload : { lockDialogOpen }
});
export const setMe = ({ peerId, device, loginEnabled }) =>
{
return {
type : 'SET_ME',
payload : { peerId, device, loginEnabled }
};
};
export const setMediaCapabilities = ({
canSendMic,
canSendWebcam,
canShareScreen,
canShareFiles
}) =>
{
return {
type : 'SET_MEDIA_CAPABILITIES',
payload : { canSendMic, canSendWebcam, canShareScreen, canShareFiles }
};
};
export const setAudioDevices = (devices) =>
{
return {
type : 'SET_AUDIO_DEVICES',
payload : { devices }
};
};
export const setWebcamDevices = (devices) =>
{
return {
type : 'SET_WEBCAM_DEVICES',
payload : { devices }
};
};
export const setSelectedAudioDevice = (deviceId) =>
{
return {
type : 'CHANGE_AUDIO_DEVICE',
payload : { deviceId }
};
};
export const setSelectedWebcamDevice = (deviceId) =>
{
return {
type : 'CHANGE_WEBCAM',
payload : { deviceId }
};
};
export const setVideoResolution = (resolution) =>
{
return {
type : 'SET_VIDEO_RESOLUTION',
payload : { resolution }
};
};
export const setFileSharingSupported = (supported) =>
{
return {
type : 'FILE_SHARING_SUPPORTED',
payload : { supported }
};
};
export const setDisplayName = (displayName) =>
{
return {
type : 'SET_DISPLAY_NAME',
payload : { displayName }
};
};
export const setDisplayNameInProgress = (flag) =>
{
return {
type : 'SET_DISPLAY_NAME_IN_PROGRESS',
payload : { flag }
};
};
export const toggleAdvancedMode = () =>
{
return {
type : 'TOGGLE_ADVANCED_MODE'
};
};
export const setDisplayMode = (mode) =>
({
type : 'SET_DISPLAY_MODE',
payload : { mode }
});
export const setPeerVideoInProgress = (peerId, flag) =>
{
return {
type : 'SET_PEER_VIDEO_IN_PROGRESS',
payload : { peerId, flag }
};
};
export const setPeerAudioInProgress = (peerId, flag) =>
{
return {
type : 'SET_PEER_AUDIO_IN_PROGRESS',
payload : { peerId, flag }
};
};
export const setPeerScreenInProgress = (peerId, flag) =>
{
return {
type : 'SET_PEER_SCREEN_IN_PROGRESS',
payload : { peerId, flag }
};
};
export const setMyRaiseHandState = (flag) =>
{
return {
type : 'SET_MY_RAISE_HAND_STATE',
payload : { flag }
};
};
export const toggleSettings = () =>
{
return {
type : 'TOGGLE_SETTINGS'
};
};
export const toggleLockDialog = () =>
{
return {
type : 'TOGGLE_LOCK_DIALOG'
};
};
export const toggleToolArea = () =>
{
return {
type : 'TOGGLE_TOOL_AREA'
};
};
export const openToolArea = () =>
{
return {
type : 'OPEN_TOOL_AREA'
};
};
export const closeToolArea = () =>
{
return {
type : 'CLOSE_TOOL_AREA'
};
};
export const setToolTab = (toolTab) =>
{
return {
type : 'SET_TOOL_TAB',
payload : { toolTab }
};
};
export const setMyRaiseHandStateInProgress = (flag) =>
{
return {
type : 'SET_MY_RAISE_HAND_STATE_IN_PROGRESS',
payload : { flag }
};
};
export const setPeerRaiseHandState = (peerId, raiseHandState) =>
{
return {
type : 'SET_PEER_RAISE_HAND_STATE',
payload : { peerId, raiseHandState }
};
};
export const addProducer = (producer) =>
{
return {
type : 'ADD_PRODUCER',
payload : { producer }
};
};
export const removeProducer = (producerId) =>
{
return {
type : 'REMOVE_PRODUCER',
payload : { producerId }
};
};
export const setProducerPaused = (producerId, originator) =>
{
return {
type : 'SET_PRODUCER_PAUSED',
payload : { producerId, originator }
};
};
export const setProducerResumed = (producerId, originator) =>
{
return {
type : 'SET_PRODUCER_RESUMED',
payload : { producerId, originator }
};
};
export const setProducerTrack = (producerId, track) =>
{
return {
type : 'SET_PRODUCER_TRACK',
payload : { producerId, track }
};
};
export const setProducerScore = (producerId, score) =>
{
return {
type : 'SET_PRODUCER_SCORE',
payload : { producerId, score }
};
};
export const setAudioInProgress = (flag) =>
{
return {
type : 'SET_AUDIO_IN_PROGRESS',
payload : { flag }
};
};
export const setWebcamInProgress = (flag) =>
{
return {
type : 'SET_WEBCAM_IN_PROGRESS',
payload : { flag }
};
};
export const setScreenShareInProgress = (flag) =>
{
return {
type : 'SET_SCREEN_SHARE_IN_PROGRESS',
payload : { flag }
};
};
export const addPeer = (peer) =>
{
return {
type : 'ADD_PEER',
payload : { peer }
};
};
export const removePeer = (peerId) =>
{
return {
type : 'REMOVE_PEER',
payload : { peerId }
};
};
export const setPeerDisplayName = (displayName, peerId) =>
{
return {
type : 'SET_PEER_DISPLAY_NAME',
payload : { displayName, peerId }
};
};
export const addConsumer = (consumer, peerId) =>
{
return {
type : 'ADD_CONSUMER',
payload : { consumer, peerId }
};
};
export const removeConsumer = (consumerId, peerId) =>
{
return {
type : 'REMOVE_CONSUMER',
payload : { consumerId, peerId }
};
};
export const setConsumerPaused = (consumerId, originator) =>
{
return {
type : 'SET_CONSUMER_PAUSED',
payload : { consumerId, originator }
};
};
export const setConsumerResumed = (consumerId, originator) =>
{
return {
type : 'SET_CONSUMER_RESUMED',
payload : { consumerId, originator }
};
};
export const setConsumerCurrentLayers = (consumerId, spatialLayer, temporalLayer) =>
{
return {
type : 'SET_CONSUMER_CURRENT_LAYERS',
payload : { consumerId, spatialLayer, temporalLayer }
};
};
export const setConsumerPreferredLayers = (consumerId, spatialLayer, temporalLayer) =>
{
return {
type : 'SET_CONSUMER_PREFERRED_LAYERS',
payload : { consumerId, spatialLayer, temporalLayer }
};
};
export const setConsumerTrack = (consumerId, track) =>
{
return {
type : 'SET_CONSUMER_TRACK',
payload : { consumerId, track }
};
};
export const setConsumerScore = (consumerId, score) =>
{
return {
type : 'SET_CONSUMER_SCORE',
payload : { consumerId, score }
};
};
export const setPeerVolume = (peerId, volume) =>
{
return {
type : 'SET_PEER_VOLUME',
payload : { peerId, volume }
};
};
export const addLobbyPeer = (peerId) =>
{
return {
type : 'ADD_LOBBY_PEER',
payload : { peerId }
};
};
export const removeLobbyPeer = (peerId) =>
{
return {
type : 'REMOVE_LOBBY_PEER',
payload : { peerId }
};
};
export const setLobbyPeerDisplayName = (displayName, peerId) =>
{
return {
type : 'SET_LOBBY_PEER_DISPLAY_NAME',
payload : { displayName, peerId }
};
};
export const setLobbyPeerPicture = (picture, peerId) =>
{
return {
type : 'SET_LOBBY_PEER_PICTURE',
payload : { picture, peerId }
};
};
export const setLobbyPeerPromotionInProgress = (peerId, flag) =>
{
return {
type : 'SET_LOBBY_PEER_PROMOTION_IN_PROGRESS',
payload : { peerId, flag }
};
};
export const addNotification = (notification) =>
{
return {
type : 'ADD_NOTIFICATION',
payload : { notification }
};
};
export const removeNotification = (notificationId) =>
{
return {
type : 'REMOVE_NOTIFICATION',
payload : { notificationId }
};
};
export const removeAllNotifications = () =>
{
return {
type : 'REMOVE_ALL_NOTIFICATIONS'
};
};
export const toggleChat = () =>
{
return {
type : 'TOGGLE_CHAT'
};
};
export const toggleConsumerFullscreen = (consumerId) =>
{
return {
type : 'TOGGLE_FULLSCREEN_CONSUMER',
payload : { consumerId }
};
};
export const toggleConsumerWindow = (consumerId) =>
{
return {
type : 'TOGGLE_WINDOW_CONSUMER',
payload : { consumerId }
};
};
export const setToolbarsVisible = (toolbarsVisible) => ({
type : 'SET_TOOLBARS_VISIBLE',
payload : { toolbarsVisible }
});
export const increaseBadge = () =>
{
return {
type : 'INCREASE_BADGE'
};
};
export const toggleInputDisabled = () =>
{
return {
type : 'TOGGLE_INPUT_DISABLED'
};
};
export const addUserMessage = (text) =>
{
return {
type : 'ADD_NEW_USER_MESSAGE',
payload : { text }
};
};
export const addUserFile = (file) =>
{
return {
type : 'ADD_NEW_USER_FILE',
payload : { file }
};
};
export const addResponseMessage = (message) =>
{
return {
type : 'ADD_NEW_RESPONSE_MESSAGE',
payload : { message }
};
};
export const addChatHistory = (chatHistory) =>
{
return {
type : 'ADD_CHAT_HISTORY',
payload : { chatHistory }
};
};
export const dropMessages = () =>
{
return {
type : 'DROP_MESSAGES'
};
};
export const addFile = (peerId, magnetUri) =>
{
return {
type : 'ADD_FILE',
payload : { peerId, magnetUri }
};
};
export const addFileHistory = (fileHistory) =>
{
return {
type : 'ADD_FILE_HISTORY',
payload : { fileHistory }
};
};
export const setFileActive = (magnetUri) =>
{
return {
type : 'SET_FILE_ACTIVE',
payload : { magnetUri }
};
};
export const setFileInActive = (magnetUri) =>
{
return {
type : 'SET_FILE_INACTIVE',
payload : { magnetUri }
};
};
export const setFileProgress = (magnetUri, progress) =>
{
return {
type : 'SET_FILE_PROGRESS',
payload : { magnetUri, progress }
};
};
export const setFileDone = (magnetUri, sharedFiles) =>
{
return {
type : 'SET_FILE_DONE',
payload : { magnetUri, sharedFiles }
};
};
export const setPicture = (picture) =>
({
type : 'SET_PICTURE',
payload : { picture }
});
export const setPeerPicture = (peerId, picture) =>
({
type : 'SET_PEER_PICTURE',
payload : { peerId, picture }
});
export const loggedIn = (flag) =>
({
type : 'LOGGED_IN',
payload : { flag }
});
export const toggleJoined = () =>
({
type : 'TOGGLE_JOINED'
});
export const setSelectedPeer = (selectedPeerId) =>
({
type : 'SET_SELECTED_PEER',
payload : { selectedPeerId }
});
export const setSpotlights = (spotlights) =>
({
type : 'SET_SPOTLIGHTS',
payload : { spotlights }
});

View File

@ -0,0 +1,20 @@
export const toggleToolArea = () =>
({
type : 'TOGGLE_TOOL_AREA'
});
export const openToolArea = () =>
({
type : 'OPEN_TOOL_AREA'
});
export const closeToolArea = () =>
({
type : 'CLOSE_TOOL_AREA'
});
export const setToolTab = (toolTab) =>
({
type : 'SET_TOOL_TAB',
payload : { toolTab }
});

View File

@ -6,7 +6,7 @@ import {
import * as appPropTypes from '../../appPropTypes'; import * as appPropTypes from '../../appPropTypes';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import { withRoomContext } from '../../../RoomContext'; import { withRoomContext } from '../../../RoomContext';
import * as stateActions from '../../../actions/stateActions'; import * as roomActions from '../../../actions/roomActions';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Dialog from '@material-ui/core/Dialog'; import Dialog from '@material-ui/core/Dialog';
import DialogTitle from '@material-ui/core/DialogTitle'; import DialogTitle from '@material-ui/core/DialogTitle';
@ -175,8 +175,8 @@ const mapStateToProps = (state) =>
}; };
const mapDispatchToProps = { const mapDispatchToProps = {
handleCloseLockDialog : stateActions.setLockDialogOpen, handleCloseLockDialog : roomActions.setLockDialogOpen,
handleAccessCode : stateActions.setAccessCode handleAccessCode : roomActions.setAccessCode
}; };
export default withRoomContext(connect( export default withRoomContext(connect(

View File

@ -3,7 +3,7 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classnames from 'classnames'; import classnames from 'classnames';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import * as stateActions from '../../actions/stateActions'; import * as toolareaActions from '../../actions/toolareaActions';
import BuddyImage from '../../images/buddy.svg'; import BuddyImage from '../../images/buddy.svg';
const styles = () => const styles = () =>
@ -115,8 +115,8 @@ const mapDispatchToProps = (dispatch) =>
return { return {
openUsersTab : () => openUsersTab : () =>
{ {
dispatch(stateActions.openToolArea()); dispatch(toolareaActions.openToolArea());
dispatch(stateActions.setToolTab('users')); dispatch(toolareaActions.setToolTab('users'));
} }
}; };
}; };

View File

@ -7,7 +7,7 @@ import * as appPropTypes from '../appPropTypes';
import { withRoomContext } from '../../RoomContext'; import { withRoomContext } from '../../RoomContext';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import useMediaQuery from '@material-ui/core/useMediaQuery'; import useMediaQuery from '@material-ui/core/useMediaQuery';
import * as stateActions from '../../actions/stateActions'; import * as roomActions from '../../actions/roomActions';
import VideoView from '../VideoContainers/VideoView'; import VideoView from '../VideoContainers/VideoView';
import Fab from '@material-ui/core/Fab'; import Fab from '@material-ui/core/Fab';
import MicIcon from '@material-ui/icons/Mic'; import MicIcon from '@material-ui/icons/Mic';
@ -432,12 +432,12 @@ const mapDispatchToProps = (dispatch) =>
toggleConsumerFullscreen : (consumer) => toggleConsumerFullscreen : (consumer) =>
{ {
if (consumer) if (consumer)
dispatch(stateActions.toggleConsumerFullscreen(consumer.id)); dispatch(roomActions.toggleConsumerFullscreen(consumer.id));
}, },
toggleConsumerWindow : (consumer) => toggleConsumerWindow : (consumer) =>
{ {
if (consumer) if (consumer)
dispatch(stateActions.toggleConsumerWindow(consumer.id)); dispatch(roomActions.toggleConsumerWindow(consumer.id));
} }
}; };
}; };

View File

@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import { withRoomContext } from '../RoomContext'; import { withRoomContext } from '../RoomContext';
import * as stateActions from '../actions/stateActions'; import * as settingsActions from '../actions/settingsActions';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Dialog from '@material-ui/core/Dialog'; import Dialog from '@material-ui/core/Dialog';
import DialogContentText from '@material-ui/core/DialogContentText'; import DialogContentText from '@material-ui/core/DialogContentText';
@ -329,7 +329,7 @@ const mapDispatchToProps = (dispatch) =>
return { return {
changeDisplayName : (displayName) => changeDisplayName : (displayName) =>
{ {
dispatch(stateActions.setDisplayName(displayName)); dispatch(settingsActions.setDisplayName(displayName));
} }
}; };
}; };

View File

@ -33,7 +33,7 @@ class MessageList extends React.Component
shouldComponentUpdate(nextProps) shouldComponentUpdate(nextProps)
{ {
if (nextProps.chatmessages.length !== this.props.chatmessages.length) if (nextProps.chat.length !== this.props.chat.length)
return true; return true;
return false; return false;
@ -55,7 +55,7 @@ class MessageList extends React.Component
render() render()
{ {
const { const {
chatmessages, chat,
myPicture, myPicture,
classes classes
} = this.props; } = this.props;
@ -63,7 +63,7 @@ class MessageList extends React.Component
return ( return (
<div className={classes.root} ref={(node) => { this.node = node; }}> <div className={classes.root} ref={(node) => { this.node = node; }}>
{ {
chatmessages.map((message, index) => chat.map((message, index) =>
{ {
const messageTime = new Date(message.time); const messageTime = new Date(message.time);
@ -89,15 +89,15 @@ class MessageList extends React.Component
MessageList.propTypes = MessageList.propTypes =
{ {
chatmessages : PropTypes.array, chat : PropTypes.array,
myPicture : PropTypes.string, myPicture : PropTypes.string,
classes : PropTypes.object.isRequired classes : PropTypes.object.isRequired
}; };
const mapStateToProps = (state) => const mapStateToProps = (state) =>
({ ({
chatmessages : state.chatmessages, chat : state.chat,
myPicture : state.me.picture myPicture : state.me.picture
}); });
export default connect( export default connect(
@ -108,7 +108,7 @@ export default connect(
areStatesEqual : (next, prev) => areStatesEqual : (next, prev) =>
{ {
return ( return (
prev.chatmessages === next.chatmessages && prev.chat === next.chat &&
prev.me.picture === next.me.picture prev.me.picture === next.me.picture
); );
} }

View File

@ -2,7 +2,7 @@ import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import * as stateActions from '../../actions/stateActions'; import * as toolareaActions from '../../actions/toolareaActions';
import AppBar from '@material-ui/core/AppBar'; import AppBar from '@material-ui/core/AppBar';
import Tabs from '@material-ui/core/Tabs'; import Tabs from '@material-ui/core/Tabs';
import Tab from '@material-ui/core/Tab'; import Tab from '@material-ui/core/Tab';
@ -114,7 +114,7 @@ const mapStateToProps = (state) => ({
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
setToolTab : stateActions.setToolTab setToolTab : toolareaActions.setToolTab
}; };
export default connect( export default connect(

View File

@ -2,7 +2,7 @@ import { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { withSnackbar } from 'notistack'; import { withSnackbar } from 'notistack';
import * as stateActions from '../../actions/stateActions'; import * as notificationActions from '../../actions/notificationActions';
class Notifications extends Component class Notifications extends Component
{ {
@ -77,7 +77,7 @@ const mapStateToProps = (state) =>
const mapDispatchToProps = (dispatch) => const mapDispatchToProps = (dispatch) =>
({ ({
removeNotification : (notificationId) => removeNotification : (notificationId) =>
dispatch(stateActions.removeNotification({ notificationId })) dispatch(notificationActions.removeNotification({ notificationId }))
}); });
export default withSnackbar( export default withSnackbar(

View File

@ -7,7 +7,8 @@ import {
import * as appPropTypes from './appPropTypes'; import * as appPropTypes from './appPropTypes';
import { withRoomContext } from '../RoomContext'; import { withRoomContext } from '../RoomContext';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import * as stateActions from '../actions/stateActions'; import * as roomActions from '../actions/roomActions';
import * as toolareaActions from '../actions/toolareaActions';
import { idle } from '../utils'; import { idle } from '../utils';
import FullScreen from './FullScreen'; import FullScreen from './FullScreen';
import CookieConsent from 'react-cookie-consent'; import CookieConsent from 'react-cookie-consent';
@ -488,19 +489,19 @@ const mapDispatchToProps = (dispatch) =>
({ ({
setToolbarsVisible : (visible) => setToolbarsVisible : (visible) =>
{ {
dispatch(stateActions.setToolbarsVisible(visible)); dispatch(roomActions.setToolbarsVisible(visible));
}, },
setSettingsOpen : (settingsOpen) => setSettingsOpen : (settingsOpen) =>
{ {
dispatch(stateActions.setSettingsOpen({ settingsOpen })); dispatch(roomActions.setSettingsOpen({ settingsOpen }));
}, },
setLockDialogOpen : (lockDialogOpen) => setLockDialogOpen : (lockDialogOpen) =>
{ {
dispatch(stateActions.setLockDialogOpen({ lockDialogOpen })); dispatch(roomActions.setLockDialogOpen({ lockDialogOpen }));
}, },
toggleToolArea : () => toggleToolArea : () =>
{ {
dispatch(stateActions.toggleToolArea()); dispatch(toolareaActions.toggleToolArea());
} }
}); });

View File

@ -3,7 +3,8 @@ import { connect } from 'react-redux';
import * as appPropTypes from '../appPropTypes'; import * as appPropTypes from '../appPropTypes';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import { withRoomContext } from '../../RoomContext'; import { withRoomContext } from '../../RoomContext';
import * as stateActions from '../../actions/stateActions'; import * as roomActions from '../../actions/roomActions';
import * as settingsActions from '../../actions/settingsActions';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Dialog from '@material-ui/core/Dialog'; import Dialog from '@material-ui/core/Dialog';
import DialogTitle from '@material-ui/core/DialogTitle'; import DialogTitle from '@material-ui/core/DialogTitle';
@ -267,9 +268,9 @@ const mapStateToProps = (state) =>
}; };
const mapDispatchToProps = { const mapDispatchToProps = {
onToggleAdvancedMode : stateActions.toggleAdvancedMode, onToggleAdvancedMode : settingsActions.toggleAdvancedMode,
handleChangeMode : stateActions.setDisplayMode, handleChangeMode : roomActions.setDisplayMode,
handleCloseSettings : stateActions.setSettingsOpen, handleCloseSettings : roomActions.setSettingsOpen
}; };
export default withRoomContext(connect( export default withRoomContext(connect(

View File

@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import classnames from 'classnames'; import classnames from 'classnames';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import * as appPropTypes from '../appPropTypes'; import * as appPropTypes from '../appPropTypes';
import * as stateActions from '../../actions/stateActions'; import * as roomActions from '../../actions/roomActions';
import FullScreenExitIcon from '@material-ui/icons/FullscreenExit'; import FullScreenExitIcon from '@material-ui/icons/FullscreenExit';
import VideoView from './VideoView'; import VideoView from './VideoView';
@ -148,7 +148,7 @@ const mapDispatchToProps = (dispatch) =>
toggleConsumerFullscreen : (consumer) => toggleConsumerFullscreen : (consumer) =>
{ {
if (consumer) if (consumer)
dispatch(stateActions.toggleConsumerFullscreen(consumer.id)); dispatch(roomActions.toggleConsumerFullscreen(consumer.id));
} }
}); });

View File

@ -3,7 +3,7 @@ import { connect } from 'react-redux';
import NewWindow from './NewWindow'; import NewWindow from './NewWindow';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import * as appPropTypes from '../appPropTypes'; import * as appPropTypes from '../appPropTypes';
import * as stateActions from '../../actions/stateActions'; import * as roomActions from '../../actions/roomActions';
import FullView from '../VideoContainers/FullView'; import FullView from '../VideoContainers/FullView';
const VideoWindow = (props) => const VideoWindow = (props) =>
@ -59,7 +59,7 @@ const mapDispatchToProps = (dispatch) =>
return { return {
toggleConsumerWindow : () => toggleConsumerWindow : () =>
{ {
dispatch(stateActions.toggleConsumerWindow()); dispatch(roomActions.toggleConsumerWindow());
} }
}; };
}; };

View File

@ -8,7 +8,8 @@ import debug from 'debug';
import RoomClient from './RoomClient'; import RoomClient from './RoomClient';
import RoomContext from './RoomContext'; import RoomContext from './RoomContext';
import deviceInfo from './deviceInfo'; import deviceInfo from './deviceInfo';
import * as stateActions from './actions/stateActions'; import * as roomActions from './actions/roomActions';
import * as meActions from './actions/meActions';
import App from './components/App'; import App from './components/App';
import LoadingView from './components/LoadingView'; import LoadingView from './components/LoadingView';
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles'; import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';
@ -73,10 +74,10 @@ function run()
const device = deviceInfo(); const device = deviceInfo();
store.dispatch( store.dispatch(
stateActions.setRoomUrl(roomUrl)); roomActions.setRoomUrl(roomUrl));
store.dispatch( store.dispatch(
stateActions.setMe({ meActions.setMe({
peerId, peerId,
device, device,
loginEnabled : window.config.loginEnabled loginEnabled : window.config.loginEnabled

View File

@ -3,7 +3,7 @@ import
createNewMessage createNewMessage
} from './helper'; } from './helper';
const chatmessages = (state = [], action) => const chat = (state = [], action) =>
{ {
switch (action.type) switch (action.type)
{ {
@ -30,14 +30,9 @@ const chatmessages = (state = [], action) =>
return [ ...state, ...chatHistory ]; return [ ...state, ...chatHistory ];
} }
case 'DROP_MESSAGES':
{
return [];
}
default: default:
return state; return state;
} }
}; };
export default chatmessages; export default chat;

View File

@ -85,13 +85,6 @@ const files = (state = {}, action) =>
return { ...state, [magnetUri]: newFile }; return { ...state, [magnetUri]: newFile };
} }
case 'REMOVE_FILE':
{
const { magnetUri } = action.payload;
return state.filter((file) => file.magnetUri !== magnetUri);
}
default: default:
return state; return state;
} }

View File

@ -116,13 +116,6 @@ const room = (state = initialState, action) =>
return { ...state, torrentSupport: supported }; return { ...state, torrentSupport: supported };
} }
case 'TOGGLE_SETTINGS':
{
const showSettings = !state.showSettings;
return { ...state, showSettings };
}
case 'TOGGLE_JOINED': case 'TOGGLE_JOINED':
{ {
const joined = !state.joined; const joined = !state.joined;

View File

@ -7,7 +7,7 @@ import lobbyPeers from './lobbyPeers';
import consumers from './consumers'; import consumers from './consumers';
import peerVolumes from './peerVolumes'; import peerVolumes from './peerVolumes';
import notifications from './notifications'; import notifications from './notifications';
import chatmessages from './chatmessages'; import chat from './chat';
import toolarea from './toolarea'; import toolarea from './toolarea';
import files from './files'; import files from './files';
import settings from './settings'; import settings from './settings';
@ -21,7 +21,7 @@ export default combineReducers({
consumers, consumers,
peerVolumes, peerVolumes,
notifications, notifications,
chatmessages, chat,
toolarea, toolarea,
files, files,
settings settings