From 3033f7bc3d9c9fce803c70c6fb697fd2413df070 Mon Sep 17 00:00:00 2001 From: Lyubo Marinov Date: Wed, 15 Nov 2017 09:23:22 -0600 Subject: [PATCH] Coding style, consistency We're already using the notion of _WILL_ in redux action types and there's currently no compelling reason to introduce _BEGIN_ as well. --- react/features/base/tracks/actionTypes.js | 40 +++++++++++------------ react/features/base/tracks/actions.js | 6 ++-- react/features/base/tracks/reducer.js | 10 +++--- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/react/features/base/tracks/actionTypes.js b/react/features/base/tracks/actionTypes.js index eff80d7dc..2a8351cdb 100644 --- a/react/features/base/tracks/actionTypes.js +++ b/react/features/base/tracks/actionTypes.js @@ -9,26 +9,6 @@ */ export const TRACK_ADDED = Symbol('TRACK_ADDED'); -/** - * The type of redux action dispatched when a local track starts being created - * via a WebRTC {@code getUserMedia} call. The action's payload includes an - * extra {@code gumProcess} property which is a {@code Promise} with an extra - * {@code cancel} method which can be used to cancel the process. Canceling will - * result in disposing any {@code JitsiLocalTrack} returned by the - * {@code getUserMedia} callback. There will be a {@code TRACK_CREATE_CANCELED} - * action instead of a {@code TRACK_ADDED} or {@code TRACK_CREATE_ERROR} action. - * - * { - * type: TRACK_BEING_CREATED - * track: { - * gumProcess: Promise with a `cancel` method to cancel the process, - * local: true, - * mediaType: MEDIA_TYPE - * } - * } - */ -export const TRACK_BEING_CREATED = Symbol('TRACK_BEING_CREATED'); - /** * The type of redux action dispatched when a canceled {@code getUserMedia} * process completes either successfully or with an error (the error is ignored @@ -73,3 +53,23 @@ export const TRACK_REMOVED = Symbol('TRACK_REMOVED'); * } */ export const TRACK_UPDATED = Symbol('TRACK_UPDATED'); + +/** + * The type of redux action dispatched when a local track starts being created + * via a WebRTC {@code getUserMedia} call. The action's payload includes an + * extra {@code gumProcess} property which is a {@code Promise} with an extra + * {@code cancel} method which can be used to cancel the process. Canceling will + * result in disposing any {@code JitsiLocalTrack} returned by the + * {@code getUserMedia} callback. There will be a {@code TRACK_CREATE_CANCELED} + * action instead of a {@code TRACK_ADDED} or {@code TRACK_CREATE_ERROR} action. + * + * { + * type: TRACK_WILL_CREATE + * track: { + * gumProcess: Promise with a `cancel` method to cancel the process, + * local: true, + * mediaType: MEDIA_TYPE + * } + * } + */ +export const TRACK_WILL_CREATE = Symbol('TRACK_WILL_CREATE'); diff --git a/react/features/base/tracks/actions.js b/react/features/base/tracks/actions.js index 369ca8122..afa44dda6 100644 --- a/react/features/base/tracks/actions.js +++ b/react/features/base/tracks/actions.js @@ -10,11 +10,11 @@ import { getLocalParticipant } from '../participants'; import { TRACK_ADDED, - TRACK_BEING_CREATED, TRACK_CREATE_CANCELED, TRACK_CREATE_ERROR, TRACK_REMOVED, - TRACK_UPDATED + TRACK_UPDATED, + TRACK_WILL_CREATE } from './actionTypes'; import { createLocalTracksF } from './functions'; @@ -138,7 +138,7 @@ export function createLocalTracksA(options = {}) { }; dispatch({ - type: TRACK_BEING_CREATED, + type: TRACK_WILL_CREATE, track: { gumProcess, local: true, diff --git a/react/features/base/tracks/reducer.js b/react/features/base/tracks/reducer.js index d2cce6e4f..3ed393170 100644 --- a/react/features/base/tracks/reducer.js +++ b/react/features/base/tracks/reducer.js @@ -3,11 +3,11 @@ import { ReducerRegistry } from '../redux'; import { TRACK_ADDED, - TRACK_BEING_CREATED, TRACK_CREATE_CANCELED, TRACK_CREATE_ERROR, TRACK_REMOVED, - TRACK_UPDATED + TRACK_UPDATED, + TRACK_WILL_CREATE } from './actionTypes'; /** @@ -101,9 +101,6 @@ ReducerRegistry.register('features/base/tracks', (state = [], action) => { return [ ...withoutTrackStub, action.track ]; } - case TRACK_BEING_CREATED: - return [ ...state, action.track ]; - case TRACK_CREATE_CANCELED: case TRACK_CREATE_ERROR: { return state.filter(t => !t.local || t.mediaType !== action.trackType); @@ -112,6 +109,9 @@ ReducerRegistry.register('features/base/tracks', (state = [], action) => { case TRACK_REMOVED: return state.filter(t => t.jitsiTrack !== action.track.jitsiTrack); + case TRACK_WILL_CREATE: + return [ ...state, action.track ]; + default: return state; }