Skip to content

Commit

Permalink
fix(ts) make tsc (almost) not cry on native
Browse files Browse the repository at this point in the history
Co-authored-by: Calinteodor <[email protected]>
Co-authored-by: Robert Pintilii <[email protected]>
  • Loading branch information
3 people committed Nov 1, 2022
1 parent 2de0520 commit 2596c46
Show file tree
Hide file tree
Showing 70 changed files with 536 additions and 488 deletions.
8 changes: 2 additions & 6 deletions conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,8 @@ import {
} from './react/features/notifications';
import { mediaPermissionPromptVisibilityChanged } from './react/features/overlay';
import { suspendDetected } from './react/features/power-monitor';
import {
initPrejoin,
isPrejoinPageVisible,
makePrecallTest,
setJoiningInProgress
} from './react/features/prejoin';
import { initPrejoin, makePrecallTest, setJoiningInProgress } from './react/features/prejoin/actions';
import { isPrejoinPageVisible } from './react/features/prejoin/functions';
import { disableReceiver, stopReceiver } from './react/features/remote-control';
import { isScreenAudioShared, setScreenAudioShareState } from './react/features/screen-share/';
import { toggleScreenshotCaptureSummary } from './react/features/screenshot-capture';
Expand Down
9 changes: 8 additions & 1 deletion globals.native.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ import { IConfig } from "./react/features/base/config/configType";

export {};

interface ILocation extends URL {
assign(url: string);
replace(url: string);
reload();
};

interface IWindow {
JITSI_MEET_LITE_SDK: boolean;
JitsiMeetJS: any;
config: IConfig;
interfaceConfig: any;
location: URL;
location: ILocation;
}

interface INavigator {
Expand Down
2 changes: 1 addition & 1 deletion modules/API/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ import { getParticipantsPaneOpen, isForceMuted } from '../../react/features/part
import { startLocalVideoRecording, stopLocalVideoRecording } from '../../react/features/recording';
import { RECORDING_TYPES } from '../../react/features/recording/constants';
import { getActiveSession, supportsLocalRecording } from '../../react/features/recording/functions';
import { isScreenAudioSupported } from '../../react/features/screen-share';
import { startAudioScreenShareFlow, startScreenShareFlow } from '../../react/features/screen-share/actions';
import { isScreenAudioSupported } from '../../react/features/screen-share/functions';
import { toggleScreenshotCaptureSummary } from '../../react/features/screenshot-capture';
import { isScreenshotCaptureEnabled } from '../../react/features/screenshot-capture/functions';
import { playSharedVideo, stopSharedVideo } from '../../react/features/shared-video/actions.any';
Expand Down
17 changes: 17 additions & 0 deletions react/features/app/actions.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,23 @@ export function appNavigate(uri?: string) {
};
}

/**
* Check if the welcome page is enabled and redirects to it.
* If requested show a thank you dialog before that.
* If we have a close page enabled, redirect to it without
* showing any other dialog.
*
* @param {Object} _options - Used to decide which particular close page to show
* or if close page is disabled, whether we should show the thankyou dialog.
* @param {boolean} options.showThankYou - Whether we should
* show thank you dialog.
* @param {boolean} options.feedbackSubmitted - Whether feedback was submitted.
* @returns {Function}
*/
export function maybeRedirectToWelcomePage(_options: { feedbackSubmitted?: boolean; showThankYou?: boolean; } = {}) {
// Dummy.
}

/**
* Reloads the page.
*
Expand Down
2 changes: 1 addition & 1 deletion react/features/app/components/App.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { AtlasKitThemeProvider } from '@atlaskit/theme';
import React from 'react';

import GlobalStyles from '../../base/ui/components/GlobalStyles';
import GlobalStyles from '../../base/ui/components/GlobalStyles.web';
import JitsiThemeProvider from '../../base/ui/components/JitsiThemeProvider.web';
import DialogContainer from '../../base/ui/components/web/DialogContainer';
import { ChromeExtensionBanner } from '../../chrome-extension-banner';
Expand Down
4 changes: 0 additions & 4 deletions react/features/app/middlewares.any.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @flow

import '../analytics/middleware';
import '../av-moderation/middleware';
import '../base/conference/middleware';
Expand All @@ -12,7 +10,6 @@ import '../base/logging/middleware';
import '../base/media/middleware';
import '../base/net-info/middleware';
import '../base/participants/middleware';
import '../base/redux/middleware';
import '../base/responsive-ui/middleware';
import '../base/settings/middleware';
import '../base/sounds/middleware';
Expand Down Expand Up @@ -46,7 +43,6 @@ import '../room-lock/middleware';
import '../rtcstats/middleware';
import '../speaker-stats/middleware';
import '../subtitles/middleware';
import '../toolbox/middleware';
import '../transcribing/middleware';
import '../video-layout/middleware';
import '../video-quality/middleware';
Expand Down
2 changes: 0 additions & 2 deletions react/features/app/middlewares.native.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @flow

import '../authentication/middleware';
import '../dynamic-branding/middleware';
import '../gifs/middleware';
Expand Down
4 changes: 2 additions & 2 deletions react/features/app/middlewares.web.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// @flow

import '../authentication/middleware';
import '../base/i18n/middleware';
import '../base/devices/middleware';
import '../base/media/middleware';
import '../base/redux/middleware';
import '../dynamic-branding/middleware';
import '../e2ee/middleware';
import '../external-api/middleware';
Expand All @@ -19,6 +18,7 @@ import '../screen-share/middleware';
import '../shared-video/middleware';
import '../settings/middleware';
import '../talk-while-muted/middleware';
import '../toolbox/middleware';
import '../face-landmarks/middleware';
import '../gifs/middleware';
import '../whiteboard/middleware';
Expand Down
2 changes: 1 addition & 1 deletion react/features/base/conference/middleware.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {
setPrejoinPageVisibility,
setSkipPrejoinOnReload
} from '../../prejoin';
} from '../../prejoin/actions.web';
import { JitsiConferenceErrors } from '../lib-jitsi-meet';
import { MiddlewareRegistry } from '../redux';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ MiddlewareRegistry.register(store => next => action => {
}
break;
case NOTIFY_CAMERA_ERROR: {
if (typeof APP !== 'object' || !action.error) {
if (!action.error) {
break;
}

Expand Down Expand Up @@ -147,7 +147,7 @@ MiddlewareRegistry.register(store => next => action => {
break;
}
case NOTIFY_MIC_ERROR: {
if (typeof APP !== 'object' || !action.error) {
if (!action.error) {
break;
}

Expand Down
4 changes: 2 additions & 2 deletions react/features/base/dialog/middleware.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import StopRecordingDialog from '../../recording/components/Recording/web/StopRe
// @ts-ignore
import RemoteControlAuthorizationDialog from '../../remote-control/components/RemoteControlAuthorizationDialog';
import SalesforceLinkDialog from '../../salesforce/components/web/SalesforceLinkDialog';
import ShareAudioDialog from '../../screen-share/components/ShareAudioDialog';
import ShareScreenWarningDialog from '../../screen-share/components/ShareScreenWarningDialog';
import ShareAudioDialog from '../../screen-share/components/web/ShareAudioDialog';
import ShareScreenWarningDialog from '../../screen-share/components/web/ShareScreenWarningDialog';
import SecurityDialog from '../../security/components/security-dialog/web/SecurityDialog';
import LogoutDialog from '../../settings/components/web/LogoutDialog';
import SharedVideoDialog from '../../shared-video/components/web/SharedVideoDialog';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, { ReactNode } from 'react';
import { makeStyles } from 'tss-react/mui';

import { IReduxState } from '../../../../app/types';
import DeviceStatus from '../../../../prejoin/components/preview/DeviceStatus';
import DeviceStatus from '../../../../prejoin/components/web/preview/DeviceStatus';
// @ts-ignore
import { Toolbox } from '../../../../toolbox/components/web';
import { getConferenceName } from '../../../conference/functions';
Expand Down
File renamed without changes.
21 changes: 0 additions & 21 deletions react/features/base/settings/functions.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,3 @@ function getDeviceIdByType(state: IReduxState, isType: string) {
export function getDisplayName(state: IReduxState): string {
return state['features/base/settings'].displayName || '';
}


/**
* Handles changes to the `disableCallIntegration` setting.
* Noop on web.
*
* @param {boolean} disabled - Whether call integration is disabled or not.
* @returns {void}
*/
// eslint-disable-next-line @typescript-eslint/no-empty-function, require-jsdoc
export function handleCallIntegrationChange(disabled: boolean) { }

/**
* Handles changes to the `disableCrashReporting` setting.
* Noop on web.
*
* @param {boolean} disabled - Whether crash reporting is disabled or not.
* @returns {void}
*/
// eslint-disable-next-line @typescript-eslint/no-empty-function, require-jsdoc
export function handleCrashReportingChange(disabled: boolean) { }
118 changes: 118 additions & 0 deletions react/features/base/settings/middleware.any.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/* eslint-disable lines-around-comment */
import _ from 'lodash';
import { AnyAction } from 'redux';

import { IStore } from '../../app/types';
import { SET_LOCATION_URL } from '../connection/actionTypes';
import { participantUpdated } from '../participants/actions';
import { getLocalParticipant } from '../participants/functions';
import MiddlewareRegistry from '../redux/MiddlewareRegistry';
import { parseURLParams } from '../util/parseURLParams';

import { SETTINGS_UPDATED } from './actionTypes';
import { updateSettings } from './actions';

/**
* The middleware of the feature base/settings. Distributes changes to the state
* of base/settings to the states of other features computed from the state of
* base/settings.
*
* @param {Store} store - The redux store.
* @returns {Function}
*/
MiddlewareRegistry.register(store => next => action => {
const result = next(action);

switch (action.type) {
case SETTINGS_UPDATED:
_updateLocalParticipant(store, action);
break;
case SET_LOCATION_URL:
_updateLocalParticipantFromUrl(store);
break;
}

return result;
});

/**
* Maps the settings field names to participant names where they don't match.
* Currently there is only one such field, but may be extended in the future.
*
* @private
* @param {string} settingsField - The name of the settings field to map.
* @returns {string}
*/
function _mapSettingsFieldToParticipant(settingsField: string) {
switch (settingsField) {
case 'displayName':
return 'name';
}

return settingsField;
}

/**
* Updates the local participant according to settings changes.
*
* @param {Store} store - The redux store.
* @param {Object} action - The dispatched action.
* @private
* @returns {void}
*/
function _updateLocalParticipant({ dispatch, getState }: IStore, action: AnyAction) {
const { settings } = action;
const localParticipant = getLocalParticipant(getState());
const newLocalParticipant = {
...localParticipant
};

for (const key in settings) {
if (settings.hasOwnProperty(key)) {
newLocalParticipant[_mapSettingsFieldToParticipant(key) as keyof typeof newLocalParticipant]
= settings[key];
}
}

dispatch(participantUpdated({
...newLocalParticipant,
id: newLocalParticipant.id ?? ''
}));
}


/**
* Returns the userInfo set in the URL.
*
* @param {Store} store - The redux store.
* @private
* @returns {void}
*/
function _updateLocalParticipantFromUrl({ dispatch, getState }: IStore) {
const urlParams
= parseURLParams(getState()['features/base/connection'].locationURL ?? '');
const urlEmail = urlParams['userInfo.email'];
const urlDisplayName = urlParams['userInfo.displayName'];

if (!urlEmail && !urlDisplayName) {
return;
}

const localParticipant = getLocalParticipant(getState());

if (localParticipant) {
const displayName = _.escape(urlDisplayName);
const email = _.escape(urlEmail);

dispatch(participantUpdated({
...localParticipant,
email,
name: displayName
}));

dispatch(updateSettings({
displayName,
email
}));
}
}
Loading

0 comments on commit 2596c46

Please sign in to comment.