feat(App): move participant leaving logic to base/participants
This commit is contained in:
parent
96a837801e
commit
f2f991e969
|
@ -9,7 +9,6 @@ import { compose, createStore } from 'redux';
|
||||||
import Thunk from 'redux-thunk';
|
import Thunk from 'redux-thunk';
|
||||||
|
|
||||||
import { i18next } from '../../base/i18n';
|
import { i18next } from '../../base/i18n';
|
||||||
import { localParticipantLeft } from '../../base/participants';
|
|
||||||
import {
|
import {
|
||||||
MiddlewareRegistry,
|
MiddlewareRegistry,
|
||||||
ReducerRegistry,
|
ReducerRegistry,
|
||||||
|
@ -118,8 +117,7 @@ export class AbstractApp extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init lib-jitsi-meet and create local participant when component is going
|
* Initializes the app.
|
||||||
* to be mounted.
|
|
||||||
*
|
*
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
|
@ -185,16 +183,13 @@ export class AbstractApp extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispose lib-jitsi-meet and remove local participant when component is
|
* De-initializes the app.
|
||||||
* going to be unmounted.
|
|
||||||
*
|
*
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
const { dispatch } = this._getStore();
|
const { dispatch } = this._getStore();
|
||||||
|
|
||||||
dispatch(localParticipantLeft());
|
|
||||||
|
|
||||||
dispatch(appWillUnmount(this));
|
dispatch(appWillUnmount(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import { playSound, registerSound, unregisterSound } from '../sounds';
|
||||||
import {
|
import {
|
||||||
localParticipantIdChanged,
|
localParticipantIdChanged,
|
||||||
localParticipantJoined,
|
localParticipantJoined,
|
||||||
|
localParticipantLeft,
|
||||||
participantLeft,
|
participantLeft,
|
||||||
participantUpdated
|
participantUpdated
|
||||||
} from './actions';
|
} from './actions';
|
||||||
|
@ -57,7 +58,8 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
|
|
||||||
case APP_WILL_UNMOUNT:
|
case APP_WILL_UNMOUNT:
|
||||||
_unregisterSounds(store);
|
_unregisterSounds(store);
|
||||||
break;
|
|
||||||
|
return _localParticipantLeft(store, next, action);
|
||||||
|
|
||||||
case CONFERENCE_WILL_JOIN:
|
case CONFERENCE_WILL_JOIN:
|
||||||
store.dispatch(localParticipantIdChanged(action.conference.myUserId()));
|
store.dispatch(localParticipantIdChanged(action.conference.myUserId()));
|
||||||
|
@ -202,6 +204,25 @@ function _localParticipantJoined({ getState, dispatch }, next, action) {
|
||||||
return result;
|
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.
|
* Plays sounds when participants join/leave conference.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue