Skip to content

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

ref(shared-video) Merge web and native reducers (#12108)

Robert Pintiliicfda02ee1079
diff --git a/react/features/app/reducers.any.js b/react/features/app/reducers.any.js
index 30098e0221..08c092e377 100644
--- a/react/features/app/reducers.any.js
+++ b/react/features/app/reducers.any.js
@@ -48,6 +48,7 @@ import '../recent-list/reducer';
import '../recording/reducer';
import '../settings/reducer';
import '../speaker-stats/reducer';
+import '../shared-video/reducer';
import '../subtitles/reducer';
import '../screen-share/reducer';
import '../toolbox/reducer';
diff --git a/react/features/app/reducers.native.js b/react/features/app/reducers.native.js
index 82ecc1d8e0..9cb7e98163 100644
--- a/react/features/app/reducers.native.js
+++ b/react/features/app/reducers.native.js
@@ -6,7 +6,6 @@ import '../mobile/call-integration/reducer';
import '../mobile/external-api/reducer';
import '../mobile/full-screen/reducer';
import '../mobile/watchos/reducer';
-import '../shared-video/reducer';
import './reducer.native';
diff --git a/react/features/app/reducers.web.js b/react/features/app/reducers.web.js
index 85df62c777..7b9deec65e 100644
--- a/react/features/app/reducers.web.js
+++ b/react/features/app/reducers.web.js
@@ -13,7 +13,6 @@ import '../remote-control/reducer';
import '../screen-share/reducer';
import '../noise-suppression/reducer';
import '../screenshot-capture/reducer';
-import '../shared-video/reducer';
import '../talk-while-muted/reducer';
import '../virtual-background/reducer';
import './reducers.any';
diff --git a/react/features/app/types.ts b/react/features/app/types.ts
index 93cff24d45..cc1c17495e 100644
--- a/react/features/app/types.ts
+++ b/react/features/app/types.ts
@@ -54,6 +54,7 @@ import { IPollsState } from '../polls/reducer';
import { IPowerMonitorState } from '../power-monitor/reducer';
import { IPrejoinState } from '../prejoin/reducer';
import { IReactionsState } from '../reactions/reducer';
+import { ISharedVideoState } from '../shared-video/reducer';
export interface IStore {
dispatch: Function,
@@ -119,5 +120,6 @@ export interface IState {
'features/power-monitor': IPowerMonitorState,
'features/prejoin': IPrejoinState,
'features/reactions': IReactionsState,
+ 'features/shared-video': ISharedVideoState,
'features/testing': ITestingState
}
diff --git a/react/features/shared-video/reducer.native.js b/react/features/shared-video/reducer.native.js
deleted file mode 100644
index 8f8691d8b1..0000000000
--- a/react/features/shared-video/reducer.native.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// @flow
-
-import { ReducerRegistry } from '../base/redux';
-
-import { RESET_SHARED_VIDEO_STATUS, SET_SHARED_VIDEO_STATUS } from './actionTypes';
-
-const initialState = {};
-
-/**
- * Reduces the Redux actions of the feature features/shared-video.
- */
-ReducerRegistry.register('features/shared-video', (state = initialState, action) => {
- const { videoUrl, status, time, ownerId, muted, volume } = action;
-
- switch (action.type) {
- case RESET_SHARED_VIDEO_STATUS:
- return initialState;
- case SET_SHARED_VIDEO_STATUS:
- return {
- ...state,
- muted,
- ownerId,
- status,
- time,
- videoUrl,
- volume
- };
- default:
- return state;
- }
-});
diff --git a/react/features/shared-video/reducer.web.js b/react/features/shared-video/reducer.ts
similarity index 55%
rename from react/features/shared-video/reducer.web.js
rename to react/features/shared-video/reducer.ts
index b5c0f73ec4..1bec55f218 100644
--- a/react/features/shared-video/reducer.web.js
+++ b/react/features/shared-video/reducer.ts
@@ -1,16 +1,25 @@
-// @flow
-
-import { ReducerRegistry } from '../base/redux';
+import ReducerRegistry from '../base/redux/ReducerRegistry';
import { RESET_SHARED_VIDEO_STATUS, SET_SHARED_VIDEO_STATUS, SET_DISABLE_BUTTON } from './actionTypes';
const initialState = {};
+export interface ISharedVideoState {
+ disabled?: boolean;
+ muted?: boolean;
+ ownerId?: string;
+ status?: string;
+ time?: number;
+ videoUrl?: string;
+ volume?: number;
+}
+
/**
* Reduces the Redux actions of the feature features/shared-video.
*/
-ReducerRegistry.register('features/shared-video', (state = initialState, action) => {
- const { videoUrl, status, time, ownerId, disabled, muted } = action;
+ReducerRegistry.register('features/shared-video',
+(state: ISharedVideoState = initialState, action): ISharedVideoState => {
+ const { videoUrl, status, time, ownerId, disabled, muted, volume } = action;
switch (action.type) {
case RESET_SHARED_VIDEO_STATUS:
@@ -22,7 +31,8 @@ ReducerRegistry.register('features/shared-video', (state = initialState, action)
ownerId,
status,
time,
- videoUrl
+ videoUrl,
+ volume
};
case SET_DISABLE_BUTTON: