Skip to content

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

Use Symbol for Redux action types to prevent conflicts

Lyubomir Marinovdaf56455a59c
diff --git a/react/features/app/actionTypes.js b/react/features/app/actionTypes.js
index 55567ef7f5..7e5f2da8bf 100644
--- a/react/features/app/actionTypes.js
+++ b/react/features/app/actionTypes.js
@@ -1,3 +1,5 @@
+import { Symbol } from '../base/react';
+
/**
* The type of the actions which signals that a specific App will mount (in the
* terms of React).
@@ -7,7 +9,7 @@
* app: App
* }
*/
-export const APP_WILL_MOUNT = 'APP_WILL_MOUNT';
+export const APP_WILL_MOUNT = Symbol('APP_WILL_MOUNT');
/**
* The type of the actions which signals that a specific App will unmount (in
@@ -18,4 +20,4 @@ export const APP_WILL_MOUNT = 'APP_WILL_MOUNT';
* app: App
* }
*/
-export const APP_WILL_UNMOUNT = 'APP_WILL_UNMOUNT';
+export const APP_WILL_UNMOUNT = Symbol('APP_WILL_UNMOUNT');
diff --git a/react/features/base/conference/actionTypes.js b/react/features/base/conference/actionTypes.js
index 3b054ca905..a53bcf804e 100644
--- a/react/features/base/conference/actionTypes.js
+++ b/react/features/base/conference/actionTypes.js
@@ -1,3 +1,5 @@
+import { Symbol } from '../react';
+
/**
* Action type to signal that we are joining the conference.
*
@@ -8,7 +10,7 @@
* }
* }
*/
-export const CONFERENCE_JOINED = 'CONFERENCE_JOINED';
+export const CONFERENCE_JOINED = Symbol('CONFERENCE_JOINED');
/**
* Action type to signal that we have left the conference.
@@ -20,7 +22,7 @@ export const CONFERENCE_JOINED = 'CONFERENCE_JOINED';
* }
* }
*/
-export const CONFERENCE_LEFT = 'CONFERENCE_LEFT';
+export const CONFERENCE_LEFT = Symbol('CONFERENCE_LEFT');
/**
* Action type to signal that we will leave the specified conference.
@@ -32,7 +34,7 @@ export const CONFERENCE_LEFT = 'CONFERENCE_LEFT';
* }
* }
*/
-export const CONFERENCE_WILL_LEAVE = 'CONFERENCE_WILL_LEAVE';
+export const CONFERENCE_WILL_LEAVE = Symbol('CONFERENCE_WILL_LEAVE');
/**
* The type of the Redux action which sets the name of the room of the
@@ -43,4 +45,4 @@ export const CONFERENCE_WILL_LEAVE = 'CONFERENCE_WILL_LEAVE';
* room: string
* }
*/
-export const SET_ROOM = 'SET_ROOM';
+export const SET_ROOM = Symbol('SET_ROOM');
diff --git a/react/features/base/connection/actionTypes.js b/react/features/base/connection/actionTypes.js
index a6c5660403..5fb8e2e6bc 100644
--- a/react/features/base/connection/actionTypes.js
+++ b/react/features/base/connection/actionTypes.js
@@ -1,23 +1,19 @@
+import { Symbol } from '../react';
+
/**
* Action type to signal that connection has disconnected.
- *
- * @type {string}
*/
-export const CONNECTION_DISCONNECTED = 'CONNECTION_DISCONNECTED';
+export const CONNECTION_DISCONNECTED = Symbol('CONNECTION_DISCONNECTED');
/**
* Action type to signal that have successfully established a connection.
- *
- * @type {string}
*/
-export const CONNECTION_ESTABLISHED = 'CONNECTION_ESTABLISHED';
+export const CONNECTION_ESTABLISHED = Symbol('CONNECTION_ESTABLISHED');
/**
* Action type to signal a connection failed.
- *
- * @type {string}
*/
-export const CONNECTION_FAILED = 'CONNECTION_FAILED';
+export const CONNECTION_FAILED = Symbol('CONNECTION_FAILED');
/**
* Action to signal to change connection domain.
@@ -27,4 +23,4 @@ export const CONNECTION_FAILED = 'CONNECTION_FAILED';
* domain: string
* }
*/
-export const SET_DOMAIN = 'SET_DOMAIN';
+export const SET_DOMAIN = Symbol('SET_DOMAIN');
diff --git a/react/features/base/lib-jitsi-meet/actionTypes.js b/react/features/base/lib-jitsi-meet/actionTypes.js
index 8f1bd590d2..3993de2dcf 100644
--- a/react/features/base/lib-jitsi-meet/actionTypes.js
+++ b/react/features/base/lib-jitsi-meet/actionTypes.js
@@ -1,3 +1,5 @@
+import { Symbol } from '../react';
+
/**
* Action to signal that lib-jitsi-meet library was disposed.
*
@@ -5,7 +7,7 @@
* type: LIB_DISPOSED
* }
*/
-export const LIB_DISPOSED = 'LIB_DISPOSED';
+export const LIB_DISPOSED = Symbol('LIB_DISPOSED');
/**
* Action to signal that lib-jitsi-meet initialized failed with error.
@@ -15,7 +17,7 @@ export const LIB_DISPOSED = 'LIB_DISPOSED';
* error: Error
* }
*/
-export const LIB_INIT_ERROR = 'LIB_INIT_ERROR';
+export const LIB_INIT_ERROR = Symbol('LIB_INIT_ERROR');
/**
* Action to signal that lib-jitsi-meet initialization succeeded.
@@ -24,7 +26,7 @@ export const LIB_INIT_ERROR = 'LIB_INIT_ERROR';
* type: LIB_INITIALIZED
* }
*/
-export const LIB_INITIALIZED = 'LIB_INITIALIZED';
+export const LIB_INITIALIZED = Symbol('LIB_INITIALIZED');
/**
* Action to signal that config was set.
@@ -34,4 +36,4 @@ export const LIB_INITIALIZED = 'LIB_INITIALIZED';
* config: Object
* }
*/
-export const SET_CONFIG = 'SET_CONFIG';
+export const SET_CONFIG = Symbol('SET_CONFIG');
diff --git a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js
index eec9445afd..47b4b1e747 100644
--- a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js
+++ b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js
@@ -85,6 +85,9 @@ function _visitNode(node, callback) {
(global => {
+ // Polyfill for URL constructor
+ require('url-polyfill');
+
const DOMParser = require('xmldom').DOMParser;
// addEventListener
@@ -210,30 +213,6 @@ function _visitNode(node, callback) {
};
}
- // performance
- if (typeof global.performance === 'undefined') {
- global.performance = {
- now() {
- return 0;
- }
- };
- }
-
- // sessionStorage
- //
- // Required by:
- // - Strophe
- if (typeof global.sessionStorage === 'undefined') {
- global.sessionStorage = {
- /* eslint-disable no-empty-function */
- getItem() {},
- removeItem() {},
- setItem() {}
-
- /* eslint-enable no-empty-function */
- };
- }
-
const navigator = global.navigator;
if (navigator) {
@@ -280,6 +259,30 @@ function _visitNode(node, callback) {
})();
}
+ // performance
+ if (typeof global.performance === 'undefined') {
+ global.performance = {
+ now() {
+ return 0;
+ }
+ };
+ }
+
+ // sessionStorage
+ //
+ // Required by:
+ // - Strophe
+ if (typeof global.sessionStorage === 'undefined') {
+ global.sessionStorage = {
+ /* eslint-disable no-empty-function */
+ getItem() {},
+ removeItem() {},
+ setItem() {}
+
+ /* eslint-enable no-empty-function */
+ };
+ }
+
// WebRTC
require('./polyfills-webrtc');
@@ -310,7 +313,4 @@ function _visitNode(node, callback) {
}
}
- // Polyfill for URL constructor
- require('url-polyfill');
-
})(global || window || this); // eslint-disable-line no-invalid-this
diff --git a/react/features/base/media/actionTypes.js b/react/features/base/media/actionTypes.js
index fee4579d50..b45a17f3cf 100644
--- a/react/features/base/media/actionTypes.js
+++ b/react/features/base/media/actionTypes.js
@@ -1,3 +1,5 @@
+import { Symbol } from '../react';
+
/**
* Action to change muted state of the local audio.
*
@@ -6,7 +8,7 @@
* muted: boolean
* }
*/
-export const AUDIO_MUTED_CHANGED = 'AUDIO_MUTED_CHANGED';
+export const AUDIO_MUTED_CHANGED = Symbol('AUDIO_MUTED_CHANGED');
/**
* Action to signal a change of the facing mode of the local video camera.
@@ -16,7 +18,7 @@ export const AUDIO_MUTED_CHANGED = 'AUDIO_MUTED_CHANGED';
* cameraFacingMode: CAMERA_FACING_MODE
* }
*/
-export const CAMERA_FACING_MODE_CHANGED = 'CAMERA_FACING_MODE_CHANGED';
+export const CAMERA_FACING_MODE_CHANGED = Symbol('CAMERA_FACING_MODE_CHANGED');
/**
* Action to change muted state of the local video.
@@ -26,4 +28,4 @@ export const CAMERA_FACING_MODE_CHANGED = 'CAMERA_FACING_MODE_CHANGED';
* muted: boolean
* }
*/
-export const VIDEO_MUTED_CHANGED = 'VIDEO_MUTED_CHANGED';
+export const VIDEO_MUTED_CHANGED = Symbol('VIDEO_MUTED_CHANGED');
diff --git a/react/features/base/participants/actionTypes.js b/react/features/base/participants/actionTypes.js
index 327944bee6..746cdd6c64 100644
--- a/react/features/base/participants/actionTypes.js
+++ b/react/features/base/participants/actionTypes.js
@@ -1,3 +1,5 @@
+import { Symbol } from '../react';
+
/**
* Create an action for when dominant speaker changes.
*
@@ -8,7 +10,7 @@
* }
* }
*/
-export const DOMINANT_SPEAKER_CHANGED = 'DOMINANT_SPEAKER_CHANGED';
+export const DOMINANT_SPEAKER_CHANGED = Symbol('DOMINANT_SPEAKER_CHANGED');
/**
* Action to signal that ID of participant has changed. This happens when
@@ -20,7 +22,7 @@ export const DOMINANT_SPEAKER_CHANGED = 'DOMINANT_SPEAKER_CHANGED';
* oldValue: string
* }
*/
-export const PARTICIPANT_ID_CHANGED = 'PARTICIPANT_ID_CHANGED';
+export const PARTICIPANT_ID_CHANGED = Symbol('PARTICIPANT_ID_CHANGED');
/**
* Action to signal that a participant has joined.
@@ -30,7 +32,7 @@ export const PARTICIPANT_ID_CHANGED = 'PARTICIPANT_ID_CHANGED';
* participant: Participant
* }
*/
-export const PARTICIPANT_JOINED = 'PARTICIPANT_JOINED';
+export const PARTICIPANT_JOINED = Symbol('PARTICIPANT_JOINED');
/**
* Action to handle case when participant lefts.
@@ -42,7 +44,7 @@ export const PARTICIPANT_JOINED = 'PARTICIPANT_JOINED';
* }
* }
*/
-export const PARTICIPANT_LEFT = 'PARTICIPANT_LEFT';
+export const PARTICIPANT_LEFT = Symbol('PARTICIPANT_LEFT');
/**
* Action to handle case when info about participant changes.
@@ -52,7 +54,7 @@ export const PARTICIPANT_LEFT = 'PARTICIPANT_LEFT';
* participant: Participant
* }
*/
-export const PARTICIPANT_UPDATED = 'PARTICIPANT_UPDATED';
+export const PARTICIPANT_UPDATED = Symbol('PARTICIPANT_UPDATED');
/**
* The type of the Redux action which pins a conference participant.
@@ -64,4 +66,4 @@ export const PARTICIPANT_UPDATED = 'PARTICIPANT_UPDATED';
* }
* }
*/
-export const PIN_PARTICIPANT = 'PIN_PARTICIPANT';
+export const PIN_PARTICIPANT = Symbol('PIN_PARTICIPANT');
diff --git a/react/features/base/react/Symbol.js b/react/features/base/react/Symbol.js
new file mode 100644
index 0000000000..bd152fdd34
--- /dev/null
+++ b/react/features/base/react/Symbol.js
@@ -0,0 +1,14 @@
+// FIXME React Native does not polyfill Symbol at versions 0.39.2 or earlier.
+export default (global => {
+ let s = global.Symbol;
+
+ if (typeof s === 'undefined') {
+ // XXX At the time of this writing we use Symbol only as a way to
+ // prevent collisions in Redux action types. Consequently, the Symbol
+ // implementation provided bellow is minimal and specific to our
+ // purpose.
+ s = description => (description || '').split('');
+ }
+
+ return s;
+})(global || window || this); // eslint-disable-line no-invalid-this
diff --git a/react/features/base/react/components/Container.web.js b/react/features/base/react/components/Container.web.js
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/react/features/base/react/components/Link.web.js b/react/features/base/react/components/Link.web.js
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/react/features/base/react/index.js b/react/features/base/react/index.js
index 8b45add519..fd27aa0de2 100644
--- a/react/features/base/react/index.js
+++ b/react/features/base/react/index.js
@@ -1,2 +1,3 @@
export * from './components';
export * from './functions';
+export { default as Symbol } from './Symbol';
diff --git a/react/features/base/tracks/actionTypes.js b/react/features/base/tracks/actionTypes.js
index 88ca5aafdb..a51c90b633 100644
--- a/react/features/base/tracks/actionTypes.js
+++ b/react/features/base/tracks/actionTypes.js
@@ -1,3 +1,5 @@
+import { Symbol } from '../react';
+
/**
* Action for when a track has been added to the conference,
* local or remote.
@@ -7,7 +9,7 @@
* track: Track
* }
*/
-export const TRACK_ADDED = 'TRACK_ADDED';
+export const TRACK_ADDED = Symbol('TRACK_ADDED');
/**
* Action for when a track has been removed from the conference,
@@ -18,7 +20,7 @@ export const TRACK_ADDED = 'TRACK_ADDED';
* track: Track
* }
*/
-export const TRACK_REMOVED = 'TRACK_REMOVED';
+export const TRACK_REMOVED = Symbol('TRACK_REMOVED');
/**
* Action for when a track properties were updated.
@@ -28,4 +30,4 @@ export const TRACK_REMOVED = 'TRACK_REMOVED';
* track: Track
* }
*/
-export const TRACK_UPDATED = 'TRACK_UPDATED';
+export const TRACK_UPDATED = Symbol('TRACK_UPDATED');
diff --git a/react/features/conference/components/ParticipantView.web.js b/react/features/conference/components/ParticipantView.web.js
index e7d789ebc5..e69de29bb2 100644
--- a/react/features/conference/components/ParticipantView.web.js
+++ b/react/features/conference/components/ParticipantView.web.js
@@ -1,22 +0,0 @@
-import { Component } from 'react';
-
-/**
- * Implements a React Component which depicts a specific participant's avatar
- * and video.
- */
-export default class ParticipantView extends Component {
-
- /**
- * Implements React's {@link Component#render()}.
- *
- * @inheritdoc
- * @returns {ReactElement|null}
- */
- render() {
- // FIXME ParticipantView is supposed to be platform-independent.
- // Temporarily though, ParticipantView is not in use on Web but has to
- // exist in order to split App, Conference, and WelcomePage out of
- // index.html.
- return null;
- }
- }
diff --git a/react/features/largeVideo/actionTypes.js b/react/features/largeVideo/actionTypes.js
index 48250d1cc8..613c397837 100644
--- a/react/features/largeVideo/actionTypes.js
+++ b/react/features/largeVideo/actionTypes.js
@@ -1,3 +1,5 @@
+import { Symbol } from '../base/react';
+
/**
* Action to change the participant to be displayed in LargeVideo.
*
@@ -7,4 +9,4 @@
* }
*/
export const LARGE_VIDEO_PARTICIPANT_CHANGED
- = 'LARGE_VIDEO_PARTICIPANT_CHANGED';
+ = Symbol('LARGE_VIDEO_PARTICIPANT_CHANGED');