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: Improve reducers TS (#12123)

Robert Pintilii271ea8315b42
diff --git a/react/features/analytics/reducer.ts b/react/features/analytics/reducer.ts
index 185f06a06e..e77a26c50a 100644
--- a/react/features/analytics/reducer.ts
+++ b/react/features/analytics/reducer.ts
@@ -52,7 +52,8 @@ export interface IAnalyticsState {
* @param {string} action.type - Type of action.
* @returns {Object}
*/
-ReducerRegistry.register('features/analytics', (state: IAnalyticsState = DEFAULT_STATE, action: any) => {
+ReducerRegistry.register<IAnalyticsState>('features/analytics',
+(state = DEFAULT_STATE, action): IAnalyticsState => {
switch (action.type) {
case UPDATE_LOCAL_TRACKS_DURATION:
return {
diff --git a/react/features/app/types.ts b/react/features/app/types.ts
index e004fcdcf2..4ad499fc3a 100644
--- a/react/features/app/types.ts
+++ b/react/features/app/types.ts
@@ -4,12 +4,13 @@ import { IAVModerationState } from '../av-moderation/reducer';
import { IAppState } from '../base/app/reducer';
import { IAudioOnlyState } from '../base/audio-only/reducer';
import { IConferenceState } from '../base/conference/reducer';
-import { IConfig } from '../base/config/configType';
+import { IConfigState } from '../base/config/reducer';
import { IConnectionState } from '../base/connection/reducer';
import { IDevicesState } from '../base/devices/reducer';
import { IDialogState } from '../base/dialog/reducer';
import { IFlagsState } from '../base/flags/reducer';
import { IJwtState } from '../base/jwt/reducer';
+import { IKnownDomainsState } from '../base/known-domains/reducer';
import { ILastNState } from '../base/lastn/reducer';
import { ILibJitsiMeetState } from '../base/lib-jitsi-meet/reducer';
import { ILoggingState } from '../base/logging/reducer';
@@ -42,6 +43,7 @@ import { ILargeVideoState } from '../large-video/reducer';
import { ILobbyState } from '../lobby/reducer';
import { IMobileAudioModeState } from '../mobile/audio-mode/reducer';
import { IBackgroundState } from '../mobile/background/reducer';
+import { ICallIntegrationState } from '../mobile/call-integration/reducer';
import { IMobileExternalApiState } from '../mobile/external-api/reducer';
import { IFullScreenState } from '../mobile/full-screen/reducer';
import { IMobileWatchOSState } from '../mobile/watchos/reducer';
@@ -72,7 +74,7 @@ import { IVirtualBackground } from '../virtual-background/reducer';
export interface IStore {
dispatch: Function,
- getState: Function
+ getState: () => IState;
}
export interface IState {
@@ -83,13 +85,13 @@ export interface IState {
'features/base/app': IAppState,
'features/base/audio-only': IAudioOnlyState,
'features/base/conference': IConferenceState,
- 'features/base/config': IConfig,
+ 'features/base/config': IConfigState,
'features/base/connection': IConnectionState,
'features/base/devices': IDevicesState,
'features/base/dialog': IDialogState,
'features/base/flags': IFlagsState,
'features/base/jwt': IJwtState,
- 'features/base/known-domains': Array<string>,
+ 'features/base/known-domains': IKnownDomainsState,
'features/base/lastn': ILastNState,
'features/base/lib-jitsi-meet': ILibJitsiMeetState,
'features/base/logging': ILoggingState,
@@ -104,6 +106,7 @@ export interface IState {
'features/base/user-interaction': IUserInteractionState,
'features/breakout-rooms': IBreakoutRoomsState,
'features/calendar-sync': ICalendarSyncState,
+ 'features/call-integration': ICallIntegrationState,
'features/chat': IChatState,
'features/deep-linking': IDeepLinkingState,
'features/dropbox': IDropboxState,
diff --git a/react/features/authentication/reducer.ts b/react/features/authentication/reducer.ts
index c7c4c2c5e2..58e45ef51c 100644
--- a/react/features/authentication/reducer.ts
+++ b/react/features/authentication/reducer.ts
@@ -24,7 +24,8 @@ export interface IAuthenticationState {
* @param {string} action.type - Type of action.
* @returns {Object}
*/
-ReducerRegistry.register('features/authentication', (state: IAuthenticationState = {}, action: any) => {
+ReducerRegistry.register<IAuthenticationState>('features/authentication',
+(state = {}, action): IAuthenticationState => {
switch (action.type) {
case CANCEL_LOGIN:
return assign(state, {
diff --git a/react/features/av-moderation/reducer.ts b/react/features/av-moderation/reducer.ts
index d8c9b6207c..f5d573e7c8 100644
--- a/react/features/av-moderation/reducer.ts
+++ b/react/features/av-moderation/reducer.ts
@@ -73,8 +73,8 @@ function _updatePendingParticipant(mediaType: MediaType, participant: any, state
return false;
}
-ReducerRegistry.register('features/av-moderation', (state: IAVModerationState = initialState, action: any) => {
-
+ReducerRegistry.register<IAVModerationState>('features/av-moderation',
+(state = initialState, action): IAVModerationState => {
switch (action.type) {
case DISABLE_MODERATION: {
const newState = action.mediaType === MEDIA_TYPE.AUDIO
diff --git a/react/features/base/app/reducer.ts b/react/features/base/app/reducer.ts
index 0b656bc23b..baea437e01 100644
--- a/react/features/base/app/reducer.ts
+++ b/react/features/base/app/reducer.ts
@@ -6,7 +6,7 @@ export interface IAppState {
app?: Object|undefined;
}
-ReducerRegistry.register('features/base/app', (state: IAppState = {}, action) => {
+ReducerRegistry.register<IAppState>('features/base/app', (state = {}, action): IAppState => {
switch (action.type) {
case APP_WILL_MOUNT: {
const { app } = action;
diff --git a/react/features/base/audio-only/reducer.ts b/react/features/base/audio-only/reducer.ts
index f24dca3f5c..93d1351ea6 100644
--- a/react/features/base/audio-only/reducer.ts
+++ b/react/features/base/audio-only/reducer.ts
@@ -11,7 +11,8 @@ const DEFAULT_STATE = {
};
-ReducerRegistry.register('features/base/audio-only', (state: IAudioOnlyState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IAudioOnlyState>('features/base/audio-only',
+(state = DEFAULT_STATE, action): IAudioOnlyState => {
switch (action.type) {
case SET_AUDIO_ONLY:
return {
diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.ts
index 091da229e7..3d113f315d 100644
--- a/react/features/base/conference/reducer.ts
+++ b/react/features/base/conference/reducer.ts
@@ -1,15 +1,10 @@
-/* eslint-disable import/order */
-// @ts-ignore
-import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../room-lock';
-
-// @ts-ignore
-import { CONNECTION_WILL_CONNECT, SET_LOCATION_URL } from '../connection';
-
+/* eslint-disable lines-around-comment */
+import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../room-lock/constants';
+import { CONNECTION_WILL_CONNECT, SET_LOCATION_URL } from '../connection/actionTypes';
// @ts-ignore
import { JitsiConferenceErrors } from '../lib-jitsi-meet';
-
-import { assign, set } from '../redux/functions';
import ReducerRegistry from '../redux/ReducerRegistry';
+import { assign, set } from '../redux/functions';
import {
AUTH_STATUS_CHANGED,
@@ -31,7 +26,6 @@ import {
SET_START_MUTED_POLICY,
SET_START_REACTIONS_MUTED
} from './actionTypes';
-
// @ts-ignore
import { isRoomValid } from './functions';
@@ -59,11 +53,15 @@ export interface IConferenceState {
localSubject?: string;
locked: string|undefined;
membersOnly: boolean|undefined;
+ obfuscatedRoom?: string;
+ obfuscatedRoomSource?: string;
password: string|undefined;
passwordRequired: boolean|undefined;
pendingSubjectChange?: string;
room?: Object;
+ startAudioMutedPolicy?: boolean;
startReactionsMuted?: boolean;
+ startVideoMutedPolicy?: boolean;
subject?: string;
}
@@ -71,9 +69,8 @@ export interface IConferenceState {
* Listen for actions that contain the conference object, so that it can be
* stored for use by other action creators.
*/
-ReducerRegistry.register(
- 'features/base/conference',
- (state: IConferenceState = DEFAULT_STATE, action: any) => {
+ReducerRegistry.register<IConferenceState>('features/base/conference',
+ (state = DEFAULT_STATE, action): IConferenceState => {
switch (action.type) {
case AUTH_STATUS_CHANGED:
return _authStatusChanged(state, action);
diff --git a/react/features/base/config/reducer.ts b/react/features/base/config/reducer.ts
index 87969d2fba..55b15ac097 100644
--- a/react/features/base/config/reducer.ts
+++ b/react/features/base/config/reducer.ts
@@ -1,10 +1,8 @@
-/* eslint-disable import/order */
import _ from 'lodash';
import { CONFERENCE_INFO } from '../../conference/components/constants';
-
-import { equals } from '../redux/functions';
import ReducerRegistry from '../redux/ReducerRegistry';
+import { equals } from '../redux/functions';
import {
UPDATE_CONFIG,
@@ -14,7 +12,7 @@ import {
OVERWRITE_CONFIG
} from './actionTypes';
import { IConfig } from './configType';
-
+// eslint-disable-next-line lines-around-comment
// @ts-ignore
import { _cleanupConfig } from './functions';
@@ -72,7 +70,11 @@ const CONFERENCE_HEADER_MAPPING: any = {
hideRecordingLabel: [ 'recording' ]
};
-ReducerRegistry.register('features/base/config', (state: IConfig = _getInitialState(), action: any) => {
+export interface IConfigState extends IConfig {
+ error?: Error;
+}
+
+ReducerRegistry.register<IConfigState>('features/base/config', (state = _getInitialState(), action): IConfigState => {
switch (action.type) {
case UPDATE_CONFIG:
return _updateConfig(state, action);
diff --git a/react/features/base/connection/reducer.ts b/react/features/base/connection/reducer.ts
index 84a47fdd9c..8e207e2349 100644
--- a/react/features/base/connection/reducer.ts
+++ b/react/features/base/connection/reducer.ts
@@ -1,11 +1,9 @@
-/* eslint-disable import/order */
-
+/* eslint-disable lines-around-comment */
import { SET_ROOM } from '../conference/actionTypes';
-
// @ts-ignore
import { JitsiConnectionErrors } from '../lib-jitsi-meet';
-import { assign, set } from '../redux/functions';
import ReducerRegistry from '../redux/ReducerRegistry';
+import { assign, set } from '../redux/functions';
import {
CONNECTION_DISCONNECTED,
@@ -15,7 +13,6 @@ import {
SET_LOCATION_URL,
SHOW_CONNECTION_INFO
} from './actionTypes';
-
// @ts-ignore
import { ConnectionFailedError } from './actions.native';
@@ -32,9 +29,9 @@ export interface IConnectionState {
/**
* Reduces the Redux actions of the feature base/connection.
*/
-ReducerRegistry.register(
+ReducerRegistry.register<IConnectionState>(
'features/base/connection',
- (state: IConnectionState = {}, action: any) => {
+ (state = {}, action): IConnectionState => {
switch (action.type) {
case CONNECTION_DISCONNECTED:
return _connectionDisconnected(state, action);
diff --git a/react/features/base/devices/logger.js b/react/features/base/devices/logger.ts
similarity index 91%
rename from react/features/base/devices/logger.js
rename to react/features/base/devices/logger.ts
index 8a99c13de3..1a2cc0a34d 100644
--- a/react/features/base/devices/logger.js
+++ b/react/features/base/devices/logger.ts
@@ -1,5 +1,3 @@
-// @flow
-
import { getLogger } from '../logging/functions';
export default getLogger('features/base/devices');
diff --git a/react/features/base/devices/reducer.ts b/react/features/base/devices/reducer.ts
index ab5bd5c0f1..7737c2718b 100644
--- a/react/features/base/devices/reducer.ts
+++ b/react/features/base/devices/reducer.ts
@@ -1,4 +1,3 @@
-/* eslint-disable import/order */
import ReducerRegistry from '../redux/ReducerRegistry';
import {
@@ -9,11 +8,9 @@ import {
SET_VIDEO_INPUT_DEVICE,
UPDATE_DEVICE_LIST
} from './actionTypes';
-
+// eslint-disable-next-line lines-around-comment
// @ts-ignore
import { groupDevicesByKind } from './functions';
-
-// @ts-ignore
import logger from './logger';
@@ -53,9 +50,9 @@ export interface IDevicesState {
* video devices.
* @returns {Object}
*/
-ReducerRegistry.register(
+ReducerRegistry.register<IDevicesState>(
'features/base/devices',
- (state: IDevicesState = DEFAULT_STATE, action) => {
+ (state = DEFAULT_STATE, action): IDevicesState => {
switch (action.type) {
case UPDATE_DEVICE_LIST: {
const deviceList = groupDevicesByKind(action.devices);
diff --git a/react/features/base/dialog/reducer.ts b/react/features/base/dialog/reducer.ts
index 75897d5e0b..92cf32a9b8 100644
--- a/react/features/base/dialog/reducer.ts
+++ b/react/features/base/dialog/reducer.ts
@@ -24,7 +24,7 @@ export interface IDialogState {
* @returns {State} The next redux state that is the result of reducing the
* specified action.
*/
-ReducerRegistry.register('features/base/dialog', (state: IDialogState = {}, action) => {
+ReducerRegistry.register<IDialogState>('features/base/dialog', (state = {}, action): IDialogState => {
switch (action.type) {
case HIDE_DIALOG: {
const { component } = action;
diff --git a/react/features/base/flags/reducer.ts b/react/features/base/flags/reducer.ts
index c683dd827b..3bb10f4167 100644
--- a/react/features/base/flags/reducer.ts
+++ b/react/features/base/flags/reducer.ts
@@ -22,7 +22,7 @@ export interface IFlagsState {
* @returns {State} The next redux state that is the result of reducing the
* specified action.
*/
-ReducerRegistry.register('features/base/flags', (state: IFlagsState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IFlagsState>('features/base/flags', (state = DEFAULT_STATE, action): IFlagsState => {
switch (action.type) {
case UPDATE_FLAGS: {
const newState = _.merge({}, state, action.flags);
diff --git a/react/features/base/jwt/reducer.ts b/react/features/base/jwt/reducer.ts
index 3d1eb2a427..ad48db98ab 100644
--- a/react/features/base/jwt/reducer.ts
+++ b/react/features/base/jwt/reducer.ts
@@ -16,9 +16,9 @@ export interface IJwtState {
* @returns {Object} The next redux state which is the result of reducing the
* specified {@code action}.
*/
-ReducerRegistry.register(
+ReducerRegistry.register<IJwtState>(
'features/base/jwt',
- (state: IJwtState = {}, action) => {
+ (state = {}, action): IJwtState => {
switch (action.type) {
case SET_JWT: {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
diff --git a/react/features/base/known-domains/reducer.ts b/react/features/base/known-domains/reducer.ts
index cdc2dd17fc..23caec95fd 100644
--- a/react/features/base/known-domains/reducer.ts
+++ b/react/features/base/known-domains/reducer.ts
@@ -24,7 +24,9 @@ const STORE_NAME = 'features/base/known-domains';
PersistenceRegistry.register(STORE_NAME);
-ReducerRegistry.register(STORE_NAME, (state: Array<string> = DEFAULT_STATE, action) => {
+export type IKnownDomainsState = Array<string>;
+
+ReducerRegistry.register<IKnownDomainsState>(STORE_NAME, (state = DEFAULT_STATE, action): IKnownDomainsState => {
switch (action.type) {
case ADD_KNOWN_DOMAINS:
return _addKnownDomains(state, action.knownDomains);
@@ -43,7 +45,7 @@ ReducerRegistry.register(STORE_NAME, (state: Array<string> = DEFAULT_STATE, acti
* @private
* @returns {Object} The next redux state.
*/
-function _addKnownDomains(state: Array<string>, knownDomains: Array<string>) {
+function _addKnownDomains(state: IKnownDomainsState, knownDomains: Array<string>) {
// In case persistence has deserialized a weird redux state:
let nextState = Array.isArray(state) ? state : [];
diff --git a/react/features/base/lastn/reducer.ts b/react/features/base/lastn/reducer.ts
index 28ccdeb7c2..f39d55389b 100644
--- a/react/features/base/lastn/reducer.ts
+++ b/react/features/base/lastn/reducer.ts
@@ -17,7 +17,7 @@ export interface ILastNState {
};
}
-ReducerRegistry.register('features/base/lastn', (state: ILastNState = { }, action) => {
+ReducerRegistry.register<ILastNState>('features/base/lastn', (state = {}, action): ILastNState => {
switch (action.type) {
case SET_CONFIG:
return _setConfig(state, action);
diff --git a/react/features/base/lib-jitsi-meet/reducer.ts b/react/features/base/lib-jitsi-meet/reducer.ts
index a9645d8e7c..cc0ea93423 100644
--- a/react/features/base/lib-jitsi-meet/reducer.ts
+++ b/react/features/base/lib-jitsi-meet/reducer.ts
@@ -18,9 +18,9 @@ export interface ILibJitsiMeetState {
initialized?: boolean;
}
-ReducerRegistry.register(
+ReducerRegistry.register<ILibJitsiMeetState>(
'features/base/lib-jitsi-meet',
- (state: ILibJitsiMeetState = DEFAULT_STATE, action) => {
+ (state = DEFAULT_STATE, action): ILibJitsiMeetState => {
switch (action.type) {
case LIB_DID_DISPOSE:
return DEFAULT_STATE;
diff --git a/react/features/base/logging/reducer.ts b/react/features/base/logging/reducer.ts
index 060c1ebda4..acb89e5e05 100644
--- a/react/features/base/logging/reducer.ts
+++ b/react/features/base/logging/reducer.ts
@@ -65,9 +65,9 @@ export interface ILoggingState {
logCollector?: Object;
}
-ReducerRegistry.register(
+ReducerRegistry.register<ILoggingState>(
'features/base/logging',
- (state: ILoggingState = DEFAULT_STATE, action) => {
+ (state = DEFAULT_STATE, action): ILoggingState => {
switch (action.type) {
case SET_LOGGING_CONFIG:
return _setLoggingConfig(state, action);
diff --git a/react/features/base/media/reducer.ts b/react/features/base/media/reducer.ts
index 65951f7177..5a11373c09 100644
--- a/react/features/base/media/reducer.ts
+++ b/react/features/base/media/reducer.ts
@@ -252,7 +252,7 @@ export interface IMediaState {
* modified.
* @returns {Object}
*/
-ReducerRegistry.register('features/base/media', combineReducers({
+ReducerRegistry.register<IMediaState>('features/base/media', combineReducers({
audio: _audio,
screenshare: _screenshare,
video: _video
diff --git a/react/features/base/net-info/reducer.ts b/react/features/base/net-info/reducer.ts
index 0a78d4c674..72b7c409f1 100644
--- a/react/features/base/net-info/reducer.ts
+++ b/react/features/base/net-info/reducer.ts
@@ -21,7 +21,7 @@ export interface INetInfoState {
/**
* The base/net-info feature's reducer.
*/
-ReducerRegistry.register(STORE_NAME, (state: INetInfoState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<INetInfoState>(STORE_NAME, (state = DEFAULT_STATE, action): INetInfoState => {
switch (action.type) {
case SET_NETWORK_INFO:
return assign(state, {
diff --git a/react/features/base/participants/functions.ts b/react/features/base/participants/functions.ts
index 9a8729d6cd..40db0866db 100644
--- a/react/features/base/participants/functions.ts
+++ b/react/features/base/participants/functions.ts
@@ -256,7 +256,7 @@ export function getParticipantByIdOrUndefined(stateful: IStore | Function, parti
* features/base/participants.
* @returns {number}
*/
-export function getParticipantCount(stateful: IStore | Function) {
+export function getParticipantCount(stateful: IStore | Function | IState) {
const state = toState(stateful);
const {
local,
diff --git a/react/features/base/participants/reducer.ts b/react/features/base/participants/reducer.ts
index 2064da6e2f..51453a3049 100644
--- a/react/features/base/participants/reducer.ts
+++ b/react/features/base/participants/reducer.ts
@@ -140,7 +140,8 @@ export interface IParticipantsState {
* added/removed/modified.
* @returns {Participant[]}
*/
-ReducerRegistry.register('features/base/participants', (state: IParticipantsState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IParticipantsState>('features/base/participants',
+(state = DEFAULT_STATE, action): IParticipantsState => {
switch (action.type) {
case PARTICIPANT_ID_CHANGED: {
const { local } = state;
diff --git a/react/features/base/redux/ReducerRegistry.ts b/react/features/base/redux/ReducerRegistry.ts
index 08fa08b3a4..900b212cec 100644
--- a/react/features/base/redux/ReducerRegistry.ts
+++ b/react/features/base/redux/ReducerRegistry.ts
@@ -52,7 +52,7 @@ class ReducerRegistry {
* @param {Reducer} reducer - A Redux reducer.
* @returns {void}
*/
- register(name: string, reducer: Reducer<any, any>) {
+ register<S>(name: string, reducer: Reducer<S, any>) {
this._elements[name] = reducer;
}
}
diff --git a/react/features/base/responsive-ui/reducer.ts b/react/features/base/responsive-ui/reducer.ts
index 92649082d3..4433b83fce 100644
--- a/react/features/base/responsive-ui/reducer.ts
+++ b/react/features/base/responsive-ui/reducer.ts
@@ -40,7 +40,8 @@ export interface IResponsiveUIState {
}
}
-ReducerRegistry.register('features/base/responsive-ui', (state: IResponsiveUIState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IResponsiveUIState>('features/base/responsive-ui',
+(state = DEFAULT_STATE, action): IResponsiveUIState => {
switch (action.type) {
case CLIENT_RESIZED: {
return {
diff --git a/react/features/base/settings/reducer.ts b/react/features/base/settings/reducer.ts
index 43e8c4775e..1df001f3dd 100644
--- a/react/features/base/settings/reducer.ts
+++ b/react/features/base/settings/reducer.ts
@@ -108,7 +108,7 @@ filterSubtree.micDeviceId = false;
PersistenceRegistry.register(STORE_NAME, filterSubtree, DEFAULT_STATE);
-ReducerRegistry.register(STORE_NAME, (state: ISettingsState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<ISettingsState>(STORE_NAME, (state = DEFAULT_STATE, action): ISettingsState => {
switch (action.type) {
case APP_WILL_MOUNT:
return _initSettings(state);
diff --git a/react/features/base/sounds/reducer.ts b/react/features/base/sounds/reducer.ts
index f1968f54de..ffd452d322 100644
--- a/react/features/base/sounds/reducer.ts
+++ b/react/features/base/sounds/reducer.ts
@@ -51,9 +51,9 @@ export type ISoundsState = Map<string, Sound>;
/**
* The base/sounds feature's reducer.
*/
-ReducerRegistry.register(
+ReducerRegistry.register<ISoundsState>(
'features/base/sounds',
- (state: ISoundsState = DEFAULT_STATE, action) => {
+ (state = DEFAULT_STATE, action): ISoundsState => {
switch (action.type) {
case _ADD_AUDIO_ELEMENT:
case _REMOVE_AUDIO_ELEMENT:
diff --git a/react/features/base/testing/reducer.ts b/react/features/base/testing/reducer.ts
index 38bf06860b..eb7ac3e643 100644
--- a/react/features/base/testing/reducer.ts
+++ b/react/features/base/testing/reducer.ts
@@ -18,9 +18,9 @@ export interface ITestingState {
connectionState: string;
}
-ReducerRegistry.register(
+ReducerRegistry.register<ITestingState>(
'features/testing',
- (state: ITestingState = INITIAL_STATE, action) => {
+ (state = INITIAL_STATE, action): ITestingState => {
switch (action.type) {
case SET_CONNECTION_STATE:
return _setConnectionState(state, action);
diff --git a/react/features/base/tracks/reducer.ts b/react/features/base/tracks/reducer.ts
index 6a38a14ab6..81a203e48f 100644
--- a/react/features/base/tracks/reducer.ts
+++ b/react/features/base/tracks/reducer.ts
@@ -136,7 +136,7 @@ export type ITracksState = ITrack[];
/**
* Listen for actions that mutate (e.g. Add, remove) local and remote tracks.
*/
-ReducerRegistry.register('features/base/tracks', (state: ITracksState = [], action) => {
+ReducerRegistry.register<ITracksState>('features/base/tracks', (state = [], action): ITracksState => {
switch (action.type) {
case PARTICIPANT_ID_CHANGED:
case TRACK_NO_DATA_FROM_SOURCE:
@@ -179,7 +179,7 @@ export interface INoSrcDataState {
/**
* Listen for actions that mutate the no-src-data state, like the current notification id.
*/
-ReducerRegistry.register('features/base/no-src-data', (state: INoSrcDataState = {}, action) => {
+ReducerRegistry.register<INoSrcDataState>('features/base/no-src-data', (state = {}, action): INoSrcDataState => {
switch (action.type) {
case SET_NO_SRC_DATA_NOTIFICATION_UID:
return set(state, 'noSrcDataNotificationUid', action.uid);
diff --git a/react/features/base/user-interaction/reducer.ts b/react/features/base/user-interaction/reducer.ts
index 54c8f28f61..bf0bcca26f 100644
--- a/react/features/base/user-interaction/reducer.ts
+++ b/react/features/base/user-interaction/reducer.ts
@@ -8,7 +8,8 @@ export interface IUserInteractionState {
}
-ReducerRegistry.register('features/base/user-interaction', (state: IUserInteractionState = {}, action) => {
+ReducerRegistry.register<IUserInteractionState>('features/base/user-interaction',
+(state = {}, action): IUserInteractionState => {
switch (action.type) {
case APP_WILL_MOUNT:
case APP_WILL_UNMOUNT:
diff --git a/react/features/breakout-rooms/reducer.ts b/react/features/breakout-rooms/reducer.ts
index f08cab01c2..c2308dd28a 100644
--- a/react/features/breakout-rooms/reducer.ts
+++ b/react/features/breakout-rooms/reducer.ts
@@ -34,7 +34,7 @@ export interface IBreakoutRoomsState {
/**
* Listen for actions for the breakout-rooms feature.
*/
-ReducerRegistry.register(FEATURE_KEY, (state: IBreakoutRoomsState = DEFAULT_STATE, action: any) => {
+ReducerRegistry.register<IBreakoutRoomsState>(FEATURE_KEY, (state = DEFAULT_STATE, action): IBreakoutRoomsState => {
switch (action.type) {
case _UPDATE_ROOM_COUNTER:
return {
diff --git a/react/features/calendar-sync/reducer.tsx b/react/features/calendar-sync/reducer.tsx
index dfbf4b1749..73ed217ad7 100644
--- a/react/features/calendar-sync/reducer.tsx
+++ b/react/features/calendar-sync/reducer.tsx
@@ -58,7 +58,7 @@ PersistenceRegistry.register(STORE_NAME, {
msAuthState: true
});
-ReducerRegistry.register(STORE_NAME, (state: ICalendarSyncState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<ICalendarSyncState>(STORE_NAME, (state = DEFAULT_STATE, action): ICalendarSyncState => {
switch (action.type) {
case CLEAR_CALENDAR_INTEGRATION:
return DEFAULT_STATE;
diff --git a/react/features/chat/reducer.ts b/react/features/chat/reducer.ts
index 31fbf14d55..a6e3b2d21b 100644
--- a/react/features/chat/reducer.ts
+++ b/react/features/chat/reducer.ts
@@ -55,7 +55,7 @@ export interface IChatState {
privateMessageRecipient?: Participant;
}
-ReducerRegistry.register('features/chat', (state: IChatState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IChatState>('features/chat', (state = DEFAULT_STATE, action): IChatState => {
switch (action.type) {
case ADD_MESSAGE: {
const newMessage: IMessage = {
diff --git a/react/features/deep-linking/reducer.ts b/react/features/deep-linking/reducer.ts
index c44319cf01..b88ebac08a 100644
--- a/react/features/deep-linking/reducer.ts
+++ b/react/features/deep-linking/reducer.ts
@@ -6,7 +6,7 @@ export interface IDeepLinkingState {
launchInWeb?: boolean;
}
-ReducerRegistry.register('features/deep-linking', (state = {}, action) => {
+ReducerRegistry.register<IDeepLinkingState>('features/deep-linking', (state = {}, action): IDeepLinkingState => {
switch (action.type) {
case OPEN_WEB_APP: {
return {
diff --git a/react/features/dropbox/reducer.ts b/react/features/dropbox/reducer.ts
index dcc504e3d0..2a5e020b0c 100644
--- a/react/features/dropbox/reducer.ts
+++ b/react/features/dropbox/reducer.ts
@@ -19,7 +19,7 @@ export interface IDropboxState {
*/
PersistenceRegistry.register(STORE_NAME);
-ReducerRegistry.register(STORE_NAME, (state: IDropboxState = {}, action) => {
+ReducerRegistry.register<IDropboxState>(STORE_NAME, (state = {}, action): IDropboxState => {
switch (action.type) {
case UPDATE_DROPBOX_TOKEN:
return {
diff --git a/react/features/dynamic-branding/reducer.ts b/react/features/dynamic-branding/reducer.ts
index 95a04b4995..894d09c56c 100644
--- a/react/features/dynamic-branding/reducer.ts
+++ b/react/features/dynamic-branding/reducer.ts
@@ -163,7 +163,7 @@ export interface IDynamicBrandingState {
/**
* Reduces redux actions for the purposes of the feature {@code dynamic-branding}.
*/
-ReducerRegistry.register(STORE_NAME, (state: IDynamicBrandingState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IDynamicBrandingState>(STORE_NAME, (state = DEFAULT_STATE, action): IDynamicBrandingState => {
switch (action.type) {
case SET_DYNAMIC_BRANDING_DATA: {
const {
diff --git a/react/features/e2ee/reducer.ts b/react/features/e2ee/reducer.ts
index d31377675e..7f193920f6 100644
--- a/react/features/e2ee/reducer.ts
+++ b/react/features/e2ee/reducer.ts
@@ -23,7 +23,7 @@ export interface IE2EEState {
/**
* Reduces the Redux actions of the feature features/e2ee.
*/
-ReducerRegistry.register('features/e2ee', (state: IE2EEState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IE2EEState>('features/e2ee', (state = DEFAULT_STATE, action): IE2EEState => {
switch (action.type) {
case TOGGLE_E2EE:
return {
diff --git a/react/features/etherpad/reducer.ts b/react/features/etherpad/reducer.ts
index 12406ee300..b1181adeef 100644
--- a/react/features/etherpad/reducer.ts
+++ b/react/features/etherpad/reducer.ts
@@ -26,9 +26,9 @@ export interface IEtherpadState {
/**
* Reduces the Redux actions of the feature features/etherpad.
*/
-ReducerRegistry.register(
+ReducerRegistry.register<IEtherpadState>(
'features/etherpad',
- (state: IEtherpadState = DEFAULT_STATE, action) => {
+ (state = DEFAULT_STATE, action): IEtherpadState => {
switch (action.type) {
case SET_DOCUMENT_EDITING_STATUS:
return {
diff --git a/react/features/face-landmarks/reducer.ts b/react/features/face-landmarks/reducer.ts
index d9c7ae2c2d..657377ab30 100644
--- a/react/features/face-landmarks/reducer.ts
+++ b/react/features/face-landmarks/reducer.ts
@@ -46,7 +46,8 @@ export interface IFaceLandmarksState {
recognitionActive: boolean;
}
-ReducerRegistry.register('features/face-landmarks', (state: IFaceLandmarksState = defaultState, action) => {
+ReducerRegistry.register<IFaceLandmarksState>('features/face-landmarks',
+(state = defaultState, action): IFaceLandmarksState => {
switch (action.type) {
case ADD_FACE_EXPRESSION: {
return {
diff --git a/react/features/feedback/reducer.ts b/react/features/feedback/reducer.ts
index cd674837ed..9eab8cc4f4 100644
--- a/react/features/feedback/reducer.ts
+++ b/react/features/feedback/reducer.ts
@@ -24,9 +24,9 @@ export interface IFeedbackState {
/**
* Reduces the Redux actions of the feature features/feedback.
*/
-ReducerRegistry.register(
+ReducerRegistry.register<IFeedbackState>(
'features/feedback',
- (state: IFeedbackState = DEFAULT_STATE, action) => {
+ (state = DEFAULT_STATE, action): IFeedbackState => {
switch (action.type) {
case CANCEL_FEEDBACK: {
return {
diff --git a/react/features/filmstrip/reducer.ts b/react/features/filmstrip/reducer.ts
index 0bcf689be2..5faa88832b 100644
--- a/react/features/filmstrip/reducer.ts
+++ b/react/features/filmstrip/reducer.ts
@@ -258,9 +258,9 @@ export interface IFilmstripState {
}
}
-ReducerRegistry.register(
+ReducerRegistry.register<IFilmstripState>(
'features/filmstrip',
- (state: IFilmstripState = DEFAULT_STATE, action) => {
+ (state = DEFAULT_STATE, action): IFilmstripState => {
switch (action.type) {
case SET_FILMSTRIP_ENABLED:
return {
diff --git a/react/features/follow-me/reducer.ts b/react/features/follow-me/reducer.ts
index aa9e84211e..82c83f3dfb 100644
--- a/react/features/follow-me/reducer.ts
+++ b/react/features/follow-me/reducer.ts
@@ -16,9 +16,9 @@ export interface IFollowMeState {
/**
* Listen for actions that contain the Follow Me feature active state, so that it can be stored.
*/
-ReducerRegistry.register(
+ReducerRegistry.register<IFollowMeState>(
'features/follow-me',
- (state: IFollowMeState = {}, action) => {
+ (state = {}, action): IFollowMeState => {
switch (action.type) {
case SET_FOLLOW_ME_MODERATOR: {
diff --git a/react/features/gifs/reducer.ts b/react/features/gifs/reducer.ts
index 5dcaa0453b..5e94effff7 100644
--- a/react/features/gifs/reducer.ts
+++ b/react/features/gifs/reducer.ts
@@ -23,9 +23,9 @@ export interface IGifsState {
menuOpen: boolean;
}
-ReducerRegistry.register(
+ReducerRegistry.register<IGifsState>(
'features/gifs',
- (state = initialState, action) => {
+ (state = initialState, action): IGifsState => {
switch (action.type) {
case ADD_GIF_FOR_PARTICIPANT: {
const newList = state.gifList;
@@ -55,7 +55,7 @@ ReducerRegistry.register(
const gif = state.gifList.get(action.participantId);
newList.set(action.participantId, {
- gifUrl: gif.gifUrl,
+ gifUrl: gif?.gifUrl ?? '',
timeoutID: action.timeoutID
});
diff --git a/react/features/google-api/reducer.ts b/react/features/google-api/reducer.ts
index 53a023659a..0bdca234a8 100644
--- a/react/features/google-api/reducer.ts
+++ b/react/features/google-api/reducer.ts
@@ -25,8 +25,8 @@ export interface IGoogleApiState {
/**
* Reduces the Redux actions of the feature features/google-api.
*/
-ReducerRegistry.register('features/google-api',
- (state: IGoogleApiState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IGoogleApiState>('features/google-api',
+ (state = DEFAULT_STATE, action): IGoogleApiState => {
switch (action.type) {
case SET_GOOGLE_API_STATE:
return {
diff --git a/react/features/invite/reducer.ts b/react/features/invite/reducer.ts
index 2efc4080e4..3bd929c6c0 100644
--- a/react/features/invite/reducer.ts
+++ b/react/features/invite/reducer.ts
@@ -37,7 +37,7 @@ export interface IInviteState {
sipUri?: string;
}
-ReducerRegistry.register('features/invite', (state: IInviteState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IInviteState>('features/invite', (state = DEFAULT_STATE, action): IInviteState => {
switch (action.type) {
case ADD_PENDING_INVITE_REQUEST:
return {
diff --git a/react/features/jaas/reducer.ts b/react/features/jaas/reducer.ts
index af82206b8f..486aee20bc 100644
--- a/react/features/jaas/reducer.ts
+++ b/react/features/jaas/reducer.ts
@@ -17,8 +17,8 @@ export interface IJaaSState {
/**
* Listen for actions that mutate the billing-counter state.
*/
-ReducerRegistry.register(
- 'features/jaas', (state: IJaaSState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IJaaSState>(
+ 'features/jaas', (state = DEFAULT_STATE, action): IJaaSState => {
switch (action.type) {
case SET_DETAILS: {
diff --git a/react/features/large-video/reducer.ts b/react/features/large-video/reducer.ts
index 811d820104..c70635d820 100644
--- a/react/features/large-video/reducer.ts
+++ b/react/features/large-video/reducer.ts
@@ -10,13 +10,15 @@ import {
} from './actionTypes';
export interface ILargeVideoState {
+ height?: number;
lastMediaEvent?: string;
participantId?: string;
resolution?: number;
seeWhatIsBeingShared?: boolean;
+ width?: number;
}
-ReducerRegistry.register('features/large-video', (state: ILargeVideoState = {}, action) => {
+ReducerRegistry.register<ILargeVideoState>('features/large-video', (state = {}, action): ILargeVideoState => {
switch (action.type) {
// When conference is joined, we update ID of local participant from default
diff --git a/react/features/lobby/reducer.ts b/react/features/lobby/reducer.ts
index ac4fad5211..b9af2974dd 100644
--- a/react/features/lobby/reducer.ts
+++ b/react/features/lobby/reducer.ts
@@ -42,7 +42,7 @@ export interface ILobbyState {
* @returns {Object} The next redux state which is the result of reducing the
* specified {@code action}.
*/
-ReducerRegistry.register('features/lobby', (state: ILobbyState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<ILobbyState>('features/lobby', (state = DEFAULT_STATE, action): ILobbyState => {
switch (action.type) {
case CONFERENCE_JOINED:
case CONFERENCE_LEFT:
diff --git a/react/features/mobile/audio-mode/reducer.ts b/react/features/mobile/audio-mode/reducer.ts
index a8245f18de..36998bfb0a 100644
--- a/react/features/mobile/audio-mode/reducer.ts
+++ b/react/features/mobile/audio-mode/reducer.ts
@@ -13,7 +13,8 @@ const DEFAULT_STATE = {
subscriptions: []
};
-ReducerRegistry.register('features/mobile/audio-mode', (state: IMobileAudioModeState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IMobileAudioModeState>('features/mobile/audio-mode',
+(state = DEFAULT_STATE, action): IMobileAudioModeState => {
switch (action.type) {
case _SET_AUDIOMODE_DEVICES: {
const { devices } = action;
diff --git a/react/features/mobile/background/reducer.ts b/react/features/mobile/background/reducer.ts
index 380cb927d8..684de06476 100644
--- a/react/features/mobile/background/reducer.ts
+++ b/react/features/mobile/background/reducer.ts
@@ -17,7 +17,7 @@ const DEFAULT_STATE = {
appState: 'active'
};
-ReducerRegistry.register('features/background', (state: IBackgroundState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IBackgroundState>('features/background', (state = DEFAULT_STATE, action): IBackgroundState => {
switch (action.type) {
case _SET_APP_STATE_LISTENER:
return {
diff --git a/react/features/mobile/call-integration/reducer.js b/react/features/mobile/call-integration/reducer.js
deleted file mode 100644
index 5a87e3c1af..0000000000
--- a/react/features/mobile/call-integration/reducer.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import { assign, ReducerRegistry } from '../../base/redux';
-
-import CallKit from './CallKit';
-import ConnectionService from './ConnectionService';
-import { _SET_CALL_INTEGRATION_SUBSCRIPTIONS } from './actionTypes';
-
-(CallKit || ConnectionService) && ReducerRegistry.register(
- 'features/call-integration',
- (state = {}, action) => {
- switch (action.type) {
- case _SET_CALL_INTEGRATION_SUBSCRIPTIONS:
- return assign(state, 'subscriptions', action.subscriptions);
- }
-
- return state;
- });
diff --git a/react/features/mobile/call-integration/reducer.ts b/react/features/mobile/call-integration/reducer.ts
new file mode 100644
index 0000000000..b8c87a82e3
--- /dev/null
+++ b/react/features/mobile/call-integration/reducer.ts
@@ -0,0 +1,24 @@
+/* eslint-disable lines-around-comment */
+import ReducerRegistry from '../../base/redux/ReducerRegistry';
+import { set } from '../../base/redux/functions';
+
+// @ts-ignore
+import CallKit from './CallKit';
+// @ts-ignore
+import ConnectionService from './ConnectionService';
+import { _SET_CALL_INTEGRATION_SUBSCRIPTIONS } from './actionTypes';
+
+export interface ICallIntegrationState {
+ subscriptions?: any;
+}
+
+(CallKit || ConnectionService) && ReducerRegistry.register<ICallIntegrationState>(
+ 'features/call-integration',
+ (state = {}, action): ICallIntegrationState => {
+ switch (action.type) {
+ case _SET_CALL_INTEGRATION_SUBSCRIPTIONS:
+ return set(state, 'subscriptions', action.subscriptions);
+ }
+
+ return state;
+ });
diff --git a/react/features/mobile/external-api/reducer.ts b/react/features/mobile/external-api/reducer.ts
index 374eb69a86..11e1e774c8 100644
--- a/react/features/mobile/external-api/reducer.ts
+++ b/react/features/mobile/external-api/reducer.ts
@@ -10,7 +10,8 @@ const DEFAULT_STATE = {
screenShares: []
};
-ReducerRegistry.register('features/mobile/external-api', (state: IMobileExternalApiState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IMobileExternalApiState>('features/mobile/external-api',
+(state = DEFAULT_STATE, action): IMobileExternalApiState => {
switch (action.type) {
case SCREEN_SHARE_PARTICIPANTS_UPDATED: {
return {
diff --git a/react/features/mobile/full-screen/reducer.ts b/react/features/mobile/full-screen/reducer.ts
index 8ea9492647..d86eb0ad8b 100644
--- a/react/features/mobile/full-screen/reducer.ts
+++ b/react/features/mobile/full-screen/reducer.ts
@@ -6,7 +6,7 @@ export interface IFullScreenState {
listener?: Function;
}
-ReducerRegistry.register('features/full-screen', (state: IFullScreenState = {}, action) => {
+ReducerRegistry.register<IFullScreenState>('features/full-screen', (state = {}, action): IFullScreenState => {
switch (action.type) {
case _SET_IMMERSIVE_LISTENER:
return {
diff --git a/react/features/mobile/watchos/reducer.ts b/react/features/mobile/watchos/reducer.ts
index 020e318a29..a832652132 100644
--- a/react/features/mobile/watchos/reducer.ts
+++ b/react/features/mobile/watchos/reducer.ts
@@ -16,7 +16,8 @@ const INITIAL_STATE = {
/**
* Reduces the Redux actions of the feature features/mobile/watchos.
*/
-ReducerRegistry.register('features/mobile/watchos', (state: IMobileWatchOSState = INITIAL_STATE, action) => {
+ReducerRegistry.register<IMobileWatchOSState>('features/mobile/watchos',
+(state = INITIAL_STATE, action): IMobileWatchOSState => {
switch (action.type) {
case SET_CONFERENCE_TIMESTAMP: {
return assign(state, {
diff --git a/react/features/no-audio-signal/reducer.ts b/react/features/no-audio-signal/reducer.ts
index 2d06b0081a..f6bab4996d 100644
--- a/react/features/no-audio-signal/reducer.ts
+++ b/react/features/no-audio-signal/reducer.ts
@@ -10,7 +10,7 @@ export interface INoAudioSignalState {
/**
* Reduces the redux actions of the feature no audio signal.
*/
-ReducerRegistry.register('features/no-audio-signal', (state: INoAudioSignalState = {}, action) => {
+ReducerRegistry.register<INoAudioSignalState>('features/no-audio-signal', (state = {}, action): INoAudioSignalState => {
switch (action.type) {
case SET_NO_AUDIO_SIGNAL_NOTIFICATION_UID:
return set(state, 'noAudioSignalNotificationUid', action.uid);
diff --git a/react/features/noise-detection/reducer.ts b/react/features/noise-detection/reducer.ts
index ff1512d130..e8c29a2079 100644
--- a/react/features/noise-detection/reducer.ts
+++ b/react/features/noise-detection/reducer.ts
@@ -10,7 +10,8 @@ export interface INoiseDetectionState {
/**
* Reduces the redux actions of noise detection feature.
*/
-ReducerRegistry.register('features/noise-detection', (state: INoiseDetectionState = {}, action) => {
+ReducerRegistry.register<INoiseDetectionState>('features/noise-detection',
+(state = {}, action): INoiseDetectionState => {
switch (action.type) {
case SET_NOISY_AUDIO_INPUT_NOTIFICATION_UID:
return set(state, 'noisyAudioInputNotificationUid', action.uid);
diff --git a/react/features/noise-suppression/reducer.ts b/react/features/noise-suppression/reducer.ts
index 3119c09c3c..0fd8cd1b96 100644
--- a/react/features/noise-suppression/reducer.ts
+++ b/react/features/noise-suppression/reducer.ts
@@ -15,7 +15,8 @@ const DEFAULT_STATE = {
/**
* Reduces the Redux actions of the feature features/noise-suppression.
*/
-ReducerRegistry.register('features/noise-suppression', (state: INoiseSuppressionState = DEFAULT_STATE, action: any) => {
+ReducerRegistry.register<INoiseSuppressionState>('features/noise-suppression',
+(state = DEFAULT_STATE, action): INoiseSuppressionState => {
const { enabled } = action;
switch (action.type) {
diff --git a/react/features/notifications/reducer.ts b/react/features/notifications/reducer.ts
index 7fb67c4f8a..8a9ba02714 100644
--- a/react/features/notifications/reducer.ts
+++ b/react/features/notifications/reducer.ts
@@ -42,8 +42,8 @@ export interface INotificationsState {
* @returns {Object} The next redux state which is the result of reducing the
* specified {@code action}.
*/
-ReducerRegistry.register('features/notifications',
- (state: INotificationsState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<INotificationsState>('features/notifications',
+ (state = DEFAULT_STATE, action): INotificationsState => {
switch (action.type) {
case CLEAR_NOTIFICATIONS:
return {
diff --git a/react/features/overlay/reducer.ts b/react/features/overlay/reducer.ts
index 3bad8ff97d..5aefa9cf7d 100644
--- a/react/features/overlay/reducer.ts
+++ b/react/features/overlay/reducer.ts
@@ -21,7 +21,7 @@ export interface IOverlayState {
*
* FIXME: these pieces of state should probably be in a different place.
*/
-ReducerRegistry.register('features/overlay', (state: IOverlayState = { }, action) => {
+ReducerRegistry.register<IOverlayState>('features/overlay', (state = {}, action): IOverlayState => {
switch (action.type) {
case CONFIG_WILL_LOAD:
return _setShowLoadConfigOverlay(state, Boolean(action.room));
diff --git a/react/features/polls/reducer.ts b/react/features/polls/reducer.ts
index 1ae76fde2a..6f7b7b4535 100644
--- a/react/features/polls/reducer.ts
+++ b/react/features/polls/reducer.ts
@@ -25,7 +25,7 @@ export interface IPollsState {
};
}
-ReducerRegistry.register('features/polls', (state: IPollsState = INITIAL_STATE, action) => {
+ReducerRegistry.register<IPollsState>('features/polls', (state = INITIAL_STATE, action): IPollsState => {
switch (action.type) {
case CHANGE_VOTE: {
diff --git a/react/features/power-monitor/reducer.ts b/react/features/power-monitor/reducer.ts
index abfab6671b..e90a81c1c6 100644
--- a/react/features/power-monitor/reducer.ts
+++ b/react/features/power-monitor/reducer.ts
@@ -16,7 +16,7 @@ export interface IPowerMonitorState {
/**
* Reduces the redux actions of the feature power monitor.
*/
-ReducerRegistry.register('features/power-monitor', (state: IPowerMonitorState = { }, action) => {
+ReducerRegistry.register<IPowerMonitorState>('features/power-monitor', (state = {}, action): IPowerMonitorState => {
switch (action.type) {
case SET_TRANSPORT:
return _setTransport(state, action.transport);
diff --git a/react/features/prejoin/reducer.ts b/react/features/prejoin/reducer.ts
index 940a7aeaf7..b59fe303ce 100644
--- a/react/features/prejoin/reducer.ts
+++ b/react/features/prejoin/reducer.ts
@@ -65,8 +65,8 @@ PersistenceRegistry.register('features/prejoin', {
/**
* Listen for actions that mutate the prejoin state.
*/
-ReducerRegistry.register(
- 'features/prejoin', (state: IPrejoinState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IPrejoinState>(
+ 'features/prejoin', (state = DEFAULT_STATE, action): IPrejoinState => {
switch (action.type) {
case PREJOIN_JOINING_IN_PROGRESS:
return {
diff --git a/react/features/reactions/middleware.ts b/react/features/reactions/middleware.ts
index 01265b8fed..042cfda121 100644
--- a/react/features/reactions/middleware.ts
+++ b/react/features/reactions/middleware.ts
@@ -109,7 +109,7 @@ MiddlewareRegistry.register((store: IStore) => (next: Function) => (action:any)
const { timeoutID, buffer } = getState()['features/reactions'];
const { reaction } = action;
- clearTimeout(timeoutID);
+ clearTimeout(timeoutID ?? 0);
buffer.push(reaction);
action.buffer = buffer;
action.timeoutID = setTimeout(() => {
diff --git a/react/features/reactions/reducer.ts b/react/features/reactions/reducer.ts
index ce4c8f5f3f..68b6fadc82 100644
--- a/react/features/reactions/reducer.ts
+++ b/react/features/reactions/reducer.ts
@@ -77,9 +77,9 @@ function _getInitialState(): IReactionsState {
};
}
-ReducerRegistry.register(
+ReducerRegistry.register<IReactionsState>(
'features/reactions',
- (state: IReactionsState = _getInitialState(), action: ReactionsAction) => {
+ (state = _getInitialState(), action: ReactionsAction): IReactionsState => {
switch (action.type) {
case TOGGLE_REACTIONS_VISIBLE:
@@ -91,8 +91,8 @@ ReducerRegistry.register(
case ADD_REACTION_BUFFER:
return {
...state,
- buffer: action.buffer,
- timeoutID: action.timeoutID
+ buffer: action.buffer ?? [],
+ timeoutID: action.timeoutID ?? null
};
case FLUSH_REACTION_BUFFER:
@@ -105,7 +105,7 @@ ReducerRegistry.register(
case SET_REACTION_QUEUE: {
return {
...state,
- queue: action.queue
+ queue: action.queue ?? []
};
}
diff --git a/react/features/recent-list/reducer.ts b/react/features/recent-list/reducer.ts
index 786eb39305..5c018bf881 100644
--- a/react/features/recent-list/reducer.ts
+++ b/react/features/recent-list/reducer.ts
@@ -46,7 +46,7 @@ PersistenceRegistry.register(STORE_NAME);
/**
* Reduces redux actions for the purposes of the feature {@code recent-list}.
*/
-ReducerRegistry.register(STORE_NAME, (state: IRecentListState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IRecentListState>(STORE_NAME, (state = DEFAULT_STATE, action): IRecentListState => {
if (isRecentListEnabled()) {
switch (action.type) {
case DELETE_RECENT_LIST_ENTRY:
diff --git a/react/features/recording/reducer.ts b/react/features/recording/reducer.ts
index 9ea5e001dc..11a923a088 100644
--- a/react/features/recording/reducer.ts
+++ b/react/features/recording/reducer.ts
@@ -45,8 +45,8 @@ const STORE_NAME = 'features/recording';
/**
* Reduces the Redux actions of the feature features/recording.
*/
-ReducerRegistry.register(STORE_NAME,
- (state: IRecordingState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IRecordingState>(STORE_NAME,
+ (state = DEFAULT_STATE, action): IRecordingState => {
switch (action.type) {
case CLEAR_RECORDING_SESSIONS:
diff --git a/react/features/remote-control/reducer.ts b/react/features/remote-control/reducer.ts
index 28140de443..128689fab9 100644
--- a/react/features/remote-control/reducer.ts
+++ b/react/features/remote-control/reducer.ts
@@ -41,8 +41,8 @@ export interface IRemoteControlState {
/**
* Listen for actions that mutate the remote control state.
*/
-ReducerRegistry.register(
- 'features/remote-control', (state: IRemoteControlState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IRemoteControlState>(
+ 'features/remote-control', (state = DEFAULT_STATE, action): IRemoteControlState => {
switch (action.type) {
case CAPTURE_EVENTS:
return {
diff --git a/react/features/room-lock/constants.js b/react/features/room-lock/constants.ts
similarity index 100%
rename from react/features/room-lock/constants.js
rename to react/features/room-lock/constants.ts
diff --git a/react/features/screen-share/reducer.ts b/react/features/screen-share/reducer.ts
index 144f6a2d2b..5ab424d8cf 100644
--- a/react/features/screen-share/reducer.ts
+++ b/react/features/screen-share/reducer.ts
@@ -16,7 +16,7 @@ export interface IScreenShareState {
/**
* Reduces the Redux actions of the feature features/screen-share.
*/
-ReducerRegistry.register('features/screen-share', (state: IScreenShareState = {}, action) => {
+ReducerRegistry.register<IScreenShareState>('features/screen-share', (state = {}, action): IScreenShareState => {
const { captureFrameRate, isSharingAudio, desktopAudioTrack } = action;
switch (action.type) {
diff --git a/react/features/screenshot-capture/reducer.ts b/react/features/screenshot-capture/reducer.ts
index 2775521fe6..694dc34b61 100644
--- a/react/features/screenshot-capture/reducer.ts
+++ b/react/features/screenshot-capture/reducer.ts
@@ -15,7 +15,8 @@ export interface IScreenshotCaptureState {
capturesEnabled: boolean;
}
-ReducerRegistry.register('features/screenshot-capture', (state: IScreenshotCaptureState = DEFAULT_STATE, action) => {
+ReducerRegistry.register<IScreenshotCaptureState>('features/screenshot-capture',
+(state = DEFAULT_STATE, action): IScreenshotCaptureState => {
switch (action.type) {
case SET_SCREENSHOT_CAPTURE: {
return {
diff --git a/react/features/shared-video/reducer.ts b/react/features/shared-video/reducer.ts
index 1bec55f218..641e8a98bd 100644
--- a/react/features/shared-video/reducer.ts
+++ b/react/features/shared-video/reducer.ts
@@ -17,8 +17,8 @@ export interface ISharedVideoState {
/**
* Reduces the Redux actions of the feature features/shared-video.
*/
-ReducerRegistry.register('features/shared-video',
-(state: ISharedVideoState = initialState, action): ISharedVideoState => {
+ReducerRegistry.register<ISharedVideoState>('features/shared-video',
+(state = initialState, action): ISharedVideoState => {
const { videoUrl, status, time, ownerId, disabled, muted, volume } = action;
switch (action.type) {
diff --git a/react/features/speaker-stats/reducer.ts b/react/features/speaker-stats/reducer.ts
index 3f47e220f4..e41b76dc4b 100644
--- a/react/features/speaker-stats/reducer.ts
+++ b/react/features/speaker-stats/reducer.ts
@@ -31,7 +31,8 @@ export interface ISpeakerStatsState {
stats: Object;
}
-ReducerRegistry.register('features/speaker-stats', (state: ISpeakerStatsState = INITIAL_STATE, action) => {
+ReducerRegistry.register<ISpeakerStatsState>('features/speaker-stats',
+(state = INITIAL_STATE, action): ISpeakerStatsState => {
switch (action.type) {
case INIT_SEARCH:
return _updateCriteria(state, action);
diff --git a/react/features/subtitles/reducer.ts b/react/features/subtitles/reducer.ts
index 693da5637e..0a4fb6d2d2 100644
--- a/react/features/subtitles/reducer.ts
+++ b/react/features/subtitles/reducer.ts
@@ -24,8 +24,8 @@ export interface ISubtitlesState {
* Listen for actions for the transcription feature to be used by the actions
* to update the rendered transcription subtitles.
*/
-ReducerRegistry.register('features/subtitles', (
- state: ISubtitlesState = defaultState, action) => {
+ReducerRegistry.register<ISubtitlesState>('features/subtitles', (
+ state = defaultState, action): ISubtitlesState => {
switch (action.type) {
case REMOVE_TRANSCRIPT_MESSAGE:
return _removeTranscriptMessage(state, action);
diff --git a/react/features/talk-while-muted/reducer.ts b/react/features/talk-while-muted/reducer.ts
index 538d65d2f5..9fa5eef7c0 100644
--- a/react/features/talk-while-muted/reducer.ts
+++ b/react/features/talk-while-muted/reducer.ts
@@ -10,7 +10,8 @@ export interface ITalkWhileMutedState {
/**
* Reduces the redux actions of the feature talk while muted.
*/
-ReducerRegistry.register('features/talk-while-muted', (state: ITalkWhileMutedState = { }, action) => {
+ReducerRegistry.register<ITalkWhileMutedState>('features/talk-while-muted',
+(state = {}, action): ITalkWhileMutedState => {
switch (action.type) {
case SET_CURRENT_NOTIFICATION_UID:
return set(state, 'currentNotificationUid', action.uid);
diff --git a/react/features/toolbox/reducer.ts b/react/features/toolbox/reducer.ts
index f59298f00c..8bdae3b892 100644
--- a/react/features/toolbox/reducer.ts
+++ b/react/features/toolbox/reducer.ts
@@ -83,9 +83,9 @@ export interface IToolboxState {
visible: boolean;
}
-ReducerRegistry.register(
+ReducerRegistry.register<IToolboxState>(
'features/toolbox',
- (state: IToolboxState = INITIAL_STATE, action): IToolboxState => {
+ (state = INITIAL_STATE, action): IToolboxState => {
switch (action.type) {
case CLEAR_TOOLBOX_TIMEOUT:
return {
diff --git a/react/features/transcribing/reducer.ts b/react/features/transcribing/reducer.ts
index 883cb3cf29..9cbcc4ec91 100644
--- a/react/features/transcribing/reducer.ts
+++ b/react/features/transcribing/reducer.ts
@@ -70,8 +70,8 @@ export interface ITranscribingState {
/**
* Reduces the Redux actions of the feature features/transcribing.
*/
-ReducerRegistry.register('features/transcribing',
- (state: ITranscribingState = _getInitialState(), action): ITranscribingState => {
+ReducerRegistry.register<ITranscribingState>('features/transcribing',
+ (state = _getInitialState(), action): ITranscribingState => {
switch (action.type) {
case _TRANSCRIBER_JOINED:
return {
diff --git a/react/features/video-layout/reducer.ts b/react/features/video-layout/reducer.ts
index 9f34e42fc5..10c58680e4 100644
--- a/react/features/video-layout/reducer.ts
+++ b/react/features/video-layout/reducer.ts
@@ -39,7 +39,7 @@ export interface IVideoLayoutState {
const STORE_NAME = 'features/video-layout';
-ReducerRegistry.register(STORE_NAME, (state: IVideoLayoutState = DEFAULT_STATE, action): IVideoLayoutState => {
+ReducerRegistry.register<IVideoLayoutState>(STORE_NAME, (state = DEFAULT_STATE, action): IVideoLayoutState => {
switch (action.type) {
case SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED:
case VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED:
diff --git a/react/features/video-quality/reducer.ts b/react/features/video-quality/reducer.ts
index 284d9185d3..8855813e4b 100644
--- a/react/features/video-quality/reducer.ts
+++ b/react/features/video-quality/reducer.ts
@@ -55,8 +55,8 @@ export interface IVideoQualityPersistedState {
// In order to workaround this issue we need additional state for the persisted properties.
PersistenceRegistry.register('features/video-quality-persistent-storage');
-ReducerRegistry.register('features/video-quality-persistent-storage',
-(state: IVideoQualityPersistedState = {}, action): IVideoQualityPersistedState => {
+ReducerRegistry.register<IVideoQualityPersistedState>('features/video-quality-persistent-storage',
+(state = {}, action): IVideoQualityPersistedState => {
switch (action.type) {
case SET_PREFERRED_VIDEO_QUALITY: {
const { preferredVideoQuality } = action;
@@ -71,8 +71,8 @@ ReducerRegistry.register('features/video-quality-persistent-storage',
return state;
});
-ReducerRegistry.register('features/video-quality',
-(state: IVideoQualityState = DEFAULT_STATE, action): IVideoQualityState => {
+ReducerRegistry.register<IVideoQualityState>('features/video-quality',
+(state = DEFAULT_STATE, action): IVideoQualityState => {
switch (action.type) {
case SET_CONFIG:
return _setConfig(state, action);
diff --git a/react/features/videosipgw/reducer.ts b/react/features/videosipgw/reducer.ts
index d60653c363..d52bf3603a 100644
--- a/react/features/videosipgw/reducer.ts
+++ b/react/features/videosipgw/reducer.ts
@@ -6,8 +6,8 @@ export interface IVideoSipGW {
status?: string;
}
-ReducerRegistry.register(
- 'features/videosipgw', (state: IVideoSipGW = {}, action): IVideoSipGW => {
+ReducerRegistry.register<IVideoSipGW>(
+ 'features/videosipgw', (state = {}, action): IVideoSipGW => {
switch (action.type) {
case SIP_GW_AVAILABILITY_CHANGED: {
return {
diff --git a/react/features/virtual-background/reducer.ts b/react/features/virtual-background/reducer.ts
index 4c1e7a22b2..75609d0c20 100644
--- a/react/features/virtual-background/reducer.ts
+++ b/react/features/virtual-background/reducer.ts
@@ -25,7 +25,7 @@ export interface IVirtualBackground {
* @returns {State} The next redux state that is the result of reducing the
* specified action.
*/
-ReducerRegistry.register(STORE_NAME, (state: IVirtualBackground = {}, action): IVirtualBackground => {
+ReducerRegistry.register<IVirtualBackground>(STORE_NAME, (state = {}, action): IVirtualBackground => {
const { virtualSource, backgroundEffectEnabled, blurValue, backgroundType, selectedThumbnail } = action;
/**