Skip to content

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

feat(App): move participant leaving logic to base/participants

Saúl Ibarra Corretgéf2f991e96921
diff --git a/react/features/app/components/AbstractApp.js b/react/features/app/components/AbstractApp.js
index 7bb48ece7c..cbd5c5d696 100644
--- a/react/features/app/components/AbstractApp.js
+++ b/react/features/app/components/AbstractApp.js
@@ -9,7 +9,6 @@ import { compose, createStore } from 'redux';
import Thunk from 'redux-thunk';
import { i18next } from '../../base/i18n';
-import { localParticipantLeft } from '../../base/participants';
import {
MiddlewareRegistry,
ReducerRegistry,
@@ -118,8 +117,7 @@ export class AbstractApp extends Component {
}
/**
- * Init lib-jitsi-meet and create local participant when component is going
- * to be mounted.
+ * Initializes the app.
*
* @inheritdoc
*/
@@ -185,16 +183,13 @@ export class AbstractApp extends Component {
}
/**
- * Dispose lib-jitsi-meet and remove local participant when component is
- * going to be unmounted.
+ * De-initializes the app.
*
* @inheritdoc
*/
componentWillUnmount() {
const { dispatch } = this._getStore();
- dispatch(localParticipantLeft());
-
dispatch(appWillUnmount(this));
}
diff --git a/react/features/base/participants/middleware.js b/react/features/base/participants/middleware.js
index a2549f1328..bfacded26d 100644
--- a/react/features/base/participants/middleware.js
+++ b/react/features/base/participants/middleware.js
@@ -14,6 +14,7 @@ import { playSound, registerSound, unregisterSound } from '../sounds';
import {
localParticipantIdChanged,
localParticipantJoined,
+ localParticipantLeft,
participantLeft,
participantUpdated
} from './actions';
@@ -57,7 +58,8 @@ MiddlewareRegistry.register(store => next => action => {
case APP_WILL_UNMOUNT:
_unregisterSounds(store);
- break;
+
+ return _localParticipantLeft(store, next, action);
case CONFERENCE_WILL_JOIN:
store.dispatch(localParticipantIdChanged(action.conference.myUserId()));
@@ -202,6 +204,25 @@ function _localParticipantJoined({ getState, dispatch }, next, action) {
return result;
}
+/**
+ * Signals that the local participant has left.
+ *
+ * @param {Store} store - The redux store.
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
+ * specified {@code action} into the specified {@code store}.
+ * @param {Action} action - The redux action which is being dispatched in the
+ * specified {@code store}.
+ * @private
+ * @returns {Object} The value returned by {@code next(action)}.
+ */
+function _localParticipantLeft({ dispatch }, next, action) {
+ const result = next(action);
+
+ dispatch(localParticipantLeft());
+
+ return result;
+}
+
/**
* Plays sounds when participants join/leave conference.
*