From 2a321d6b1fdc4f5fc6009e628a18d9e5435c1b39 Mon Sep 17 00:00:00 2001 From: Robert Pintilii Date: Mon, 17 Oct 2022 14:28:01 +0300 Subject: [PATCH] ref(TS) Convert some files to TS (#12364) --- globals.d.ts | 2 + .../app/{actions.any.js => actions.any.ts} | 16 +- .../app/{actions.web.js => actions.web.ts} | 56 +++--- .../{functions.any.js => functions.any.ts} | 11 +- .../{functions.web.js => functions.web.ts} | 11 +- react/features/app/{logger.js => logger.ts} | 2 - .../{actions.any.js => actions.any.ts} | 26 +-- .../{actions.web.js => actions.web.ts} | 11 +- .../components/web/LoginDialog.tsx | 4 +- .../authentication/{logger.js => logger.ts} | 2 - .../conference/{actions.js => actions.ts} | 189 +++++++++--------- react/features/base/conference/functions.ts | 5 +- react/features/base/conference/reducer.ts | 14 +- .../base/connection/actions.native.ts | 2 - react/features/base/connection/reducer.ts | 1 + react/features/base/devices/middleware.ts | 2 - react/features/base/settings/middleware.ts | 1 - react/features/base/tracks/actions.any.ts | 2 +- react/features/base/tracks/actions.native.ts | 4 +- react/features/breakout-rooms/actions.ts | 6 +- .../overlay/{actions.js => actions.ts} | 4 +- .../prejoin/{actions.js => actions.ts} | 50 +++-- .../features/prejoin/{logger.js => logger.ts} | 2 - 23 files changed, 205 insertions(+), 218 deletions(-) rename react/features/app/{actions.any.js => actions.any.ts} (88%) rename react/features/app/{actions.web.js => actions.web.ts} (84%) rename react/features/app/{functions.any.js => functions.any.ts} (71%) rename react/features/app/{functions.web.js => functions.web.ts} (74%) rename react/features/app/{logger.js => logger.ts} (90%) rename react/features/authentication/{actions.any.js => actions.any.ts} (88%) rename react/features/authentication/{actions.web.js => actions.web.ts} (81%) rename react/features/authentication/{logger.js => logger.ts} (91%) rename react/features/base/conference/{actions.js => actions.ts} (79%) rename react/features/overlay/{actions.js => actions.ts} (96%) rename react/features/prejoin/{actions.js => actions.ts} (90%) rename react/features/prejoin/{logger.js => logger.ts} (91%) diff --git a/globals.d.ts b/globals.d.ts index 24bc2fcbe1..66f15f66e9 100644 --- a/globals.d.ts +++ b/globals.d.ts @@ -20,4 +20,6 @@ declare global { } const config: IConfig; + + const JitsiMeetJS: any; } diff --git a/react/features/app/actions.any.js b/react/features/app/actions.any.ts similarity index 88% rename from react/features/app/actions.any.js rename to react/features/app/actions.any.ts index 9e3a6e4c3c..937e95b999 100644 --- a/react/features/app/actions.any.js +++ b/react/features/app/actions.any.ts @@ -1,10 +1,7 @@ -// @flow - -import type { Dispatch } from 'redux'; - -import { getLocationContextRoot } from '../base/util'; +import { getLocationContextRoot } from '../base/util/uri'; import { addTrackStateToURL } from './functions.any'; +import { IStore } from './types'; /** * Redirects to another page generated by replacing the path in the original URL @@ -14,9 +11,9 @@ import { addTrackStateToURL } from './functions.any'; * @returns {Function} */ export function redirectWithStoredParams(pathname: string) { - return (dispatch: Dispatch, getState: Function) => { + return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { const { locationURL } = getState()['features/base/connection']; - const newLocationURL = new URL(locationURL.href); + const newLocationURL = new URL(locationURL?.href ?? ''); newLocationURL.pathname = pathname; window.location.assign(newLocationURL.toString()); @@ -35,7 +32,7 @@ export function redirectWithStoredParams(pathname: string) { * window.location.hash. * @returns {Function} */ -export function redirectToStaticPage(pathname: string, hashParam: ?string) { +export function redirectToStaticPage(pathname: string, hashParam?: string) { return () => { const windowLocation = window.location; let newPathname = pathname; @@ -63,11 +60,12 @@ export function redirectToStaticPage(pathname: string, hashParam: ?string) { * @returns {Function} */ export function reloadWithStoredParams() { - return (dispatch: Dispatch, getState: Function) => { + return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { const state = getState(); const { locationURL } = state['features/base/connection']; // Preserve the local tracks muted states. + // @ts-ignore const newURL = addTrackStateToURL(locationURL, state); const windowLocation = window.location; const oldSearchString = windowLocation.search; diff --git a/react/features/app/actions.web.js b/react/features/app/actions.web.ts similarity index 84% rename from react/features/app/actions.web.js rename to react/features/app/actions.web.ts index c2d6b481ea..8234135a0d 100644 --- a/react/features/app/actions.web.js +++ b/react/features/app/actions.web.ts @@ -1,44 +1,35 @@ -// @flow - -import type { Dispatch } from 'redux'; - +// @ts-expect-error import { API_ID } from '../../../modules/API'; -import { setRoom } from '../base/conference'; +import { setRoom } from '../base/conference/actions'; import { configWillLoad, - createFakeConfig, loadConfigError, - restoreConfig, setConfig, storeConfig -} from '../base/config'; -import { setLocationURL } from '../base/connection'; +} from '../base/config/actions'; +import { createFakeConfig, restoreConfig } from '../base/config/functions.web'; +import { setLocationURL } from '../base/connection/actions.web'; import { loadConfig } from '../base/lib-jitsi-meet/functions.web'; +import { inIframe } from '../base/util/iframeUtils'; +import { parseURLParams } from '../base/util/parseURLParams'; import { appendURLParam, getBackendSafeRoomName, - parseURIString, - parseURLParams -} from '../base/util'; -import { inIframe } from '../base/util/iframeUtils'; + parseURIString +} from '../base/util/uri'; import { isVpaasMeeting } from '../jaas/functions'; -import { - NOTIFICATION_TIMEOUT_TYPE, - clearNotifications, - showNotification -} from '../notifications'; -import { setFatalError } from '../overlay'; +import { clearNotifications, showNotification } from '../notifications/actions'; +import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants'; +import { setFatalError } from '../overlay/actions'; import { redirectToStaticPage, redirectWithStoredParams, reloadWithStoredParams } from './actions.any'; -import { getDefaultURL, getName } from './functions'; +import { getDefaultURL, getName } from './functions.web'; import logger from './logger'; - - -declare var interfaceConfig: Object; +import { IStore } from './types'; export * from './actions.any'; @@ -52,8 +43,8 @@ export * from './actions.any'; * scheme, or a mere room name. * @returns {Function} */ -export function appNavigate(uri: ?string) { - return async (dispatch: Dispatch, getState: Function) => { +export function appNavigate(uri?: string) { + return async (dispatch: IStore['dispatch'], getState: IStore['getState']) => { let location = parseURIString(uri); // If the specified location (URI) does not identify a host, use the app's @@ -96,7 +87,7 @@ export function appNavigate(uri: ?string) { let url = `${baseURL}config.js`; // XXX In order to support multiple shards, tell the room to the deployment. - room && (url = appendURLParam(url, 'room', getBackendSafeRoomName(room))); + room && (url = appendURLParam(url, 'room', getBackendSafeRoomName(room) ?? '')); const { release } = parseURLParams(location, true, 'search'); @@ -113,7 +104,7 @@ export function appNavigate(uri: ?string) { try { config = await loadConfig(url); dispatch(storeConfig(baseURL, config)); - } catch (error) { + } catch (error: any) { config = restoreConfig(baseURL); if (!config) { @@ -155,8 +146,8 @@ export function appNavigate(uri: ?string) { * @param {boolean} options.feedbackSubmitted - Whether feedback was submitted. * @returns {Function} */ -export function maybeRedirectToWelcomePage(options: Object = {}) { - return (dispatch: Dispatch, getState: Function) => { +export function maybeRedirectToWelcomePage(options: { feedbackSubmitted?: boolean; showThankYou?: boolean; } = {}) { + return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { const { enableClosePage @@ -168,6 +159,7 @@ export function maybeRedirectToWelcomePage(options: Object = {}) { const isOpenedInIframe = inIframe(); if (isOpenedInIframe) { + // @ts-ignore window.location = 'about:blank'; } else { dispatch(redirectToStaticPage('/')); @@ -182,8 +174,8 @@ export function maybeRedirectToWelcomePage(options: Object = {}) { // save whether current user is guest or not, and pass auth token, // before navigating to close page - window.sessionStorage.setItem('guest', !jwt); - window.sessionStorage.setItem('jwt', jwt); + window.sessionStorage.setItem('guest', (!jwt).toString()); + window.sessionStorage.setItem('jwt', jwt ?? ''); let path = 'close.html'; @@ -228,7 +220,7 @@ export function maybeRedirectToWelcomePage(options: Object = {}) { * @returns {Function} */ export function reloadNow() { - return (dispatch: Dispatch, getState: Function) => { + return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { dispatch(setFatalError(undefined)); const state = getState(); diff --git a/react/features/app/functions.any.js b/react/features/app/functions.any.ts similarity index 71% rename from react/features/app/functions.any.js rename to react/features/app/functions.any.ts index 718a996bbf..c30a8aa297 100644 --- a/react/features/app/functions.any.js +++ b/react/features/app/functions.any.ts @@ -1,7 +1,8 @@ -import { MEDIA_TYPE } from '../base/media'; -import { toState } from '../base/redux'; -import { isLocalCameraTrackMuted, isLocalTrackMuted } from '../base/tracks'; -import { addHashParamsToURL } from '../base/util'; +import { IStateful } from '../base/app/types'; +import { MEDIA_TYPE } from '../base/media/constants'; +import { toState } from '../base/redux/functions'; +import { isLocalCameraTrackMuted, isLocalTrackMuted } from '../base/tracks/functions'; +import { addHashParamsToURL } from '../base/util/uri'; /** * Adds the current track state to the passed URL. @@ -10,7 +11,7 @@ import { addHashParamsToURL } from '../base/util'; * @param {Function|Object} stateful - The redux store or {@code getState} function. * @returns {URL} - Returns the modified URL. */ -export function addTrackStateToURL(url, stateful) { +export function addTrackStateToURL(url: string, stateful: IStateful) { const state = toState(stateful); const tracks = state['features/base/tracks']; const isVideoMuted = isLocalCameraTrackMuted(tracks); diff --git a/react/features/app/functions.web.js b/react/features/app/functions.web.ts similarity index 74% rename from react/features/app/functions.web.js rename to react/features/app/functions.web.ts index 944a60b431..804fd4170f 100644 --- a/react/features/app/functions.web.js +++ b/react/features/app/functions.web.ts @@ -1,12 +1,9 @@ -// @flow - -import { toState } from '../base/redux'; -import { getServerURL } from '../base/settings'; +import { IStateful } from '../base/app/types'; +import { toState } from '../base/redux/functions'; +import { getServerURL } from '../base/settings/functions.web'; export * from './functions.any'; -declare var interfaceConfig: Object; - /** * Retrieves the default URL for the app. This can either come from a prop to * the root App component or be configured in the settings. @@ -15,7 +12,7 @@ declare var interfaceConfig: Object; * function. * @returns {string} - Default URL for the app. */ -export function getDefaultURL(stateful: Function | Object) { +export function getDefaultURL(stateful: IStateful) { const state = toState(stateful); const { href } = window.location; diff --git a/react/features/app/logger.js b/react/features/app/logger.ts similarity index 90% rename from react/features/app/logger.js rename to react/features/app/logger.ts index b2624bb049..ee74d4e2ae 100644 --- a/react/features/app/logger.js +++ b/react/features/app/logger.ts @@ -1,5 +1,3 @@ -// @flow - import { getLogger } from '../base/logging/functions'; export default getLogger('features/app'); diff --git a/react/features/authentication/actions.any.js b/react/features/authentication/actions.any.ts similarity index 88% rename from react/features/authentication/actions.any.js rename to react/features/authentication/actions.any.ts index 681c50c62d..708c2c7aa1 100644 --- a/react/features/authentication/actions.any.js +++ b/react/features/authentication/actions.any.ts @@ -1,15 +1,15 @@ -// @flow - -import type { Dispatch } from 'redux'; - -import { checkIfCanJoin } from '../base/conference'; -import { openDialog } from '../base/dialog'; +import { IStore } from '../app/types'; +import { checkIfCanJoin } from '../base/conference/actions'; +import { IJitsiConference } from '../base/conference/reducer'; +import { openDialog } from '../base/dialog/actions'; import { STOP_WAIT_FOR_OWNER, UPGRADE_ROLE_FINISHED, UPGRADE_ROLE_STARTED, WAIT_FOR_OWNER } from './actionTypes'; +// eslint-disable-next-line lines-around-comment +// @ts-ignore import { LoginDialog, WaitForOwnerDialog } from './components'; import logger from './logger'; @@ -28,8 +28,8 @@ import logger from './logger'; export function authenticateAndUpgradeRole( id: string, password: string, - conference: Object) { - return (dispatch: Dispatch) => { + conference: IJitsiConference) { + return (dispatch: IStore['dispatch']) => { const process = conference.authenticateAndUpgradeRole({ id, @@ -45,7 +45,7 @@ export function authenticateAndUpgradeRole( dispatch(_upgradeRoleStarted(process)); process.then( /* onFulfilled */ () => dispatch(_upgradeRoleFinished(process, 1)), - /* onRejected */ error => { + /* onRejected */ (error: any) => { // The lack of an error signals a cancellation. if (error.authenticationError || error.connectionError) { logger.error('authenticateAndUpgradeRole failed', error); @@ -78,8 +78,8 @@ export function authenticateAndUpgradeRole( * }} */ function _upgradeRoleFinished( - thenableWithCancel, - progressOrError: number | Object) { + thenableWithCancel: Object, + progressOrError: number | any) { let error; let progress; @@ -121,7 +121,7 @@ function _upgradeRoleFinished( * thenableWithCancel: Object * }} */ -function _upgradeRoleStarted(thenableWithCancel) { +function _upgradeRoleStarted(thenableWithCancel: Object) { return { type: UPGRADE_ROLE_STARTED, thenableWithCancel @@ -159,7 +159,7 @@ export function stopWaitForOwner() { * @returns {Function} */ export function waitForOwner() { - return (dispatch: Dispatch) => + return (dispatch: IStore['dispatch']) => dispatch({ type: WAIT_FOR_OWNER, handler: () => dispatch(checkIfCanJoin()), diff --git a/react/features/authentication/actions.web.js b/react/features/authentication/actions.web.ts similarity index 81% rename from react/features/authentication/actions.web.js rename to react/features/authentication/actions.web.ts index 1ac8e72242..fcf7d200f8 100644 --- a/react/features/authentication/actions.web.js +++ b/react/features/authentication/actions.web.ts @@ -1,11 +1,12 @@ -// @flow - -import { maybeRedirectToWelcomePage } from '../app/actions'; +import { maybeRedirectToWelcomePage } from '../app/actions.web'; +import { IStore } from '../app/types'; import { hideDialog, openDialog } from '../base/dialog/actions'; import { CANCEL_LOGIN } from './actionTypes'; +// eslint-disable-next-line lines-around-comment +// @ts-ignore import { LoginDialog, WaitForOwnerDialog } from './components'; export * from './actions.any'; @@ -30,7 +31,7 @@ export function cancelLogin() { * @returns {Function} */ export function cancelWaitForOwner() { - return (dispatch: Function) => { + return (dispatch: IStore['dispatch']) => { dispatch(maybeRedirectToWelcomePage()); }; } @@ -55,7 +56,7 @@ export function hideLoginDialog() { * * @returns {Function}. */ -export function openAuthDialog(room: String, onAuthNow: ?Function) { +export function openAuthDialog(room: String, onAuthNow?: Function) { return openDialog(WaitForOwnerDialog, { room, onAuthNow diff --git a/react/features/authentication/components/web/LoginDialog.tsx b/react/features/authentication/components/web/LoginDialog.tsx index 61d6eee47a..577bbf3904 100644 --- a/react/features/authentication/components/web/LoginDialog.tsx +++ b/react/features/authentication/components/web/LoginDialog.tsx @@ -5,6 +5,7 @@ import { WithTranslation } from 'react-i18next'; // @ts-ignore import { connect } from '../../../../../connection'; import { IState, IStore } from '../../../app/types'; +import { IJitsiConference } from '../../../base/conference/reducer'; import { IConfig } from '../../../base/config/configType'; import { toJid } from '../../../base/connection/functions'; import { translate, translateToHTML } from '../../../base/i18n/functions'; @@ -15,7 +16,6 @@ import Input from '../../../base/ui/components/web/Input'; import { authenticateAndUpgradeRole, cancelLogin - // @ts-ignore } from '../../actions.web'; /** @@ -27,7 +27,7 @@ interface Props extends WithTranslation { * {@link JitsiConference} That needs authentication - will hold a valid * value in XMPP login + guest access mode. */ - _conference: Object; + _conference: IJitsiConference; /** * The server hosts specified in the global config. diff --git a/react/features/authentication/logger.js b/react/features/authentication/logger.ts similarity index 91% rename from react/features/authentication/logger.js rename to react/features/authentication/logger.ts index 9e7b0f582e..4c95252867 100644 --- a/react/features/authentication/logger.js +++ b/react/features/authentication/logger.ts @@ -1,5 +1,3 @@ -// @flow - import { getLogger } from '../base/logging/functions'; export default getLogger('features/authentication'); diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.ts similarity index 79% rename from react/features/base/conference/actions.js rename to react/features/base/conference/actions.ts index 87b1a6e58c..480cd1c9ce 100644 --- a/react/features/base/conference/actions.js +++ b/react/features/base/conference/actions.ts @@ -1,42 +1,37 @@ -// @flow - -import type { Dispatch } from 'redux'; - -import { - createStartMutedConfigurationEvent, - sendAnalytics -} from '../../analytics'; +/* eslint-disable lines-around-comment */ +import { createStartMutedConfigurationEvent } from '../../analytics/AnalyticsEvents'; +import { sendAnalytics } from '../../analytics/functions'; +// @ts-ignore import { appNavigate } from '../../app/actions'; -import { endpointMessageReceived } from '../../subtitles'; +import { IState, IStore } from '../../app/types'; +import { endpointMessageReceived } from '../../subtitles/actions.any'; +// @ts-ignore import { getReplaceParticipant } from '../config/functions'; -import { JITSI_CONNECTION_CONFERENCE_KEY, disconnect } from '../connection'; +// @ts-ignore +import { disconnect } from '../connection/actions'; +import { JITSI_CONNECTION_CONFERENCE_KEY } from '../connection/constants'; import { JitsiConferenceEvents, JitsiE2ePingEvents } from '../lib-jitsi-meet'; -import { - MEDIA_TYPE, - setAudioMuted, - setAudioUnmutePermissions, - setVideoMuted, - setVideoUnmutePermissions -} from '../media'; +import { setAudioMuted, setAudioUnmutePermissions, setVideoMuted, setVideoUnmutePermissions } from '../media/actions'; +import { MEDIA_TYPE } from '../media/constants'; import { dominantSpeakerChanged, - getNormalizedDisplayName, participantConnectionStatusChanged, participantKicked, participantMutedUs, participantPresenceChanged, participantRoleChanged, participantUpdated -} from '../participants'; -import { toState } from '../redux'; +} from '../participants/actions'; +import { getNormalizedDisplayName } from '../participants/functions'; +import { toState } from '../redux/functions'; import { destroyLocalTracks, - getLocalTracks, replaceLocalTrack, trackAdded, trackRemoved -} from '../tracks'; -import { getBackendSafeRoomName } from '../util'; +} from '../tracks/actions.any'; +import { getLocalTracks } from '../tracks/functions'; +import { getBackendSafeRoomName } from '../util/uri'; import { AUTH_STATUS_CHANGED, @@ -81,8 +76,7 @@ import { sendLocalParticipant } from './functions'; import logger from './logger'; - -declare var APP: Object; +import { IJitsiConference } from './reducer'; /** * Adds conference (event) listeners. @@ -93,52 +87,53 @@ declare var APP: Object; * @private * @returns {void} */ -function _addConferenceListeners(conference, dispatch, state) { +function _addConferenceListeners(conference: IJitsiConference, dispatch: IStore['dispatch'], state: IState) { // A simple logger for conference errors received through // the listener. These errors are not handled now, but logged. conference.on(JitsiConferenceEvents.CONFERENCE_ERROR, - error => logger.error('Conference error.', error)); + (error: Error) => logger.error('Conference error.', error)); // Dispatches into features/base/conference follow: conference.on( JitsiConferenceEvents.AUTH_STATUS_CHANGED, - (authEnabled, authLogin) => dispatch(authStatusChanged(authEnabled, authLogin))); + (authEnabled: boolean, authLogin: string) => dispatch(authStatusChanged(authEnabled, authLogin))); conference.on( - JitsiConferenceEvents.CONFERENCE_FAILED, - (...args) => dispatch(conferenceFailed(conference, ...args))); + JitsiConferenceEvents.CONFERENCE_FAILED, // @ts-ignore + (...args: any[]) => dispatch(conferenceFailed(conference, ...args))); conference.on( - JitsiConferenceEvents.CONFERENCE_JOINED, - (...args) => dispatch(conferenceJoined(conference, ...args))); + JitsiConferenceEvents.CONFERENCE_JOINED, // @ts-ignore + (...args: any[]) => dispatch(conferenceJoined(conference, ...args))); conference.on( - JitsiConferenceEvents.CONFERENCE_UNIQUE_ID_SET, - (...args) => dispatch(conferenceUniqueIdSet(conference, ...args))); + JitsiConferenceEvents.CONFERENCE_UNIQUE_ID_SET, // @ts-ignore + (...args: any[]) => dispatch(conferenceUniqueIdSet(conference, ...args))); conference.on( - JitsiConferenceEvents.CONFERENCE_JOIN_IN_PROGRESS, - (...args) => dispatch(conferenceJoinInProgress(conference, ...args))); + JitsiConferenceEvents.CONFERENCE_JOIN_IN_PROGRESS, // @ts-ignore + (...args: any[]) => dispatch(conferenceJoinInProgress(conference, ...args))); conference.on( JitsiConferenceEvents.CONFERENCE_LEFT, - (...args) => { + (...args: any[]) => { dispatch(conferenceTimestampChanged(0)); + // @ts-ignore dispatch(conferenceLeft(conference, ...args)); }); - conference.on(JitsiConferenceEvents.SUBJECT_CHANGED, - (...args) => dispatch(conferenceSubjectChanged(...args))); + conference.on(JitsiConferenceEvents.SUBJECT_CHANGED, // @ts-ignore + (...args: any[]) => dispatch(conferenceSubjectChanged(...args))); - conference.on(JitsiConferenceEvents.CONFERENCE_CREATED_TIMESTAMP, - (...args) => dispatch(conferenceTimestampChanged(...args))); + conference.on(JitsiConferenceEvents.CONFERENCE_CREATED_TIMESTAMP, // @ts-ignore + (...args: any[]) => dispatch(conferenceTimestampChanged(...args))); conference.on( - JitsiConferenceEvents.KICKED, - (...args) => dispatch(kickedOut(conference, ...args))); + JitsiConferenceEvents.KICKED, // @ts-ignore + (...args: any[]) => dispatch(kickedOut(conference, ...args))); conference.on( JitsiConferenceEvents.PARTICIPANT_KICKED, - (kicker, kicked) => dispatch(participantKicked(kicker, kicked))); + (kicker: any, kicked: any) => dispatch(participantKicked(kicker, kicked))); conference.on( - JitsiConferenceEvents.LOCK_STATE_CHANGED, - (...args) => dispatch(lockStateChanged(conference, ...args))); + JitsiConferenceEvents.LOCK_STATE_CHANGED, // @ts-ignore + (...args: any[]) => dispatch(lockStateChanged(conference, ...args))); // Dispatches into features/base/media follow: @@ -177,12 +172,12 @@ function _addConferenceListeners(conference, dispatch, state) { conference.on( JitsiConferenceEvents.AUDIO_UNMUTE_PERMISSIONS_CHANGED, - disableAudioMuteChange => { + (disableAudioMuteChange: boolean) => { dispatch(setAudioUnmutePermissions(disableAudioMuteChange)); }); conference.on( JitsiConferenceEvents.VIDEO_UNMUTE_PERMISSIONS_CHANGED, - disableVideoMuteChange => { + (disableVideoMuteChange: boolean) => { dispatch(setVideoUnmutePermissions(disableVideoMuteChange)); }); @@ -190,25 +185,25 @@ function _addConferenceListeners(conference, dispatch, state) { conference.on( JitsiConferenceEvents.TRACK_ADDED, - t => t && !t.isLocal() && dispatch(trackAdded(t))); + (t: any) => t && !t.isLocal() && dispatch(trackAdded(t))); conference.on( JitsiConferenceEvents.TRACK_REMOVED, - t => t && !t.isLocal() && dispatch(trackRemoved(t))); + (t: any) => t && !t.isLocal() && dispatch(trackRemoved(t))); conference.on( JitsiConferenceEvents.TRACK_MUTE_CHANGED, - (track, participantThatMutedUs) => { + (track: any, participantThatMutedUs: any) => { if (participantThatMutedUs) { dispatch(participantMutedUs(participantThatMutedUs, track)); } }); - conference.on(JitsiConferenceEvents.TRACK_UNMUTE_REJECTED, track => dispatch(destroyLocalTracks(track))); + conference.on(JitsiConferenceEvents.TRACK_UNMUTE_REJECTED, (track: any) => dispatch(destroyLocalTracks(track))); // Dispatches into features/base/participants follow: conference.on( JitsiConferenceEvents.DISPLAY_NAME_CHANGED, - (id, displayName) => dispatch(participantUpdated({ + (id: string, displayName: string) => dispatch(participantUpdated({ conference, id, name: getNormalizedDisplayName(displayName) @@ -216,42 +211,42 @@ function _addConferenceListeners(conference, dispatch, state) { conference.on( JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, - (dominant, previous, silence) => { + (dominant: string, previous: string[], silence: boolean | string) => { dispatch(dominantSpeakerChanged(dominant, previous, Boolean(silence), conference)); }); conference.on( - JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, - (...args) => dispatch(endpointMessageReceived(...args))); + JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, // @ts-ignore + (...args: any[]) => dispatch(endpointMessageReceived(...args))); conference.on( - JitsiConferenceEvents.NON_PARTICIPANT_MESSAGE_RECEIVED, - (...args) => dispatch(nonParticipantMessageReceived(...args))); + JitsiConferenceEvents.NON_PARTICIPANT_MESSAGE_RECEIVED, // @ts-ignore + (...args: any[]) => dispatch(nonParticipantMessageReceived(...args))); conference.on( - JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED, - (...args) => dispatch(participantConnectionStatusChanged(...args))); + JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED, // @ts-ignore + (...args: any[]) => dispatch(participantConnectionStatusChanged(...args))); conference.on( JitsiConferenceEvents.USER_JOINED, - (id, user) => commonUserJoinedHandling({ dispatch }, conference, user)); + (_id: string, user: any) => commonUserJoinedHandling({ dispatch }, conference, user)); conference.on( JitsiConferenceEvents.USER_LEFT, - (id, user) => commonUserLeftHandling({ dispatch }, conference, user)); + (_id: string, user: any) => commonUserLeftHandling({ dispatch }, conference, user)); conference.on( - JitsiConferenceEvents.USER_ROLE_CHANGED, - (...args) => dispatch(participantRoleChanged(...args))); + JitsiConferenceEvents.USER_ROLE_CHANGED, // @ts-ignore + (...args: any[]) => dispatch(participantRoleChanged(...args))); conference.on( - JitsiConferenceEvents.USER_STATUS_CHANGED, - (...args) => dispatch(participantPresenceChanged(...args))); + JitsiConferenceEvents.USER_STATUS_CHANGED, // @ts-ignore + (...args: any[]) => dispatch(participantPresenceChanged(...args))); conference.on( - JitsiE2ePingEvents.E2E_RTT_CHANGED, - (...args) => dispatch(e2eRttChanged(...args))); + JitsiE2ePingEvents.E2E_RTT_CHANGED, // @ts-ignore + (...args: any[]) => dispatch(e2eRttChanged(...args))); conference.on( JitsiConferenceEvents.BOT_TYPE_CHANGED, - (id, botType) => dispatch(participantUpdated({ + (id: string, botType: string) => dispatch(participantUpdated({ conference, id, botType @@ -259,14 +254,14 @@ function _addConferenceListeners(conference, dispatch, state) { conference.addCommandListener( AVATAR_URL_COMMAND, - (data, id) => dispatch(participantUpdated({ + (data: { value: string; }, id: string) => dispatch(participantUpdated({ conference, id, avatarURL: data.value }))); conference.addCommandListener( EMAIL_COMMAND, - (data, id) => dispatch(participantUpdated({ + (data: { value: string; }, id: string) => dispatch(participantUpdated({ conference, id, email: data.value @@ -287,7 +282,7 @@ function _addConferenceListeners(conference, dispatch, state) { * } * }} */ -export function e2eRttChanged(participant, rtt) { +export function e2eRttChanged(participant: Object, rtt: number) { return { type: E2E_RTT_CHANGED, e2eRtt: { @@ -331,7 +326,7 @@ export function authStatusChanged(authEnabled: boolean, authLogin: string) { * }} * @public */ -export function conferenceFailed(conference: Object, error: string, ...params: any) { +export function conferenceFailed(conference: IJitsiConference, error: string, ...params: any) { return { type: CONFERENCE_FAILED, conference, @@ -356,7 +351,7 @@ export function conferenceFailed(conference: Object, error: string, ...params: a * conference: JitsiConference * }} */ -export function conferenceJoined(conference: Object) { +export function conferenceJoined(conference: IJitsiConference) { return { type: CONFERENCE_JOINED, conference @@ -373,7 +368,7 @@ export function conferenceJoined(conference: Object) { * conference: JitsiConference * }} */ -export function conferenceJoinInProgress(conference: Object) { +export function conferenceJoinInProgress(conference: IJitsiConference) { return { type: CONFERENCE_JOIN_IN_PROGRESS, conference @@ -390,7 +385,7 @@ export function conferenceJoinInProgress(conference: Object) { * conference: JitsiConference * }} */ -export function conferenceLeft(conference: Object) { +export function conferenceLeft(conference: IJitsiConference) { return { type: CONFERENCE_LEFT, conference @@ -438,7 +433,7 @@ export function conferenceTimestampChanged(conferenceTimestamp: number) { * conference: JitsiConference, * }} */ -export function conferenceUniqueIdSet(conference: Object) { +export function conferenceUniqueIdSet(conference: IJitsiConference) { return { type: CONFERENCE_UNIQUE_ID_SET, conference @@ -454,8 +449,8 @@ export function conferenceUniqueIdSet(conference: Object) { * the local participant will (try to) join. * @returns {Function} */ -export function _conferenceWillJoin(conference: Object) { - return (dispatch: Dispatch, getState: Function) => { +export function _conferenceWillJoin(conference: IJitsiConference) { + return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { const localTracks = getLocalTracks(getState()['features/base/tracks']) .map(t => t.jitsiTrack); @@ -479,7 +474,7 @@ export function _conferenceWillJoin(conference: Object) { * conference: JitsiConference * }} */ -export function conferenceWillJoin(conference: Object) { +export function conferenceWillJoin(conference: IJitsiConference) { return { type: CONFERENCE_WILL_JOIN, conference @@ -499,7 +494,7 @@ export function conferenceWillJoin(conference: Object) { * conference: JitsiConference * }} */ -export function conferenceWillLeave(conference: Object) { +export function conferenceWillLeave(conference: IJitsiConference) { return { type: CONFERENCE_WILL_LEAVE, conference @@ -514,7 +509,7 @@ export function conferenceWillLeave(conference: Object) { * @returns {Function} */ export function createConference(overrideRoom?: string) { - return (dispatch: Function, getState: Function) => { + return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { const state = getState(); const { connection, locationURL } = state['features/base/connection']; @@ -530,8 +525,8 @@ export function createConference(overrideRoom?: string) { // XXX: revisit this. // Hide the custom domain in the room name. - const tmp = overrideRoom || room; - let _room = getBackendSafeRoomName(tmp); + const tmp: any = overrideRoom || room; + let _room: any = getBackendSafeRoomName(tmp); if (tmp.domain) { // eslint-disable-next-line no-new-wrappers @@ -543,6 +538,7 @@ export function createConference(overrideRoom?: string) { const conference = connection.initJitsiConference(_room, getConferenceOptions(state)); + // @ts-ignore connection[JITSI_CONNECTION_CONFERENCE_KEY] = conference; conference[JITSI_CONFERENCE_URL_KEY] = locationURL; @@ -568,14 +564,15 @@ export function createConference(overrideRoom?: string) { * @returns {Function} */ export function checkIfCanJoin() { - return (dispatch: Function, getState: Function) => { + return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { const { authRequired, password } = getState()['features/base/conference']; const replaceParticipant = getReplaceParticipant(getState()); + // @ts-ignore authRequired && dispatch(_conferenceWillJoin(authRequired)); - authRequired && authRequired.join(password, replaceParticipant); + authRequired?.join(password, replaceParticipant); }; } @@ -598,7 +595,7 @@ export function dataChannelOpened() { * @returns {Function} */ export function endConference() { - return async (dispatch: Dispatch, getState: Function) => { + return async (dispatch: IStore['dispatch'], getState: IStore['getState']) => { const { conference } = getConferenceState(toState(getState)); conference?.end(); @@ -633,7 +630,7 @@ export function kickedOut(conference: Object, participant: Object) { * @returns {Function} */ export function leaveConference() { - return async (dispatch: Dispatch) => { + return async (dispatch: IStore['dispatch']) => { // FIXME: these should be unified. if (navigator.product === 'ReactNative') { @@ -771,7 +768,7 @@ export function setFollowMe(enabled: boolean) { * muted: boolean * }} */ -export function setStartReactionsMuted(muted: boolean, updateBackend: boolean = false) { +export function setStartReactionsMuted(muted: boolean, updateBackend = false) { return { type: SET_START_REACTIONS_MUTED, muted, @@ -791,10 +788,10 @@ export function setStartReactionsMuted(muted: boolean, updateBackend: boolean = * @returns {Function} */ export function setPassword( - conference: Object, + conference: IJitsiConference, method: Function, password: string) { - return (dispatch: Dispatch, getState: Function): ?Promise => { + return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { switch (method) { case conference.join: { let state = getState()['features/base/conference']; @@ -832,7 +829,7 @@ export function setPassword( method, password })) - .catch(error => dispatch({ + .catch((error: Error) => dispatch({ type: SET_PASSWORD_FAILED, error })) @@ -873,7 +870,7 @@ export function setObfuscatedRoom(obfuscatedRoom: string, obfuscatedRoomSource: * room: string * }} */ -export function setRoom(room: ?string) { +export function setRoom(room?: string) { return { type: SET_ROOM, room @@ -891,10 +888,10 @@ export function setRoom(room: ?string) { */ export function setStartMutedPolicy( startAudioMuted: boolean, startVideoMuted: boolean) { - return (dispatch: Dispatch, getState: Function) => { + return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { const conference = getCurrentConference(getState()); - conference && conference.setStartMutedPolicy({ + conference?.setStartMutedPolicy({ audio: startAudioMuted, video: startVideoMuted }); @@ -911,7 +908,7 @@ export function setStartMutedPolicy( * @returns {void} */ export function setSubject(subject: string) { - return (dispatch: Dispatch, getState: Function) => { + return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { const { conference } = getState()['features/base/conference']; if (conference) { diff --git a/react/features/base/conference/functions.ts b/react/features/base/conference/functions.ts index 94bd9c1ef2..a4cb478955 100644 --- a/react/features/base/conference/functions.ts +++ b/react/features/base/conference/functions.ts @@ -18,7 +18,6 @@ import { toState } from '../redux/functions'; import { getJitsiMeetGlobalNS } from '../util/helpers'; import { getBackendSafePath, safeDecodeURIComponent } from '../util/uri'; -// @ts-ignore import { setObfuscatedRoom } from './actions'; import { AVATAR_URL_COMMAND, @@ -86,7 +85,7 @@ export function _addLocalTracksToConference( * @returns {void} */ export function commonUserJoinedHandling( - { dispatch }: IStore, + { dispatch }: { dispatch: IStore['dispatch']; }, conference: IJitsiConference, user: any) { const id = user.getId(); @@ -122,7 +121,7 @@ export function commonUserJoinedHandling( * @returns {void} */ export function commonUserLeftHandling( - { dispatch }: IStore, + { dispatch }: { dispatch: IStore['dispatch']; }, conference: IJitsiConference, user: any) { const id = user.getId(); diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.ts index 32d65d9884..95d8275a8d 100644 --- a/react/features/base/conference/reducer.ts +++ b/react/features/base/conference/reducer.ts @@ -38,12 +38,15 @@ const DEFAULT_STATE = { }; export interface IJitsiConference { + addCommandListener: Function; addTrack: Function; + authenticateAndUpgradeRole: Function; avModerationApprove: Function; avModerationReject: Function; createVideoSIPGWSession: Function; disableAVModeration: Function; enableAVModeration: Function; + end: Function; getBreakoutRooms: Function; getLocalTracks: Function; grantOwner: Function; @@ -51,7 +54,11 @@ export interface IJitsiConference { isCallstatsEnabled: Function; isEndConferenceSupported: Function; isLobbySupported: Function; + isStartAudioMuted: Function; + isStartVideoMuted: Function; + join: Function; kickParticipant: Function; + lock: Function; muteParticipant: Function; myLobbyUserId: Function; myUserId: Function; @@ -65,12 +72,15 @@ export interface IJitsiConference { sessionId: string; setDisplayName: Function; setLocalParticipantProperty: Function; + setSubject: Function; } export interface IConferenceState { authEnabled?: boolean; authLogin?: string; - authRequired?: Object; + authRequired?: { + join: Function; + }; conference?: IJitsiConference; conferenceTimestamp?: number; e2eeSupported?: boolean; @@ -207,7 +217,7 @@ function _conferenceFailed(state: IConferenceState, { conference, error }: { con return state; } - let authRequired; + let authRequired: any; let membersOnly; let passwordRequired; diff --git a/react/features/base/connection/actions.native.ts b/react/features/base/connection/actions.native.ts index 0011b3d0f3..a5ce449831 100644 --- a/react/features/base/connection/actions.native.ts +++ b/react/features/base/connection/actions.native.ts @@ -1,6 +1,4 @@ import { IStore } from '../../app/types'; -// eslint-disable-next-line lines-around-comment -// @ts-ignore import { conferenceLeft, conferenceWillLeave } from '../conference/actions'; import { getCurrentConference } from '../conference/functions'; import JitsiMeetJS, { JitsiConnectionEvents } from '../lib-jitsi-meet'; diff --git a/react/features/base/connection/reducer.ts b/react/features/base/connection/reducer.ts index dbf3437ed6..a3ef8e341b 100644 --- a/react/features/base/connection/reducer.ts +++ b/react/features/base/connection/reducer.ts @@ -19,6 +19,7 @@ export interface IConnectionState { disconnect: Function; getJid: () => string; getLogs: () => Object; + initJitsiConference: Function; }; error?: ConnectionFailedError; locationURL?: URL; diff --git a/react/features/base/devices/middleware.ts b/react/features/base/devices/middleware.ts index 3e2bf34a7f..ca8740b695 100644 --- a/react/features/base/devices/middleware.ts +++ b/react/features/base/devices/middleware.ts @@ -6,8 +6,6 @@ import { IStore } from '../../app/types'; import { processExternalDeviceRequest } from '../../device-selection/functions'; import { showNotification, showWarningNotification } from '../../notifications/actions'; import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants'; -// eslint-disable-next-line lines-around-comment -// @ts-ignore import { replaceAudioTrackById, replaceVideoTrackById, setDeviceStatusWarning } from '../../prejoin/actions'; import { isPrejoinPageVisible } from '../../prejoin/functions'; import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app/actionTypes'; diff --git a/react/features/base/settings/middleware.ts b/react/features/base/settings/middleware.ts index f8cbd514ab..69423636cc 100644 --- a/react/features/base/settings/middleware.ts +++ b/react/features/base/settings/middleware.ts @@ -4,7 +4,6 @@ import { AnyAction } from 'redux'; import { IStore } from '../../app/types'; import { PREJOIN_INITIALIZED } from '../../prejoin/actionTypes'; -// @ts-ignore import { setPrejoinPageVisibility } from '../../prejoin/actions'; import { APP_WILL_MOUNT } from '../app/actionTypes'; import { setAudioOnly } from '../audio-only/actions'; diff --git a/react/features/base/tracks/actions.any.ts b/react/features/base/tracks/actions.any.ts index c815f6e87c..ccdd8d4afb 100644 --- a/react/features/base/tracks/actions.any.ts +++ b/react/features/base/tracks/actions.any.ts @@ -229,7 +229,7 @@ export function createLocalTracksA(options: TrackOptions = {}) { * @param {JitsiLocalTrack|null} [track] - The local track that needs to be destroyed. * @returns {Function} */ -export function destroyLocalTracks(track = null) { +export function destroyLocalTracks(track: any = null) { if (track) { return (dispatch: IStore['dispatch']) => { dispatch(_disposeAndRemoveTracks([ track ])); diff --git a/react/features/base/tracks/actions.native.ts b/react/features/base/tracks/actions.native.ts index 3fbdd599a1..a9c879961e 100644 --- a/react/features/base/tracks/actions.native.ts +++ b/react/features/base/tracks/actions.native.ts @@ -2,12 +2,10 @@ import { IState, IStore } from '../../app/types'; // @ts-ignore import { setPictureInPictureEnabled } from '../../mobile/picture-in-picture/functions'; -// @ts-ignore -import { setAudioOnly } from '../audio-only'; +import { setAudioOnly } from '../audio-only/actions'; import JitsiMeetJS from '../lib-jitsi-meet'; import { destroyLocalDesktopTrackIfExists, replaceLocalTrack } from './actions.any'; -// @ts-ignore import { getLocalVideoTrack, isLocalVideoTrackDesktop } from './functions'; /* eslint-enable lines-around-comment */ diff --git a/react/features/breakout-rooms/actions.ts b/react/features/breakout-rooms/actions.ts index cf4fc8eb7e..451c2eba6a 100644 --- a/react/features/breakout-rooms/actions.ts +++ b/react/features/breakout-rooms/actions.ts @@ -9,7 +9,6 @@ import { conferenceLeft, conferenceWillLeave, createConference - // @ts-ignore } from '../base/conference/actions'; import { CONFERENCE_LEAVE_REASONS } from '../base/conference/constants'; import { getCurrentConference } from '../base/conference/functions'; @@ -24,8 +23,7 @@ import { } from '../base/tracks'; // @ts-ignore import { createDesiredLocalTracks } from '../base/tracks/actions'; -// @ts-ignore -import { clearNotifications, showNotification } from '../notifications'; +import { clearNotifications, showNotification } from '../notifications/actions'; import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants'; import { _RESET_BREAKOUT_ROOMS, _UPDATE_ROOM_COUNTER } from './actionTypes'; @@ -224,7 +222,7 @@ export function moveToRoom(roomId?: string) { dispatch(clearNotifications()); // dispatch(setRoom(_roomId)); - dispatch(createConference(_roomId)); + dispatch(createConference(_roomId?.toString())); dispatch(setAudioMuted(audio.muted)); dispatch(setVideoMuted(Boolean(video.muted))); dispatch(createDesiredLocalTracks()); diff --git a/react/features/overlay/actions.js b/react/features/overlay/actions.ts similarity index 96% rename from react/features/overlay/actions.js rename to react/features/overlay/actions.ts index 32b4d70ecc..9122754760 100644 --- a/react/features/overlay/actions.js +++ b/react/features/overlay/actions.ts @@ -1,5 +1,3 @@ -// @flow - import { MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED, SET_FATAL_ERROR, @@ -39,7 +37,7 @@ export function mediaPermissionPromptVisibilityChanged(isVisible: boolean, brows * fatalError: ?Error * }} */ -export function setFatalError(fatalError: Object) { +export function setFatalError(fatalError?: Object) { return { type: SET_FATAL_ERROR, fatalError diff --git a/react/features/prejoin/actions.js b/react/features/prejoin/actions.ts similarity index 90% rename from react/features/prejoin/actions.js rename to react/features/prejoin/actions.ts index f28094d18b..b105c97171 100644 --- a/react/features/prejoin/actions.js +++ b/react/features/prejoin/actions.ts @@ -1,15 +1,16 @@ -// @flow - -declare var JitsiMeetJS: Object; -declare var APP: Object; - +/* eslint-disable lines-around-comment */ import { v4 as uuidv4 } from 'uuid'; -import { getDialOutStatusUrl, getDialOutUrl, updateConfig } from '../base/config'; +import { IStore } from '../app/types'; +import { updateConfig } from '../base/config/actions'; +// @ts-ignore +import { getDialOutStatusUrl, getDialOutUrl } from '../base/config/functions'; import { browser } from '../base/lib-jitsi-meet'; +// @ts-ignore import { createLocalTrack } from '../base/lib-jitsi-meet/functions'; -import { MEDIA_TYPE, isVideoMutedByUser } from '../base/media'; -import { updateSettings } from '../base/settings'; +import { MEDIA_TYPE } from '../base/media/constants'; +import { isVideoMutedByUser } from '../base/media/functions'; +import { updateSettings } from '../base/settings/actions'; import { createLocalTracksF, getLocalAudioTrack, @@ -17,10 +18,15 @@ import { getLocalVideoTrack, replaceLocalTrack, trackAdded + // @ts-ignore } from '../base/tracks'; +// @ts-ignore import { openURLInBrowser } from '../base/util'; +// @ts-ignore import { executeDialOutRequest, executeDialOutStatusRequest, getDialInfoPageURL } from '../invite/functions'; -import { NOTIFICATION_TIMEOUT_TYPE, showErrorNotification } from '../notifications'; +import { showErrorNotification } from '../notifications/actions'; +import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants'; +import { INotificationProps } from '../notifications/types'; import { PREJOIN_INITIALIZED, @@ -83,7 +89,7 @@ function pollForStatus( onSuccess: Function, onFail: Function, count = 0) { - return async function(dispatch: Function, getState: Function) { + return async function(dispatch: IStore['dispatch'], getState: IStore['getState']) { const state = getState(); try { @@ -96,7 +102,7 @@ function pollForStatus( switch (res) { case DIAL_OUT_STATUS.INITIATED: case DIAL_OUT_STATUS.RINGING: { - dispatch(setDialOutStatus(dialOutStatusToKeyMap[res])); + dispatch(setDialOutStatus(dialOutStatusToKeyMap[res as keyof typeof dialOutStatusToKeyMap])); if (count < STATUS_REQ_CAP) { return setTimeout(() => { @@ -149,7 +155,7 @@ function pollForStatus( * @returns {Function} */ export function dialOut(onSuccess: Function, onFail: Function) { - return async function(dispatch: Function, getState: Function) { + return async function(dispatch: IStore['dispatch'], getState: IStore['getState']) { const state = getState(); const reqId = uuidv4(); const url = getDialOutUrl(state); @@ -168,8 +174,8 @@ export function dialOut(onSuccess: Function, onFail: Function) { await executeDialOutRequest(url, body, reqId); dispatch(pollForStatus(reqId, onSuccess, onFail)); - } catch (err) { - const notification = { + } catch (err: any) { + const notification: INotificationProps = { titleKey: 'prejoin.errorDialOut', titleArguments: undefined }; @@ -199,7 +205,7 @@ export function dialOut(onSuccess: Function, onFail: Function) { * @returns {Function} */ export function initPrejoin(tracks: Object[], errors: Object) { - return async function(dispatch: Function) { + return async function(dispatch: IStore['dispatch']) { dispatch(setPrejoinDeviceErrors(errors)); dispatch(prejoinInitialized()); @@ -214,8 +220,8 @@ export function initPrejoin(tracks: Object[], errors: Object) { * @param {boolean} ignoreJoiningInProgress - If true we won't check the joiningInProgress flag. * @returns {Function} */ -export function joinConference(options?: Object, ignoreJoiningInProgress: boolean = false) { - return async function(dispatch: Function, getState: Function) { +export function joinConference(options?: Object, ignoreJoiningInProgress = false) { + return async function(dispatch: IStore['dispatch'], getState: IStore['getState']) { if (!ignoreJoiningInProgress) { const state = getState(); const { joiningInProgress } = state['features/prejoin']; @@ -251,7 +257,7 @@ export function joinConference(options?: Object, ignoreJoiningInProgress: boolea // anymore. localTracks = getLocalTracks(getState()['features/base/tracks']); - const jitsiTracks = localTracks.map(t => t.jitsiTrack); + const jitsiTracks = localTracks.map((t: any) => t.jitsiTrack); APP.conference.prejoinStart(jitsiTracks); }; @@ -278,7 +284,7 @@ export function setJoiningInProgress(value: boolean) { * @returns {Function} */ export function joinConferenceWithoutAudio() { - return async function(dispatch: Function, getState: Function) { + return async function(dispatch: IStore['dispatch'], getState: IStore['getState']) { const state = getState(); const { joiningInProgress } = state['features/prejoin']; @@ -329,7 +335,7 @@ export function makePrecallTest(conferenceOptions: Object) { * @returns {Function} */ export function openDialInPage() { - return function(dispatch: Function, getState: Function) { + return function(dispatch: IStore['dispatch'], getState: IStore['getState']) { const dialInPage = getDialInfoPageURL(getState()); openURLInBrowser(dialInPage, true); @@ -354,7 +360,7 @@ function prejoinInitialized() { * @returns {Function} */ export function replaceAudioTrackById(deviceId: string) { - return async (dispatch: Function, getState: Function) => { + return async (dispatch: IStore['dispatch'], getState: IStore['getState']) => { try { const tracks = getState()['features/base/tracks']; const newTrack = await createLocalTrack('audio', deviceId); @@ -381,7 +387,7 @@ export function replaceAudioTrackById(deviceId: string) { * @returns {Function} */ export function replaceVideoTrackById(deviceId: Object) { - return async (dispatch: Function, getState: Function) => { + return async (dispatch: IStore['dispatch'], getState: IStore['getState']) => { try { const tracks = getState()['features/base/tracks']; const wasVideoMuted = isVideoMutedByUser(getState()); diff --git a/react/features/prejoin/logger.js b/react/features/prejoin/logger.ts similarity index 91% rename from react/features/prejoin/logger.js rename to react/features/prejoin/logger.ts index 30e086c822..c7fc3cd1f4 100644 --- a/react/features/prejoin/logger.js +++ b/react/features/prejoin/logger.ts @@ -1,5 +1,3 @@ -// @flow - import { getLogger } from '../base/logging/functions'; export default getLogger('features/prejoin');