Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

don't use params to switch actionType

Radium Zheng337cea64886a
diff --git a/react/features/local-recording/actions.js b/react/features/local-recording/actions.js
index 9ed6f1c389..fea3cdb834 100644
--- a/react/features/local-recording/actions.js
+++ b/react/features/local-recording/actions.js
@@ -7,24 +7,35 @@ import {
LOCAL_RECORDING_STATS_UPDATE
} from './actionTypes';
+// The following two actions signal state changes in local recording engagement.
+// In other words, the events of the local WebWorker / MediaRecorder starting to
+// record and finishing recording.
+// Note that this is not the event fired when the users tries to start the
+// recording in the UI.
+
/**
- * Signals state change in local recording engagement.
- * In other words, the events of the local WebWorker / MediaRecorder
- * starting to record and finishing recording.
- *
- * Note that this is not the event fired when the users tries to start
- * the recording in the UI.
+ * Signals that local recording has started.
*
- * @param {bool} isEngaged - Whether local recording is engaged or not.
* @returns {{
* type: LOCAL_RECORDING_ENGAGED
- * }|{
+ * }}
+ */
+export function localRecordingEngaged() {
+ return {
+ type: LOCAL_RECORDING_ENGAGED
+ };
+}
+
+/**
+ * Signals that local recording has finished.
+ *
+ * @returns {{
* type: LOCAL_RECORDING_UNENGAGED
* }}
*/
-export function signalLocalRecordingEngagement(isEngaged: boolean) {
+export function localRecordingUnengaged() {
return {
- type: isEngaged ? LOCAL_RECORDING_ENGAGED : LOCAL_RECORDING_UNENGAGED
+ type: LOCAL_RECORDING_UNENGAGED
};
}
diff --git a/react/features/local-recording/middleware.js b/react/features/local-recording/middleware.js
index 3fde2fe88e..2c904b3493 100644
--- a/react/features/local-recording/middleware.js
+++ b/react/features/local-recording/middleware.js
@@ -6,8 +6,8 @@ import { i18next } from '../base/i18n';
import { MiddlewareRegistry } from '../base/redux';
import { showNotification } from '../notifications';
+import { localRecordingEngaged, localRecordingUnengaged } from './actions';
import { recordingController } from './controller';
-import { signalLocalRecordingEngagement } from './actions';
MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
const result = next(action);
@@ -20,10 +20,14 @@ MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
break;
}
case APP_WILL_MOUNT:
- // realize the delegates on recordingController,
- // providing UI reactions.
- recordingController.onStateChanged = function(state) {
- dispatch(signalLocalRecordingEngagement(state));
+ // realize the delegates on recordingController, allowing the UI to
+ // react to state changes in recordingController.
+ recordingController.onStateChanged = function(isEngaged) {
+ if (isEngaged) {
+ dispatch(localRecordingEngaged());
+ } else {
+ dispatch(localRecordingUnengaged());
+ }
};
recordingController.onWarning = function(message) {