ソースを参照

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

master
Saúl Ibarra Corretgé 7年前
コミット
f2f991e969

+ 2
- 7
react/features/app/components/AbstractApp.js ファイルの表示

9
 import Thunk from 'redux-thunk';
9
 import Thunk from 'redux-thunk';
10
 
10
 
11
 import { i18next } from '../../base/i18n';
11
 import { i18next } from '../../base/i18n';
12
-import { localParticipantLeft } from '../../base/participants';
13
 import {
12
 import {
14
     MiddlewareRegistry,
13
     MiddlewareRegistry,
15
     ReducerRegistry,
14
     ReducerRegistry,
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
      * @inheritdoc
122
      * @inheritdoc
125
      */
123
      */
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
      * @inheritdoc
188
      * @inheritdoc
192
      */
189
      */
193
     componentWillUnmount() {
190
     componentWillUnmount() {
194
         const { dispatch } = this._getStore();
191
         const { dispatch } = this._getStore();
195
 
192
 
196
-        dispatch(localParticipantLeft());
197
-
198
         dispatch(appWillUnmount(this));
193
         dispatch(appWillUnmount(this));
199
     }
194
     }
200
 
195
 

+ 22
- 1
react/features/base/participants/middleware.js ファイルの表示

14
 import {
14
 import {
15
     localParticipantIdChanged,
15
     localParticipantIdChanged,
16
     localParticipantJoined,
16
     localParticipantJoined,
17
+    localParticipantLeft,
17
     participantLeft,
18
     participantLeft,
18
     participantUpdated
19
     participantUpdated
19
 } from './actions';
20
 } from './actions';
57
 
58
 
58
     case APP_WILL_UNMOUNT:
59
     case APP_WILL_UNMOUNT:
59
         _unregisterSounds(store);
60
         _unregisterSounds(store);
60
-        break;
61
+
62
+        return _localParticipantLeft(store, next, action);
61
 
63
 
62
     case CONFERENCE_WILL_JOIN:
64
     case CONFERENCE_WILL_JOIN:
63
         store.dispatch(localParticipantIdChanged(action.conference.myUserId()));
65
         store.dispatch(localParticipantIdChanged(action.conference.myUserId()));
202
     return result;
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
  * Plays sounds when participants join/leave conference.
227
  * Plays sounds when participants join/leave conference.
207
  *
228
  *

読み込み中…
キャンセル
保存