ref(TS) Convert some features to TS (#12651)

This commit is contained in:
Robert Pintilii 2022-12-14 14:23:07 +02:00 committed by GitHub
parent f5ac1b6271
commit aef5328aeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 243 additions and 242 deletions

1
globals.d.ts vendored
View File

@ -24,6 +24,7 @@ declare global {
JITSI_MEET_LITE_SDK?: boolean; JITSI_MEET_LITE_SDK?: boolean;
interfaceConfig?: any; interfaceConfig?: any;
JitsiMeetJS?: any; JitsiMeetJS?: any;
JitsiMeetElectron?: any;
} }
const config: IConfig; const config: IConfig;

View File

@ -46,6 +46,7 @@ export interface IJitsiConference {
avModerationApprove: Function; avModerationApprove: Function;
avModerationReject: Function; avModerationReject: Function;
createVideoSIPGWSession: Function; createVideoSIPGWSession: Function;
dial: Function;
disableAVModeration: Function; disableAVModeration: Function;
enableAVModeration: Function; enableAVModeration: Function;
end: Function; end: Function;
@ -74,6 +75,7 @@ export interface IJitsiConference {
myUserId: Function; myUserId: Function;
off: Function; off: Function;
on: Function; on: Function;
options: any;
removeTrack: Function; removeTrack: Function;
replaceTrack: Function; replaceTrack: Function;
room: IJitsiConferenceRoom; room: IJitsiConferenceRoom;

View File

@ -127,6 +127,7 @@ export interface IConfig {
preventExecution: boolean; preventExecution: boolean;
}>; }>;
callDisplayName?: string; callDisplayName?: string;
callFlowsEnabled?: boolean;
callStatsConfigParams?: { callStatsConfigParams?: {
additionalIDs?: { additionalIDs?: {
customerID?: string; customerID?: string;
@ -344,6 +345,8 @@ export interface IConfig {
iAmRecorder?: boolean; iAmRecorder?: boolean;
iAmSipGateway?: boolean; iAmSipGateway?: boolean;
inviteAppName?: string | null; inviteAppName?: string | null;
inviteServiceCallFlowsUrl?: string;
inviteServiceUrl?: string;
jaasActuatorUrl?: string; jaasActuatorUrl?: string;
jaasFeedbackMetadataURL?: string; jaasFeedbackMetadataURL?: string;
jaasTokenUrl?: string; jaasTokenUrl?: string;

View File

@ -1,5 +1,3 @@
// @flow
import { getLogger } from '../base/logging/functions'; import { getLogger } from '../base/logging/functions';
export default getLogger('features/chrome-banner'); export default getLogger('features/chrome-banner');

View File

@ -1,5 +1,6 @@
import { openDialog } from '../base/dialog'; import { openDialog } from '../base/dialog/actions';
// @ts-ignore
import { DesktopPicker } from './components'; import { DesktopPicker } from './components';
/** /**
@ -10,7 +11,7 @@ import { DesktopPicker } from './components';
* a DesktopCapturerSource has been chosen. * a DesktopCapturerSource has been chosen.
* @returns {Object} * @returns {Object}
*/ */
export function showDesktopPicker(options = {}, onSourceChoose) { export function showDesktopPicker(options: { desktopSharingSources?: any; } = {}, onSourceChoose: Function) {
const { desktopSharingSources } = options; const { desktopSharingSources } = options;
return openDialog(DesktopPicker, { return openDialog(DesktopPicker, {

View File

@ -1,4 +1,3 @@
import logger from './logger'; import logger from './logger';
/** /**
@ -11,8 +10,8 @@ import logger from './logger';
* return native image object used for the preview image of the source. * return native image object used for the preview image of the source.
* @returns {Function} * @returns {Function}
*/ */
export function obtainDesktopSources(types, options = {}) { export function obtainDesktopSources(types: string[], options: { thumbnailSize?: Object; } = {}) {
const capturerOptions = { const capturerOptions: any = {
types types
}; };
@ -23,10 +22,10 @@ export function obtainDesktopSources(types, options = {}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const { JitsiMeetElectron } = window; const { JitsiMeetElectron } = window;
if (JitsiMeetElectron && JitsiMeetElectron.obtainDesktopStreams) { if (JitsiMeetElectron?.obtainDesktopStreams) {
JitsiMeetElectron.obtainDesktopStreams( JitsiMeetElectron.obtainDesktopStreams(
sources => resolve(_separateSourcesByType(sources)), (sources: Array<{ id: string; }>) => resolve(_separateSourcesByType(sources)),
error => { (error: Error) => {
logger.error( logger.error(
`Error while obtaining desktop sources: ${error}`); `Error while obtaining desktop sources: ${error}`);
reject(error); reject(error);
@ -54,8 +53,8 @@ export function obtainDesktopSources(types, options = {}) {
* @returns {Object} An object with the sources split into separate arrays based * @returns {Object} An object with the sources split into separate arrays based
* on source type. * on source type.
*/ */
function _separateSourcesByType(sources = []) { function _separateSourcesByType(sources: Array<{ id: string; }> = []) {
const sourcesByType = { const sourcesByType: any = {
screen: [], screen: [],
window: [] window: []
}; };

View File

@ -1,5 +1,3 @@
// @flow
import { getLogger } from '../base/logging/functions'; import { getLogger } from '../base/logging/functions';
export default getLogger('features/desktop-picker'); export default getLogger('features/desktop-picker');

View File

@ -1,12 +1,10 @@
// @flow
/** /**
* Utility class with no dependencies. Used in components that are stripped in separate bundles * Utility class with no dependencies. Used in components that are stripped in separate bundles
* and requires as less dependencies as possible. * and requires as less dependencies as possible.
*/ */
import { getURLWithoutParams } from '../base/connection/utils'; import { getURLWithoutParams } from '../base/connection/utils';
import { doGetJSON } from '../base/util'; import { doGetJSON } from '../base/util/httpUtils';
/** /**
* Formats the conference pin in readable way for UI to display it. * Formats the conference pin in readable way for UI to display it.
@ -49,7 +47,7 @@ export function getDialInConferenceID(
roomName: string, roomName: string,
mucURL: string, mucURL: string,
url: URL url: URL
): Promise<Object> { ): Promise<any> {
const separator = baseUrl.includes('?') ? '&' : '?'; const separator = baseUrl.includes('?') ? '&' : '?';
const conferenceIDURL const conferenceIDURL
= `${baseUrl}${separator}conference=${roomName}@${mucURL}&url=${getURLWithoutParams(url).href}`; = `${baseUrl}${separator}conference=${roomName}@${mucURL}&url=${getURLWithoutParams(url).href}`;
@ -75,7 +73,7 @@ export function getDialInNumbers(
url: string, url: string,
roomName: string, roomName: string,
mucURL: string mucURL: string
): Promise<*> { ): Promise<any> {
const separator = url.includes('?') ? '&' : '?'; const separator = url.includes('?') ? '&' : '?';
// when roomName and mucURL are available // when roomName and mucURL are available

View File

@ -1,10 +1,7 @@
// @flow import { IStore } from '../app/types';
import { getInviteURL } from '../base/connection/functions';
import type { Dispatch } from 'redux'; import { getLocalParticipant, getParticipantCount } from '../base/participants/functions';
import { inviteVideoRooms } from '../videosipgw/actions';
import { getInviteURL } from '../base/connection';
import { getLocalParticipant, getParticipantCount } from '../base/participants';
import { inviteVideoRooms } from '../videosipgw';
import { getDialInConferenceID, getDialInNumbers } from './_utils'; import { getDialInConferenceID, getDialInNumbers } from './_utils';
import { import {
@ -22,6 +19,7 @@ import {
inviteSipEndpoints inviteSipEndpoints
} from './functions'; } from './functions';
import logger from './logger'; import logger from './logger';
import { IInvitee } from './types';
/** /**
* Creates a (redux) action to signal that a click/tap has been performed on * Creates a (redux) action to signal that a click/tap has been performed on
@ -64,11 +62,11 @@ export function hideAddPeopleDialog() {
* of invitees who were not invited (i.e. Invites were not sent to them). * of invitees who were not invited (i.e. Invites were not sent to them).
*/ */
export function invite( export function invite(
invitees: Array<Object>, invitees: IInvitee[],
showCalleeInfo: boolean = false) { showCalleeInfo = false) {
return ( return (
dispatch: Dispatch<any>, dispatch: IStore['dispatch'],
getState: Function): Promise<Array<Object>> => { getState: IStore['getState']): Promise<Array<Object>> => {
const state = getState(); const state = getState();
const participantsCount = getParticipantCount(state); const participantsCount = getParticipantCount(state);
const { calleeInfoVisible } = state['features/invite']; const { calleeInfoVisible } = state['features/invite'];
@ -89,12 +87,12 @@ export function invite(
return new Promise(resolve => { return new Promise(resolve => {
dispatch(addPendingInviteRequest({ dispatch(addPendingInviteRequest({
invitees, invitees,
callback: failedInvitees => resolve(failedInvitees) callback: (failedInvitees: any) => resolve(failedInvitees)
})); }));
}); });
} }
let allInvitePromises = []; let allInvitePromises: Promise<any>[] = [];
let invitesLeftToSend = [ ...invitees ]; let invitesLeftToSend = [ ...invitees ];
const { const {
@ -105,8 +103,8 @@ export function invite(
const inviteUrl = getInviteURL(state); const inviteUrl = getInviteURL(state);
const { sipInviteUrl } = state['features/base/config']; const { sipInviteUrl } = state['features/base/config'];
const { locationURL } = state['features/base/connection']; const { locationURL } = state['features/base/connection'];
const { jwt } = state['features/base/jwt']; const { jwt = '' } = state['features/base/jwt'];
const { name: displayName } = getLocalParticipant(state); const { name: displayName } = getLocalParticipant(state) ?? {};
// First create all promises for dialing out. // First create all promises for dialing out.
const phoneNumbers const phoneNumbers
@ -123,7 +121,7 @@ export function invite(
= invitesLeftToSend.filter( = invitesLeftToSend.filter(
invitee => invitee !== item); invitee => invitee !== item);
}) })
.catch(error => .catch((error: Error) =>
logger.error('Error inviting phone number:', error)); logger.error('Error inviting phone number:', error));
}); });
@ -138,8 +136,8 @@ export function invite(
// filter all rooms and users from {@link invitesLeftToSend}. // filter all rooms and users from {@link invitesLeftToSend}.
const peopleInvitePromise const peopleInvitePromise
= invitePeopleAndChatRooms( = invitePeopleAndChatRooms(
callFlowsEnabled (callFlowsEnabled
? inviteServiceCallFlowsUrl : inviteServiceUrl, ? inviteServiceCallFlowsUrl : inviteServiceUrl) ?? '',
inviteUrl, inviteUrl,
jwt, jwt,
usersAndRooms) usersAndRooms)
@ -173,6 +171,8 @@ export function invite(
conference && inviteSipEndpoints( conference && inviteSipEndpoints(
sipEndpoints, sipEndpoints,
// @ts-ignore
locationURL, locationURL,
sipInviteUrl, sipInviteUrl,
jwt, jwt,
@ -196,12 +196,12 @@ export function invite(
* @returns {Function} * @returns {Function}
*/ */
export function updateDialInNumbers() { export function updateDialInNumbers() {
return (dispatch: Dispatch<any>, getState: Function) => { return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
const state = getState(); const state = getState();
const { dialInConfCodeUrl, dialInNumbersUrl, hosts } const { dialInConfCodeUrl, dialInNumbersUrl, hosts }
= state['features/base/config']; = state['features/base/config'];
const { numbersFetched } = state['features/invite']; const { numbersFetched } = state['features/invite'];
const mucURL = hosts && hosts.muc; const mucURL = hosts?.muc;
if (numbersFetched || !dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) { if (numbersFetched || !dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) {
// URLs for fetching dial in numbers not defined // URLs for fetching dial in numbers not defined
@ -209,10 +209,10 @@ export function updateDialInNumbers() {
} }
const { locationURL = {} } = state['features/base/connection']; const { locationURL = {} } = state['features/base/connection'];
const { room } = state['features/base/conference']; const { room = '' } = state['features/base/conference'];
Promise.all([ Promise.all([
getDialInNumbers(dialInNumbersUrl, room, mucURL), getDialInNumbers(dialInNumbersUrl, room, mucURL), // @ts-ignore
getDialInConferenceID(dialInConfCodeUrl, room, mucURL, locationURL) getDialInConferenceID(dialInConfCodeUrl, room, mucURL, locationURL)
]) ])
.then(([ dialInNumbers, { conference, id, message, sipUri } ]) => { .then(([ dialInNumbers, { conference, id, message, sipUri } ]) => {
@ -251,7 +251,7 @@ export function updateDialInNumbers() {
*/ */
export function setCalleeInfoVisible( export function setCalleeInfoVisible(
calleeInfoVisible: boolean, calleeInfoVisible: boolean,
initialCalleeInfo: ?Object) { initialCalleeInfo?: Object) {
return { return {
type: SET_CALLEE_INFO_VISIBLE, type: SET_CALLEE_INFO_VISIBLE,
calleeInfoVisible, calleeInfoVisible,
@ -269,7 +269,7 @@ export function setCalleeInfoVisible(
* }} * }}
*/ */
export function addPendingInviteRequest( export function addPendingInviteRequest(
request: { invitees: Array<Object>, callback: Function }) { request: { callback: Function; invitees: Array<Object>; }) {
return { return {
type: ADD_PENDING_INVITE_REQUEST, type: ADD_PENDING_INVITE_REQUEST,
request request

View File

@ -1,11 +1,13 @@
// @flow /* eslint-disable lines-around-comment */
import { IStore } from '../app/types';
import type { Dispatch } from 'redux'; import { ADD_PEOPLE_ENABLED } from '../base/flags/constants';
import { getFeatureFlag } from '../base/flags/functions';
import { ADD_PEOPLE_ENABLED, getFeatureFlag } from '../base/flags'; // @ts-ignore
import { navigate } from '../mobile/navigation/components/conference/ConferenceNavigationContainerRef'; import { navigate } from '../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
// @ts-ignore
import { screen } from '../mobile/navigation/routes'; import { screen } from '../mobile/navigation/routes';
import { beginShareRoom } from '../share-room'; import { beginShareRoom } from '../share-room/actions';
/* eslint-enable lines-around-comment */
import { isAddPeopleEnabled, isDialOutEnabled } from './functions'; import { isAddPeopleEnabled, isDialOutEnabled } from './functions';
@ -18,7 +20,7 @@ export * from './actions.any';
* @returns {Function} * @returns {Function}
*/ */
export function doInvitePeople() { export function doInvitePeople() {
return (dispatch: Dispatch<any>, getState: Function) => { return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
const state = getState(); const state = getState();
const addPeopleEnabled = getFeatureFlag(state, ADD_PEOPLE_ENABLED, true) const addPeopleEnabled = getFeatureFlag(state, ADD_PEOPLE_ENABLED, true)
&& (isAddPeopleEnabled(state) || isDialOutEnabled(state)); && (isAddPeopleEnabled(state) || isDialOutEnabled(state));

View File

@ -205,7 +205,7 @@ function mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {
const addPeopleEnabled = isAddPeopleEnabled(state); const addPeopleEnabled = isAddPeopleEnabled(state);
const dialOutEnabled = isDialOutEnabled(state); const dialOutEnabled = isDialOutEnabled(state);
const hideInviteContacts = iAmRecorder || (!addPeopleEnabled && !dialOutEnabled); const hideInviteContacts = iAmRecorder || (!addPeopleEnabled && !dialOutEnabled);
const dialIn = state['features/invite']; const dialIn = state['features/invite']; // @ts-ignore
const phoneNumber = dialIn?.numbers ? _getDefaultPhoneNumber(dialIn.numbers) : undefined; const phoneNumber = dialIn?.numbers ? _getDefaultPhoneNumber(dialIn.numbers) : undefined;
return { return {

View File

@ -1,20 +1,17 @@
// @flow import { IReduxState } from '../app/types';
import { IStateful } from '../base/app/types';
import { getActiveSession } from '../../features/recording/functions'; import { getRoomName } from '../base/conference/functions';
import { getRoomName } from '../base/conference'; import { getInviteURL } from '../base/connection/functions';
import { getInviteURL } from '../base/connection';
import { isIosMobileBrowser } from '../base/environment/utils'; import { isIosMobileBrowser } from '../base/environment/utils';
import { i18next } from '../base/i18n'; import i18next from '../base/i18n/i18next';
import { isJwtFeatureEnabled } from '../base/jwt/functions'; import { isJwtFeatureEnabled } from '../base/jwt/functions';
import { JitsiRecordingConstants } from '../base/lib-jitsi-meet'; import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
import { getLocalParticipant, isLocalParticipantModerator } from '../base/participants'; import { getLocalParticipant, isLocalParticipantModerator } from '../base/participants/functions';
import { toState } from '../base/redux'; import { toState } from '../base/redux/functions';
import { import { parseURLParams } from '../base/util/parseURLParams';
appendURLParam, import { appendURLParam, parseURIString } from '../base/util/uri';
parseURIString,
parseURLParams
} from '../base/util';
import { isVpaasMeeting } from '../jaas/functions'; import { isVpaasMeeting } from '../jaas/functions';
import { getActiveSession } from '../recording/functions';
import { getDialInConferenceID, getDialInNumbers } from './_utils'; import { getDialInConferenceID, getDialInNumbers } from './_utils';
import { import {
@ -24,8 +21,7 @@ import {
} from './constants'; } from './constants';
import logger from './logger'; import logger from './logger';
declare var $: Function; declare let $: any;
declare var interfaceConfig: Object;
export const sharingFeatures = { export const sharingFeatures = {
email: 'email', email: 'email',
@ -44,7 +40,7 @@ export const sharingFeatures = {
export function checkDialNumber( export function checkDialNumber(
dialNumber: string, dialNumber: string,
dialOutAuthUrl: string dialOutAuthUrl: string
): Promise<Object> { ): Promise<{ allow?: boolean; country?: string; phone?: string; }> {
const fullUrl = `${dialOutAuthUrl}?phone=${dialNumber}`; const fullUrl = `${dialOutAuthUrl}?phone=${dialNumber}`;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -61,7 +57,7 @@ export function checkDialNumber(
* numbers. * numbers.
* @returns {string} A string with only numbers. * @returns {string} A string with only numbers.
*/ */
export function getDigitsOnly(text: string = ''): string { export function getDigitsOnly(text = ''): string {
return text.replace(/\D/g, ''); return text.replace(/\D/g, '');
} }
@ -70,41 +66,41 @@ export function getDigitsOnly(text: string = ''): string {
*/ */
export type GetInviteResultsOptions = { export type GetInviteResultsOptions = {
/**
* The endpoint to use for checking phone number validity.
*/
dialOutAuthUrl: string,
/** /**
* Whether or not to search for people. * Whether or not to search for people.
*/ */
addPeopleEnabled: boolean, addPeopleEnabled: boolean;
/**
* The endpoint to use for checking phone number validity.
*/
dialOutAuthUrl: string;
/** /**
* Whether or not to check phone numbers. * Whether or not to check phone numbers.
*/ */
dialOutEnabled: boolean, dialOutEnabled: boolean;
/**
* The jwt token to pass to the search service.
*/
jwt: string;
/** /**
* Array with the query types that will be executed - * Array with the query types that will be executed -
* "conferenceRooms" | "user" | "room". * "conferenceRooms" | "user" | "room".
*/ */
peopleSearchQueryTypes: Array<string>, peopleSearchQueryTypes: Array<string>;
/** /**
* The url to query for people. * The url to query for people.
*/ */
peopleSearchUrl: string, peopleSearchUrl: string;
/** /**
* Whether or not to check sip invites. * Whether or not to check sip invites.
*/ */
sipInviteEnabled: boolean, sipInviteEnabled: boolean;
/**
* The jwt token to pass to the search service.
*/
jwt: string
}; };
/** /**
@ -118,8 +114,7 @@ export type GetInviteResultsOptions = {
export function getInviteResultsForQuery( export function getInviteResultsForQuery(
query: string, query: string,
options: GetInviteResultsOptions options: GetInviteResultsOptions
): Promise<*> { ): Promise<any> {
const text = query.trim(); const text = query.trim();
const { const {
@ -183,12 +178,12 @@ export function getInviteResultsForQuery(
phone: text phone: text
}); });
} else { } else {
phoneNumberPromise = Promise.resolve({}); phoneNumberPromise = Promise.resolve<{ allow?: boolean; country?: string; phone?: string; }>({});
} }
return Promise.all([ peopleSearchPromise, phoneNumberPromise ]) return Promise.all([ peopleSearchPromise, phoneNumberPromise ])
.then(([ peopleResults, phoneResults ]) => { .then(([ peopleResults, phoneResults ]) => {
const results = [ const results: any[] = [
...peopleResults ...peopleResults
]; ];
@ -233,7 +228,7 @@ export function getInviteTextiOS({
state, state,
phoneNumber, phoneNumber,
t t
}: Object) { }: { phoneNumber?: string | null; state: IReduxState; t?: Function; }) {
if (!isIosMobileBrowser()) { if (!isIosMobileBrowser()) {
return ''; return '';
} }
@ -246,23 +241,23 @@ export function getInviteTextiOS({
const inviteURL = _decodeRoomURI(inviteUrl); const inviteURL = _decodeRoomURI(inviteUrl);
let invite = localParticipantName let invite = localParticipantName
? t('info.inviteTextiOSPersonal', { name: localParticipantName }) ? t?.('info.inviteTextiOSPersonal', { name: localParticipantName })
: t('info.inviteURLFirstPartGeneral'); : t?.('info.inviteURLFirstPartGeneral');
invite += ' '; invite += ' ';
invite += t('info.inviteTextiOSInviteUrl', { inviteUrl }); invite += t?.('info.inviteTextiOSInviteUrl', { inviteUrl });
invite += ' '; invite += ' ';
if (shouldDisplayDialIn(dialIn) && isSharingEnabled(sharingFeatures.dialIn)) { if (shouldDisplayDialIn(dialIn) && isSharingEnabled(sharingFeatures.dialIn)) {
invite += t('info.inviteTextiOSPhone', { invite += t?.('info.inviteTextiOSPhone', {
number: phoneNumber, number: phoneNumber,
conferenceID: dialIn.conferenceID, conferenceID: dialIn.conferenceID,
didUrl: getDialInfoPageURL(state) didUrl: getDialInfoPageURL(state)
}); });
} }
invite += ' '; invite += ' ';
invite += t('info.inviteTextiOSJoinSilent', { silentUrl: `${inviteURL}#config.startSilent=true` }); invite += t?.('info.inviteTextiOSJoinSilent', { silentUrl: `${inviteURL}#config.startSilent=true` });
return invite; return invite;
} }
@ -276,27 +271,25 @@ export function getInviteText({
state, state,
phoneNumber, phoneNumber,
t t
}: Object) { }: { phoneNumber?: string | null; state: IReduxState; t?: Function; }) {
const dialIn = state['features/invite']; const dialIn = state['features/invite'];
const inviteUrl = getInviteURL(state); const inviteUrl = getInviteURL(state);
const currentLiveStreamingSession = getActiveSession(state, JitsiRecordingConstants.mode.STREAM); const currentLiveStreamingSession = getActiveSession(state, JitsiRecordingConstants.mode.STREAM);
const liveStreamViewURL const liveStreamViewURL = currentLiveStreamingSession?.liveStreamViewURL;
= currentLiveStreamingSession
&& currentLiveStreamingSession.liveStreamViewURL;
const localParticipant = getLocalParticipant(state); const localParticipant = getLocalParticipant(state);
const localParticipantName = localParticipant?.name; const localParticipantName = localParticipant?.name;
const inviteURL = _decodeRoomURI(inviteUrl); const inviteURL = _decodeRoomURI(inviteUrl);
let invite = localParticipantName let invite = localParticipantName
? t('info.inviteURLFirstPartPersonal', { name: localParticipantName }) ? t?.('info.inviteURLFirstPartPersonal', { name: localParticipantName })
: t('info.inviteURLFirstPartGeneral'); : t?.('info.inviteURLFirstPartGeneral');
invite += t('info.inviteURLSecondPart', { invite += t?.('info.inviteURLSecondPart', {
url: inviteURL url: inviteURL
}); });
if (liveStreamViewURL) { if (liveStreamViewURL) {
const liveStream = t('info.inviteLiveStream', { const liveStream = t?.('info.inviteLiveStream', {
url: liveStreamViewURL url: liveStreamViewURL
}); });
@ -304,11 +297,11 @@ export function getInviteText({
} }
if (shouldDisplayDialIn(dialIn) && isSharingEnabled(sharingFeatures.dialIn)) { if (shouldDisplayDialIn(dialIn) && isSharingEnabled(sharingFeatures.dialIn)) {
const dial = t('info.invitePhone', { const dial = t?.('info.invitePhone', {
number: phoneNumber, number: phoneNumber,
conferenceID: dialIn.conferenceID conferenceID: dialIn.conferenceID
}); });
const moreNumbers = t('info.invitePhoneAlternatives', { const moreNumbers = t?.('info.invitePhoneAlternatives', {
url: getDialInfoPageURL(state), url: getDialInfoPageURL(state),
silentUrl: `${inviteURL}#config.startSilent=true` silentUrl: `${inviteURL}#config.startSilent=true`
}); });
@ -328,8 +321,8 @@ export function getInviteText({
* @returns {Object} An object with keys as user types and values as the number * @returns {Object} An object with keys as user types and values as the number
* of invites for that type. * of invites for that type.
*/ */
export function getInviteTypeCounts(inviteItems: Array<Object> = []) { export function getInviteTypeCounts(inviteItems: Array<{ type: string; }> = []) {
const inviteTypeCounts = {}; const inviteTypeCounts: any = {};
inviteItems.forEach(({ type }) => { inviteItems.forEach(({ type }) => {
if (!inviteTypeCounts[type]) { if (!inviteTypeCounts[type]) {
@ -352,51 +345,51 @@ export function getInviteTypeCounts(inviteItems: Array<Object> = []) {
* items to invite. * items to invite.
* @returns {Promise} - The promise created by the request. * @returns {Promise} - The promise created by the request.
*/ */
export function invitePeopleAndChatRooms( // eslint-disable-line max-params export function invitePeopleAndChatRooms(
inviteServiceUrl: string, inviteServiceUrl: string,
inviteUrl: string, inviteUrl: string,
jwt: string, jwt: string,
inviteItems: Array<Object> inviteItems: Array<Object>
): Promise<void> { ): Promise<any> {
if (!inviteItems || inviteItems.length === 0) { if (!inviteItems || inviteItems.length === 0) {
return Promise.resolve(); return Promise.resolve();
} }
return fetch( return fetch(
`${inviteServiceUrl}?token=${jwt}`, `${inviteServiceUrl}?token=${jwt}`,
{ {
body: JSON.stringify({ body: JSON.stringify({
'invited': inviteItems, 'invited': inviteItems,
'url': inviteUrl 'url': inviteUrl
}), }),
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
} }
); );
} }
/** /**
* Determines if adding people is currently enabled. * Determines if adding people is currently enabled.
* *
* @param {boolean} state - Current state. * @param {IReduxState} state - Current state.
* @returns {boolean} Indication of whether adding people is currently enabled. * @returns {boolean} Indication of whether adding people is currently enabled.
*/ */
export function isAddPeopleEnabled(state: Object): boolean { export function isAddPeopleEnabled(state: IReduxState): boolean {
const { peopleSearchUrl } = state['features/base/config']; const { peopleSearchUrl } = state['features/base/config'];
return state['features/base/jwt'].jwt && Boolean(peopleSearchUrl) && !isVpaasMeeting(state); return Boolean(state['features/base/jwt'].jwt && Boolean(peopleSearchUrl) && !isVpaasMeeting(state));
} }
/** /**
* Determines if dial out is currently enabled or not. * Determines if dial out is currently enabled or not.
* *
* @param {boolean} state - Current state. * @param {IReduxState} state - Current state.
* @returns {boolean} Indication of whether dial out is currently enabled. * @returns {boolean} Indication of whether dial out is currently enabled.
*/ */
export function isDialOutEnabled(state: Object): boolean { export function isDialOutEnabled(state: IReduxState): boolean {
const { conference } = state['features/base/conference']; const { conference } = state['features/base/conference'];
return isLocalParticipantModerator(state) return isLocalParticipantModerator(state)
@ -406,10 +399,10 @@ export function isDialOutEnabled(state: Object): boolean {
/** /**
* Determines if inviting sip endpoints is enabled or not. * Determines if inviting sip endpoints is enabled or not.
* *
* @param {Object} state - Current state. * @param {IReduxState} state - Current state.
* @returns {boolean} Indication of whether dial out is currently enabled. * @returns {boolean} Indication of whether dial out is currently enabled.
*/ */
export function isSipInviteEnabled(state: Object): boolean { export function isSipInviteEnabled(state: IReduxState): boolean {
const { sipInviteUrl } = state['features/base/config']; const { sipInviteUrl } = state['features/base/config'];
return isJwtFeatureEnabled(state, 'sip-outbound-call') && Boolean(sipInviteUrl); return isJwtFeatureEnabled(state, 'sip-outbound-call') && Boolean(sipInviteUrl);
@ -473,7 +466,7 @@ export function searchDirectory( // eslint-disable-line max-params
jwt: string, jwt: string,
text: string, text: string,
queryTypes: Array<string> = [ 'conferenceRooms', 'user', 'room' ] queryTypes: Array<string> = [ 'conferenceRooms', 'user', 'room' ]
): Promise<Array<Object>> { ): Promise<Array<{ type: string; }>> {
const query = encodeURIComponent(text); const query = encodeURIComponent(text);
const queryTypesString = encodeURIComponent(JSON.stringify(queryTypes)); const queryTypesString = encodeURIComponent(JSON.stringify(queryTypes));
@ -502,14 +495,13 @@ export function searchDirectory( // eslint-disable-line max-params
* Returns descriptive text that can be used to invite participants to a meeting * Returns descriptive text that can be used to invite participants to a meeting
* (share via mobile or use it for calendar event description). * (share via mobile or use it for calendar event description).
* *
* @param {Object} state - The current state. * @param {IReduxState} state - The current state.
* @param {string} inviteUrl - The conference/location URL. * @param {string} inviteUrl - The conference/location URL.
* @param {boolean} useHtml - Whether to return html text. * @param {boolean} useHtml - Whether to return html text.
* @returns {Promise<string>} A {@code Promise} resolving with a * @returns {Promise<string>} A {@code Promise} resolving with a
* descriptive text that can be used to invite participants to a meeting. * descriptive text that can be used to invite participants to a meeting.
*/ */
export function getShareInfoText( export function getShareInfoText(state: IReduxState, inviteUrl: string, useHtml?: boolean): Promise<string> {
state: Object, inviteUrl: string, useHtml: ?boolean): Promise<string> {
let roomUrl = _decodeRoomURI(inviteUrl); let roomUrl = _decodeRoomURI(inviteUrl);
const includeDialInfo = state['features/base/config'] !== undefined; const includeDialInfo = state['features/base/config'] !== undefined;
@ -534,7 +526,7 @@ export function getShareInfoText(
const { dialInConfCodeUrl, dialInNumbersUrl, hosts } const { dialInConfCodeUrl, dialInNumbersUrl, hosts }
= state['features/base/config']; = state['features/base/config'];
const { locationURL = {} } = state['features/base/connection']; const { locationURL = {} } = state['features/base/connection'];
const mucURL = hosts && hosts.muc; const mucURL = hosts?.muc;
if (!dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) { if (!dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) {
// URLs for fetching dial in numbers not defined // URLs for fetching dial in numbers not defined
@ -542,7 +534,7 @@ export function getShareInfoText(
} }
numbersPromise = Promise.all([ numbersPromise = Promise.all([
getDialInNumbers(dialInNumbersUrl, room, mucURL), getDialInNumbers(dialInNumbersUrl, room, mucURL), // @ts-ignore
getDialInConferenceID(dialInConfCodeUrl, room, mucURL, locationURL) getDialInConferenceID(dialInConfCodeUrl, room, mucURL, locationURL)
]).then(([ numbers, { ]).then(([ numbers, {
conference, id, message } ]) => { conference, id, message } ]) => {
@ -592,16 +584,16 @@ export function getShareInfoText(
/** /**
* Generates the URL for the static dial in info page. * Generates the URL for the static dial in info page.
* *
* @param {Object} state - The state from the Redux store. * @param {IReduxState} state - The state from the Redux store.
* @param {string?} roomName - The conference name. Optional name, if missing will be extracted from state. * @param {string?} roomName - The conference name. Optional name, if missing will be extracted from state.
* @returns {string} * @returns {string}
*/ */
export function getDialInfoPageURL(state: Object, roomName: ?string) { export function getDialInfoPageURL(state: IReduxState, roomName?: string) {
const { didPageUrl } = state['features/dynamic-branding']; const { didPageUrl } = state['features/dynamic-branding'];
const conferenceName = roomName ?? getRoomName(state); const conferenceName = roomName ?? getRoomName(state);
const { locationURL } = state['features/base/connection']; const { locationURL } = state['features/base/connection'];
const { href } = locationURL; const { href = '' } = locationURL ?? {};
const room = _decodeRoomURI(conferenceName); const room = _decodeRoomURI(conferenceName ?? '');
const url = didPageUrl || `${href.substring(0, href.lastIndexOf('/'))}/${DIAL_IN_INFO_PAGE_PATH_NAME}`; const url = didPageUrl || `${href.substring(0, href.lastIndexOf('/'))}/${DIAL_IN_INFO_PAGE_PATH_NAME}`;
@ -615,7 +607,7 @@ export function getDialInfoPageURL(state: Object, roomName: ?string) {
* @returns {string} * @returns {string}
*/ */
export function getDialInfoPageURLForURIString( export function getDialInfoPageURLForURIString(
uri: ?string) { uri?: string) {
if (!uri) { if (!uri) {
return undefined; return undefined;
} }
@ -637,7 +629,7 @@ export function getDialInfoPageURLForURIString(
* @param {Object} dialIn - Dial in information. * @param {Object} dialIn - Dial in information.
* @returns {boolean} * @returns {boolean}
*/ */
export function shouldDisplayDialIn(dialIn: Object) { export function shouldDisplayDialIn(dialIn: any) {
const { conferenceID, numbers, numbersEnabled } = dialIn; const { conferenceID, numbers, numbersEnabled } = dialIn;
const phoneNumber = _getDefaultPhoneNumber(numbers); const phoneNumber = _getDefaultPhoneNumber(numbers);
@ -656,7 +648,7 @@ export function shouldDisplayDialIn(dialIn: Object) {
* @private * @private
* @returns {boolean} * @returns {boolean}
*/ */
export function hasMultipleNumbers(dialInNumbers: ?Object) { export function hasMultipleNumbers(dialInNumbers?: { numbers: Object; } | string[]) {
if (!dialInNumbers) { if (!dialInNumbers) {
return false; return false;
} }
@ -682,7 +674,7 @@ export function hasMultipleNumbers(dialInNumbers: ?Object) {
* @returns {string|null} * @returns {string|null}
*/ */
export function _getDefaultPhoneNumber( export function _getDefaultPhoneNumber(
dialInNumbers: ?Object): ?string { dialInNumbers?: { numbers: any; } | Array<{ default: string; formattedNumber: string; }>): string | null {
if (!dialInNumbers) { if (!dialInNumbers) {
return null; return null;
@ -743,22 +735,23 @@ export function _decodeRoomURI(url: string) {
/** /**
* Returns the stored conference id. * Returns the stored conference id.
* *
* @param {Object | Function} stateful - The Object or Function that can be * @param {IStateful} stateful - The Object or Function that can be
* resolved to a Redux state object with the toState function. * resolved to a Redux state object with the toState function.
* @returns {string} * @returns {string}
*/ */
export function getConferenceId(stateful: Object | Function) { export function getConferenceId(stateful: IStateful) {
return toState(stateful)['features/invite'].conferenceID; return toState(stateful)['features/invite'].conferenceID;
} }
/** /**
* Returns the default dial in number from the store. * Returns the default dial in number from the store.
* *
* @param {Object | Function} stateful - The Object or Function that can be * @param {IStateful} stateful - The Object or Function that can be
* resolved to a Redux state object with the toState function. * resolved to a Redux state object with the toState function.
* @returns {string | null} * @returns {string | null}
*/ */
export function getDefaultDialInNumber(stateful: Object | Function) { export function getDefaultDialInNumber(stateful: IStateful) {
// @ts-ignore
return _getDefaultPhoneNumber(toState(stateful)['features/invite'].numbers); return _getDefaultPhoneNumber(toState(stateful)['features/invite'].numbers);
} }
@ -831,14 +824,14 @@ export function isSharingEnabled(sharingFeature: string) {
* @returns {Promise} - The promise created by the request. * @returns {Promise} - The promise created by the request.
*/ */
export function inviteSipEndpoints( // eslint-disable-line max-params export function inviteSipEndpoints( // eslint-disable-line max-params
inviteItems: Array<Object>, inviteItems: Array<{ address: string; }>,
locationURL: URL, locationURL: URL,
sipInviteUrl: string, sipInviteUrl: string,
jwt: string, jwt: string,
roomName: string, roomName: string,
roomPassword: String, roomPassword: String,
displayName: string displayName: string
): Promise<void> { ): Promise<any> {
if (inviteItems.length === 0) { if (inviteItems.length === 0) {
return Promise.resolve(); return Promise.resolve();
} }
@ -851,26 +844,26 @@ export function inviteSipEndpoints( // eslint-disable-line max-params
}); });
return fetch( return fetch(
sipInviteUrl, sipInviteUrl,
{ {
body: JSON.stringify({ body: JSON.stringify({
callParams: { callParams: {
callUrlInfo: { callUrlInfo: {
baseUrl, baseUrl,
callName: roomName callName: roomName
}, },
passcode: roomPassword passcode: roomPassword
}, },
sipClientParams: { sipClientParams: {
displayName, displayName,
sipAddress: inviteItems.map(item => item.address) sipAddress: inviteItems.map(item => item.address)
} }
}), }),
method: 'POST', method: 'POST',
headers: { headers: {
'Authorization': `Bearer ${jwt}`, 'Authorization': `Bearer ${jwt}`,
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
} }
); );
} }

View File

@ -1,27 +1,28 @@
// @flow import { AnyAction } from 'redux';
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app'; import { IStore } from '../app/types';
import { import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app/actionTypes';
CONFERENCE_JOINED import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
} from '../base/conference';
import { import {
PARTICIPANT_JOINED, PARTICIPANT_JOINED,
PARTICIPANT_JOINED_SOUND_ID,
PARTICIPANT_LEFT, PARTICIPANT_LEFT,
PARTICIPANT_UPDATED, PARTICIPANT_UPDATED
} from '../base/participants/actionTypes';
import { pinParticipant } from '../base/participants/actions';
import { PARTICIPANT_JOINED_SOUND_ID } from '../base/participants/constants';
import {
getLocalParticipant, getLocalParticipant,
getParticipantCount, getParticipantCount,
getParticipantPresenceStatus, getParticipantPresenceStatus,
getRemoteParticipants, getRemoteParticipants
pinParticipant } from '../base/participants/functions';
} from '../base/participants'; import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { MiddlewareRegistry } from '../base/redux';
import { import {
playSound, playSound,
registerSound, registerSound,
stopSound, stopSound,
unregisterSound unregisterSound
} from '../base/sounds'; } from '../base/sounds/actions';
import { import {
CALLING, CALLING,
CONNECTED_USER, CONNECTED_USER,
@ -29,7 +30,7 @@ import {
INVITED, INVITED,
REJECTED, REJECTED,
RINGING RINGING
} from '../presence-status'; } from '../presence-status/constants';
import { import {
SET_CALLEE_INFO_VISIBLE, SET_CALLEE_INFO_VISIBLE,
@ -49,8 +50,6 @@ import {
import logger from './logger'; import logger from './logger';
import { sounds } from './sounds'; import { sounds } from './sounds';
declare var interfaceConfig: Object;
/** /**
* Maps the presence status with the ID of the sound that will be played when * Maps the presence status with the ID of the sound that will be played when
* the status is received. * the status is received.
@ -84,7 +83,7 @@ MiddlewareRegistry.register(store => next => action => {
if (action.type === SET_CALLEE_INFO_VISIBLE) { if (action.type === SET_CALLEE_INFO_VISIBLE) {
if (action.calleeInfoVisible) { if (action.calleeInfoVisible) {
dispatch(pinParticipant(getLocalParticipant(state).id)); dispatch(pinParticipant(getLocalParticipant(state)?.id));
} else { } else {
// unpin participant // unpin participant
dispatch(pinParticipant()); dispatch(pinParticipant());
@ -124,10 +123,10 @@ MiddlewareRegistry.register(store => next => action => {
const oldSoundId const oldSoundId
= oldParticipantPresence = oldParticipantPresence
&& statusToRingtone[oldParticipantPresence]; && statusToRingtone[oldParticipantPresence as keyof typeof statusToRingtone];
const newSoundId const newSoundId
= newParticipantPresence = newParticipantPresence
&& statusToRingtone[newParticipantPresence]; && statusToRingtone[newParticipantPresence as keyof typeof statusToRingtone];
if (oldSoundId === newSoundId) { if (oldSoundId === newSoundId) {
@ -159,10 +158,10 @@ MiddlewareRegistry.register(store => next => action => {
* (not poltergeist, shared video, etc.) participants in the call. * (not poltergeist, shared video, etc.) participants in the call.
* *
* @param {Object} action - The redux action. * @param {Object} action - The redux action.
* @param {ReduxStore} store - The redux store. * @param {IStore} store - The redux store.
* @returns {void} * @returns {void}
*/ */
function _maybeHideCalleeInfo(action, store) { function _maybeHideCalleeInfo(action: AnyAction, store: IStore) {
const state = store.getState(); const state = store.getState();
if (!state['features/invite'].calleeInfoVisible) { if (!state['features/invite'].calleeInfoVisible) {
@ -188,10 +187,10 @@ function _maybeHideCalleeInfo(action, store) {
/** /**
* Executes the pending invitation requests if any. * Executes the pending invitation requests if any.
* *
* @param {ReduxStore} store - The redux store. * @param {IStore} store - The redux store.
* @returns {void} * @returns {void}
*/ */
function _onConferenceJoined(store) { function _onConferenceJoined(store: IStore) {
const { dispatch, getState } = store; const { dispatch, getState } = store;
const pendingInviteRequests const pendingInviteRequests

View File

@ -1,10 +1,11 @@
// @flow import { AnyAction } from 'redux';
import { hideDialog, openDialog } from '../base/dialog'; import { IStore } from '../app/types';
import { MiddlewareRegistry } from '../base/redux'; import { hideDialog, openDialog } from '../base/dialog/actions';
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { BEGIN_ADD_PEOPLE, HIDE_ADD_PEOPLE_DIALOG } from './actionTypes'; import { BEGIN_ADD_PEOPLE, HIDE_ADD_PEOPLE_DIALOG } from './actionTypes';
import { AddPeopleDialog } from './components'; import AddPeopleDialog from './components/add-people-dialog/web/AddPeopleDialog';
import './middleware.any'; import './middleware.any';
/** /**
@ -37,7 +38,7 @@ MiddlewareRegistry.register(store => next => action => {
* @private * @private
* @returns {*} The value returned by {@code next(action)}. * @returns {*} The value returned by {@code next(action)}.
*/ */
function _beginAddPeople({ dispatch }, next, action) { function _beginAddPeople({ dispatch }: IStore, next: Function, action: AnyAction) {
const result = next(action); const result = next(action);
dispatch(openDialog(AddPeopleDialog)); dispatch(openDialog(AddPeopleDialog));
@ -58,7 +59,7 @@ function _beginAddPeople({ dispatch }, next, action) {
* @private * @private
* @returns {*} The value returned by {@code next(action)}. * @returns {*} The value returned by {@code next(action)}.
*/ */
function _hideAddPeopleDialog({ dispatch }, next, action) { function _hideAddPeopleDialog({ dispatch }: IStore, next: Function, action: AnyAction) {
dispatch(hideDialog(AddPeopleDialog)); dispatch(hideDialog(AddPeopleDialog));
return next(action); return next(action);

View File

@ -8,6 +8,7 @@ import {
UPDATE_DIAL_IN_NUMBERS_SUCCESS UPDATE_DIAL_IN_NUMBERS_SUCCESS
} from './actionTypes'; } from './actionTypes';
import logger from './logger'; import logger from './logger';
import { IInvitee } from './types';
const DEFAULT_STATE = { const DEFAULT_STATE = {
/** /**
@ -27,12 +28,12 @@ export interface IInviteState {
conferenceID?: string | number; conferenceID?: string | number;
error?: Error; error?: Error;
initialCalleeInfo?: Object; initialCalleeInfo?: Object;
numbers?: string; numbers?: string[];
numbersEnabled: boolean; numbersEnabled: boolean;
numbersFetched: boolean; numbersFetched: boolean;
pendingInviteRequests: Array<{ pendingInviteRequests: Array<{
callback: Function; callback: Function;
invitees: Array<Object>; invitees: IInvitee[];
}>; }>;
sipUri?: string; sipUri?: string;
} }

View File

@ -0,0 +1,5 @@
export interface IInvitee {
address: string;
number: string;
type: string;
}

View File

@ -92,7 +92,7 @@ function pollForStatus(
return; return;
} }
const res = await executeDialOutStatusRequest(getDialOutStatusUrl(state), reqId); const res = await executeDialOutStatusRequest(getDialOutStatusUrl(state) ?? '', reqId);
switch (res) { switch (res) {
case DIAL_OUT_STATUS.INITIATED: case DIAL_OUT_STATUS.INITIATED:
@ -153,7 +153,7 @@ export function dialOut(onSuccess: Function, onFail: Function) {
return async function(dispatch: IStore['dispatch'], getState: IStore['getState']) { return async function(dispatch: IStore['dispatch'], getState: IStore['getState']) {
const state = getState(); const state = getState();
const reqId = uuidv4(); const reqId = uuidv4();
const url = getDialOutUrl(state); const url = getDialOutUrl(state) ?? '';
const conferenceUrl = getDialOutConferenceUrl(state); const conferenceUrl = getDialOutConferenceUrl(state);
const phoneNumber = getFullDialOutNumber(state); const phoneNumber = getFullDialOutNumber(state);
const countryCode = getDialOutCountry(state).code.toUpperCase(); const countryCode = getDialOutCountry(state).code.toUpperCase();

View File

@ -1,5 +1,3 @@
// @flow
import { import {
DELETE_RECENT_LIST_ENTRY, DELETE_RECENT_LIST_ENTRY,
_STORE_CURRENT_CONFERENCE, _STORE_CURRENT_CONFERENCE,

View File

@ -1,9 +1,13 @@
import { import {
getLocalizedDateFormatter, getLocalizedDateFormatter,
getLocalizedDurationFormatter getLocalizedDurationFormatter
} from '../base/i18n'; } from '../base/i18n/dateUtil';
// eslint-disable-next-line lines-around-comment
// @ts-ignore
import { NavigateSectionList } from '../base/react'; import { NavigateSectionList } from '../base/react';
import { parseURIString, safeDecodeURIComponent } from '../base/util'; import { parseURIString, safeDecodeURIComponent } from '../base/util/uri';
import { IRecentItem } from './types';
/** /**
* Creates a displayable list item of a recent list entry. * Creates a displayable list item of a recent list entry.
@ -14,7 +18,8 @@ import { parseURIString, safeDecodeURIComponent } from '../base/util';
* @param {Function} t - The translate function. * @param {Function} t - The translate function.
* @returns {Object} * @returns {Object}
*/ */
function toDisplayableItem(item, defaultServerURL, t) { function toDisplayableItem(item: IRecentItem,
defaultServerURL: string, t: Function) {
const location = parseURIString(item.conference); const location = parseURIString(item.conference);
const baseURL = `${location.protocol}//${location.host}`; const baseURL = `${location.protocol}//${location.host}`;
const serverName = baseURL === defaultServerURL ? null : location.host; const serverName = baseURL === defaultServerURL ? null : location.host;
@ -43,7 +48,7 @@ function toDisplayableItem(item, defaultServerURL, t) {
* @param {number} duration - The item's duration. * @param {number} duration - The item's duration.
* @returns {string} * @returns {string}
*/ */
function _toDurationString(duration) { function _toDurationString(duration: number) {
if (duration) { if (duration) {
return getLocalizedDurationFormatter(duration); return getLocalizedDurationFormatter(duration);
} }
@ -59,7 +64,7 @@ function _toDurationString(duration) {
* @param {Function} t - The translate function. * @param {Function} t - The translate function.
* @returns {string} * @returns {string}
*/ */
function _toDateString(itemDate, t) { function _toDateString(itemDate: number, t: Function) {
const m = getLocalizedDateFormatter(itemDate); const m = getLocalizedDateFormatter(itemDate);
const date = new Date(itemDate); const date = new Date(itemDate);
const dateInMs = date.getTime(); const dateInMs = date.getTime();
@ -90,7 +95,8 @@ function _toDateString(itemDate, t) {
* @param {string} defaultServerURL - The default server URL. * @param {string} defaultServerURL - The default server URL.
* @returns {Array<Object>} * @returns {Array<Object>}
*/ */
export function toDisplayableList(recentList, t, defaultServerURL) { export function toDisplayableList(recentList: IRecentItem[],
t: Function, defaultServerURL: string) {
const { createSection } = NavigateSectionList; const { createSection } = NavigateSectionList;
const todaySection = createSection(t('dateUtils.today'), 'today'); const todaySection = createSection(t('dateUtils.today'), 'today');
const yesterdaySection const yesterdaySection

View File

@ -1,6 +1,4 @@
/* global interfaceConfig */ import { parseURIString, safeDecodeURIComponent } from '../base/util/uri';
import { parseURIString, safeDecodeURIComponent } from '../base/util';
/** /**
@ -10,7 +8,7 @@ import { parseURIString, safeDecodeURIComponent } from '../base/util';
* @param {Array<Object>} recentList - The recent list form the redux store. * @param {Array<Object>} recentList - The recent list form the redux store.
* @returns {Array<Object>} * @returns {Array<Object>}
*/ */
export function toDisplayableList(recentList) { export function toDisplayableList(recentList: Array<{ conference: string; date: Date; duration: number; }>) {
return ( return (
[ ...recentList ].reverse() [ ...recentList ].reverse()
.map(item => { .map(item => {

View File

@ -1,5 +1,3 @@
// @flow
import { getLogger } from '../base/logging/functions'; import { getLogger } from '../base/logging/functions';
export default getLogger('features/recent-list'); export default getLogger('features/recent-list');

View File

@ -1,21 +1,17 @@
// @flow import { AnyAction } from 'redux';
import { APP_WILL_MOUNT } from '../base/app'; import { IStore } from '../app/types';
import { import { APP_WILL_MOUNT } from '../base/app/actionTypes';
CONFERENCE_WILL_LEAVE, import { CONFERENCE_WILL_LEAVE, SET_ROOM } from '../base/conference/actionTypes';
JITSI_CONFERENCE_URL_KEY, import { JITSI_CONFERENCE_URL_KEY } from '../base/conference/constants';
SET_ROOM import { addKnownDomains } from '../base/known-domains/actions';
} from '../base/conference'; import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { addKnownDomains } from '../base/known-domains';
import { MiddlewareRegistry } from '../base/redux';
import { parseURIString } from '../base/util';
import { inIframe } from '../base/util/iframeUtils'; import { inIframe } from '../base/util/iframeUtils';
import { parseURIString } from '../base/util/uri';
import { _storeCurrentConference, _updateConferenceDuration } from './actions'; import { _storeCurrentConference, _updateConferenceDuration } from './actions';
import { isRecentListEnabled } from './functions'; import { isRecentListEnabled } from './functions';
declare var APP: Object;
/** /**
* Middleware that captures joined rooms so they can be saved into * Middleware that captures joined rooms so they can be saved into
* {@code window.localStorage}. * {@code window.localStorage}.
@ -53,7 +49,7 @@ MiddlewareRegistry.register(store => next => action => {
* @private * @private
* @returns {*} The result returned by {@code next(action)}. * @returns {*} The result returned by {@code next(action)}.
*/ */
function _appWillMount({ dispatch, getState }, next, action) { function _appWillMount({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
const result = next(action); const result = next(action);
// It's an opportune time to transfer the feature recent-list's knowledge // It's an opportune time to transfer the feature recent-list's knowledge
@ -86,7 +82,7 @@ function _appWillMount({ dispatch, getState }, next, action) {
* @private * @private
* @returns {*} The result returned by {@code next(action)}. * @returns {*} The result returned by {@code next(action)}.
*/ */
function _conferenceWillLeave({ dispatch, getState }, next, action) { function _conferenceWillLeave({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
const { doNotStoreRoom } = getState()['features/base/config']; const { doNotStoreRoom } = getState()['features/base/config'];
if (!doNotStoreRoom && !inIframe()) { if (!doNotStoreRoom && !inIframe()) {
@ -126,7 +122,7 @@ function _conferenceWillLeave({ dispatch, getState }, next, action) {
* @private * @private
* @returns {*} The result returned by {@code next(action)}. * @returns {*} The result returned by {@code next(action)}.
*/ */
function _setRoom({ dispatch, getState }, next, action) { function _setRoom({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
const { doNotStoreRoom } = getState()['features/base/config']; const { doNotStoreRoom } = getState()['features/base/config'];
if (!doNotStoreRoom && !inIframe() && action.room) { if (!doNotStoreRoom && !inIframe() && action.room) {

View File

@ -0,0 +1,5 @@
export interface IRecentItem {
conference: string;
date: number;
duration: number;
}

View File

@ -1,13 +1,14 @@
// @flow import { IStore } from '../app/types';
import { getMultipleVideoSendingSupportFeatureFlag } from '../base/config/functions';
import { getLocalJitsiDesktopTrack, getLocalJitsiVideoTrack } from '../../features/base/tracks'; import { getLocalJitsiDesktopTrack, getLocalJitsiVideoTrack } from '../base/tracks/functions';
import { getMultipleVideoSendingSupportFeatureFlag } from '../base/config';
import { SET_SCREENSHOT_CAPTURE } from './actionTypes'; import { SET_SCREENSHOT_CAPTURE } from './actionTypes';
// eslint-disable-next-line lines-around-comment
// @ts-ignore
import { createScreenshotCaptureSummary } from './functions'; import { createScreenshotCaptureSummary } from './functions';
import logger from './logger'; import logger from './logger';
let screenshotSummary; let screenshotSummary: any;
/** /**
* Marks the on-off state of screenshot captures. * Marks the on-off state of screenshot captures.
@ -18,7 +19,7 @@ let screenshotSummary;
* payload: enabled * payload: enabled
* }} * }}
*/ */
function setScreenshotCapture(enabled) { function setScreenshotCapture(enabled: boolean) {
return { return {
type: SET_SCREENSHOT_CAPTURE, type: SET_SCREENSHOT_CAPTURE,
payload: enabled payload: enabled
@ -32,7 +33,7 @@ function setScreenshotCapture(enabled) {
* @returns {Promise} * @returns {Promise}
*/ */
export function toggleScreenshotCaptureSummary(enabled: boolean) { export function toggleScreenshotCaptureSummary(enabled: boolean) {
return async function(dispatch: (Object) => Object, getState: () => any) { return async function(dispatch: IStore['dispatch'], getState: IStore['getState']) {
const state = getState(); const state = getState();
if (state['features/screenshot-capture'].capturesEnabled !== enabled) { if (state['features/screenshot-capture'].capturesEnabled !== enabled) {

View File

@ -1,5 +1,3 @@
// @flow
import { getLogger } from '../base/logging/functions'; import { getLogger } from '../base/logging/functions';
export default getLogger('features/screenshot-capture'); export default getLogger('features/screenshot-capture');

View File

@ -1,10 +1,9 @@
// @flow
import { Share } from 'react-native'; import { Share } from 'react-native';
import { getName } from '../app/functions'; import { getName } from '../app/functions.native';
import { MiddlewareRegistry } from '../base/redux'; import { IStore } from '../app/types';
import { getShareInfoText } from '../invite'; import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { getShareInfoText } from '../invite/functions';
import { BEGIN_SHARE_ROOM } from './actionTypes'; import { BEGIN_SHARE_ROOM } from './actionTypes';
import { endShareRoom } from './actions'; import { endShareRoom } from './actions';
@ -35,7 +34,7 @@ MiddlewareRegistry.register(store => next => action => {
* @private * @private
* @returns {void} * @returns {void}
*/ */
function _shareRoom(roomURL: string, { dispatch, getState }) { function _shareRoom(roomURL: string, { dispatch, getState }: IStore) {
getShareInfoText(getState(), roomURL) getShareInfoText(getState(), roomURL)
.then(message => { .then(message => {
const title = `${getName()} Conference`; const title = `${getName()} Conference`;

View File

@ -16,6 +16,7 @@
}, },
"exclude": [ "exclude": [
"node_modules", "node_modules",
"react/features/share-room",
"**/mobile/*", "**/mobile/*",
"**/native/*", "**/native/*",
"**/*.native.ts", "**/*.native.ts",