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

Convert reducer to TS
This commit is contained in:
Robert Pintilii 2022-09-01 11:32:01 +03:00 committed by GitHub
parent 575ab1f1cb
commit cfda02ee10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 39 deletions

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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
}

View File

@ -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;
}
});

View File

@ -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: