소스 검색

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

master
Saúl Ibarra Corretgé 7 년 전
부모
커밋
f2f991e969
2개의 변경된 파일24개의 추가작업 그리고 8개의 파일을 삭제
  1. 2
    7
      react/features/app/components/AbstractApp.js
  2. 22
    1
      react/features/base/participants/middleware.js

+ 2
- 7
react/features/app/components/AbstractApp.js 파일 보기

@@ -9,7 +9,6 @@ import { compose, createStore } from 'redux';
9 9
 import Thunk from 'redux-thunk';
10 10
 
11 11
 import { i18next } from '../../base/i18n';
12
-import { localParticipantLeft } from '../../base/participants';
13 12
 import {
14 13
     MiddlewareRegistry,
15 14
     ReducerRegistry,
@@ -118,8 +117,7 @@ export class AbstractApp extends Component {
118 117
     }
119 118
 
120 119
     /**
121
-     * Init lib-jitsi-meet and create local participant when component is going
122
-     * to be mounted.
120
+     * Initializes the app.
123 121
      *
124 122
      * @inheritdoc
125 123
      */
@@ -185,16 +183,13 @@ export class AbstractApp extends Component {
185 183
     }
186 184
 
187 185
     /**
188
-     * Dispose lib-jitsi-meet and remove local participant when component is
189
-     * going to be unmounted.
186
+     * De-initializes the app.
190 187
      *
191 188
      * @inheritdoc
192 189
      */
193 190
     componentWillUnmount() {
194 191
         const { dispatch } = this._getStore();
195 192
 
196
-        dispatch(localParticipantLeft());
197
-
198 193
         dispatch(appWillUnmount(this));
199 194
     }
200 195
 

+ 22
- 1
react/features/base/participants/middleware.js 파일 보기

@@ -14,6 +14,7 @@ import { playSound, registerSound, unregisterSound } from '../sounds';
14 14
 import {
15 15
     localParticipantIdChanged,
16 16
     localParticipantJoined,
17
+    localParticipantLeft,
17 18
     participantLeft,
18 19
     participantUpdated
19 20
 } from './actions';
@@ -57,7 +58,8 @@ MiddlewareRegistry.register(store => next => action => {
57 58
 
58 59
     case APP_WILL_UNMOUNT:
59 60
         _unregisterSounds(store);
60
-        break;
61
+
62
+        return _localParticipantLeft(store, next, action);
61 63
 
62 64
     case CONFERENCE_WILL_JOIN:
63 65
         store.dispatch(localParticipantIdChanged(action.conference.myUserId()));
@@ -202,6 +204,25 @@ function _localParticipantJoined({ getState, dispatch }, next, action) {
202 204
     return result;
203 205
 }
204 206
 
207
+/**
208
+ * Signals that the local participant has left.
209
+ *
210
+ * @param {Store} store - The redux store.
211
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
212
+ * specified {@code action} into the specified {@code store}.
213
+ * @param {Action} action - The redux action which is being dispatched in the
214
+ * specified {@code store}.
215
+ * @private
216
+ * @returns {Object} The value returned by {@code next(action)}.
217
+ */
218
+function _localParticipantLeft({ dispatch }, next, action) {
219
+    const result = next(action);
220
+
221
+    dispatch(localParticipantLeft());
222
+
223
+    return result;
224
+}
225
+
205 226
 /**
206 227
  * Plays sounds when participants join/leave conference.
207 228
  *

Loading…
취소
저장