Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Coding style: consistency, formatting, naming
Lyubo Marinov6a0de0ddde18
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.javaindex f1b013765c..e1ab0fe0f9 100644--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java@@ -112,28 +112,30 @@ class ExternalAPIModule extends ReactContextBaseJavaModule {}/**- * The internal processing for the conference URL set on- * a {@link JitsiMeetView} instance.+ * The internal processing for the URL of the current conference set on the+ * associated {@link JitsiMeetView}.*- * @param eventName the name of the external API event to be processed.+ * @param eventName the name of the external API event to be processed+ * @param eventData the details/specifics of the event to process determined+ * by/associated with the specified {@code eventName}.* @param view the {@link JitsiMeetView} instance.- * @param url the "url" attribute value retrieved from the "data" carried by- * the event.*/- private void maybeSetConferenceUrlOnTheView(- String eventName, JitsiMeetView view, String url)- {+ private void maybeSetViewURL(+ String eventName,+ ReadableMap eventData,+ JitsiMeetView view) {switch(eventName) {case "CONFERENCE_WILL_JOIN":- view.setCurrentConferenceUrl(url);+ view.setURL(eventData.getString("url"));break;case "CONFERENCE_FAILED":case "CONFERENCE_WILL_LEAVE":case "LOAD_CONFIG_ERROR":- // Abandon the conference only if it's for the current URL- if (url != null && url.equals(view.getCurrentConferenceUrl())) {- view.setCurrentConferenceUrl(null);+ String url = eventData.getString("url");++ if (url != null && url.equals(view.getURL())) {+ view.setURL(null);}break;}@@ -158,7 +160,7 @@ class ExternalAPIModule extends ReactContextBaseJavaModule {return;}- maybeSetConferenceUrlOnTheView(name, view, data.getString("url"));+ maybeSetViewURL(name, data, view);JitsiMeetViewListener listener = view.getListener();diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.javaindex fd2dc558a8..ce7e8ec0f8 100644--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java@@ -204,15 +204,6 @@ public class JitsiMeetView extends FrameLayout {}}- /**- * Stores the current conference URL. Will have a value when the app is in- * a conference.- *- * Currently one thread writes and one thread reads, so it should be fine to- * have this field volatile without additional synchronization.- */- private volatile String conferenceUrl;-/*** The default base {@code URL} used to join a conference when a partial URL* (e.g. a room name only) is specified to {@link #loadURLString(String)} or@@ -252,6 +243,13 @@ public class JitsiMeetView extends FrameLayout {*/private ReactRootView reactRootView;+ /**+ * The URL of the current conference.+ */+ // XXX Currently, one thread writes and one thread reads, so it should be+ // fine to have this field volatile without additional synchronization.+ private volatile String url;+/*** Whether the Welcome page is enabled.*/@@ -291,16 +289,6 @@ public class JitsiMeetView extends FrameLayout {}}- /**- * Retrieves the current conferences URL.- *- * @return a string with conference URL if the view is currently in- * a conference or {@code null} otherwise.- */- public String getCurrentConferenceUrl() {- return conferenceUrl;- }-/*** Gets the default base {@code URL} used to join a conference when a* partial URL (e.g. a room name only) is specified to@@ -352,6 +340,19 @@ public class JitsiMeetView extends FrameLayout {|| pictureInPictureEnabled.booleanValue());}+ /**+ * Gets the URL of the current conference.+ *+ * XXX The method is meant for internal purposes only at the time of this+ * writing because there is no equivalent API on iOS.+ *+ * @return the URL {@code String} of the current conference if any;+ * otherwise, {@code null}.+ */+ String getURL() {+ return url;+ }+/*** Gets whether the Welcome page is enabled. If {@code true}, the Welcome* page is rendered when this {@code JitsiMeetView} is not at a URL@@ -477,7 +478,7 @@ public class JitsiMeetView extends FrameLayout {* page.*/public void onUserLeaveHint() {- if (getPictureInPictureEnabled() && conferenceUrl != null) {+ if (getPictureInPictureEnabled() && getURL() != null) {PictureInPictureModule pipModule= ReactInstanceManagerHolder.getNativeModule(PictureInPictureModule.class);@@ -485,9 +486,8 @@ public class JitsiMeetView extends FrameLayout {if (pipModule != null) {try {pipModule.enterPictureInPicture();- } catch (RuntimeException exc) {- Log.e(- TAG, "onUserLeaveHint: failed to enter PiP mode", exc);+ } catch (RuntimeException re) {+ Log.e(TAG, "onUserLeaveHint: failed to enter PiP mode", re);}}}@@ -530,17 +530,6 @@ public class JitsiMeetView extends FrameLayout {}}- /**- * Sets the current conference URL.- *- * @param conferenceUrl a string with new conference URL to set if the view- * is entering the conference or {@code null} if the view is no longer in- * the conference.- */- void setCurrentConferenceUrl(String conferenceUrl) {- this.conferenceUrl = conferenceUrl;- }-/*** Sets the default base {@code URL} used to join a conference when a* partial URL (e.g. a room name only) is specified to@@ -577,6 +566,19 @@ public class JitsiMeetView extends FrameLayout {this.pictureInPictureEnabled = Boolean.valueOf(pictureInPictureEnabled);}+ /**+ * Sets the URL of the current conference.+ *+ * XXX The method is meant for internal purposes only. It does not+ * {@code loadURL}, it merely remembers the specified URL.+ *+ * @param url the URL {@code String} which to be set as the URL of the+ * current conference.+ */+ void setURL(String url) {+ this.url = url;+ }+/*** Sets whether the Welcome page is enabled. Must be called before* {@link #loadURL(URL)} for it to take effect.diff --git a/react/features/welcome/components/VideoSwitch.js b/react/features/welcome/components/VideoSwitch.jsindex fa0179ce22..ee9070dabe 100644--- a/react/features/welcome/components/VideoSwitch.js+++ b/react/features/welcome/components/VideoSwitch.js@@ -1,25 +1,22 @@// @flow+import React, { Component } from 'react';-import {- Switch,- TouchableWithoutFeedback,- View-} from 'react-native';+import { Switch, TouchableWithoutFeedback, View } from 'react-native';import { connect } from 'react-redux';import { translate } from '../../base/i18n';import { updateProfile } from '../../base/profile';import { Header, Text } from '../../base/react';-import styles, {- SWITCH_THUMB_COLOR,- SWITCH_UNDER_COLOR-} from './styles';+import styles, { SWITCH_THUMB_COLOR, SWITCH_UNDER_COLOR } from './styles';+/**+ * The type of the React {@code Component} props of {@link VideoSwitch}.+ */type Props = {/**- * The Redux dispatch functions.+ * The redux {@code dispatch} function.*/dispatch: Function,@@ -29,28 +26,31 @@ type Props = {t: Function,/**- * The current profile settings from Redux.+ * The current profile settings from redux.*/_profile: Object};/**- * Renders the audio-video switch on the welcome screen.+ * Renders the "Video <-> Voice" switch on the {@code WelcomePage}.*/class VideoSwitch extends Component<Props> {/**- * Constructor of the component.+ * Initializes a new {@code VideoSwitch} instance.** @inheritdoc*/constructor(props) {super(props);+ // Bind event handlers so they are only bound once per instance.this._onStartAudioOnlyChange = this._onStartAudioOnlyChange.bind(this);+ this._onStartAudioOnlyFalse = this._onStartAudioOnlyChangeFn(false);+ this._onStartAudioOnlyTrue = this._onStartAudioOnlyChangeFn(true);}/**- * Implements React Component's render.+ * Implements React's {@link Component#render}.** @inheritdoc*/@@ -61,10 +61,8 @@ class VideoSwitch extends Component<Props> {return (<View style = { styles.audioVideoSwitchContainer }><TouchableWithoutFeedback- onPress = {- this._onStartAudioOnlyChangeFn(false)- } >- <Text style = { textStyle } >+ onPress = { this._onStartAudioOnlyFalse }>+ <Text style = { textStyle }>{ t('welcomepage.audioVideoSwitch.video') }</Text></TouchableWithoutFeedback>@@ -75,10 +73,8 @@ class VideoSwitch extends Component<Props> {thumbTintColor = { SWITCH_THUMB_COLOR }value = { _profile.startAudioOnly } /><TouchableWithoutFeedback- onPress = {- this._onStartAudioOnlyChangeFn(true)- } >- <Text style = { textStyle } >+ onPress = { this._onStartAudioOnlyTrue }>+ <Text style = { textStyle }>{ t('welcomepage.audioVideoSwitch.audio') }</Text></TouchableWithoutFeedback>@@ -86,19 +82,7 @@ class VideoSwitch extends Component<Props> {);}- /**- * Creates a function that forwards the startAudioOnly changes to the- * function that handles it.- *- * @private- * @param {boolean} startAudioOnly - The new startAudioOnly value.- * @returns {void}- */- _onStartAudioOnlyChangeFn(startAudioOnly) {- return () => this._onStartAudioOnlyChange(startAudioOnly);- }-- _onStartAudioOnlyChange: boolean => void+ _onStartAudioOnlyChange: boolean => void;/*** Handles the audio-video switch changes.@@ -115,6 +99,22 @@ class VideoSwitch extends Component<Props> {startAudioOnly}));}++ /**+ * Creates a function that forwards the {@code startAudioOnly} changes to+ * the function that handles it.+ *+ * @private+ * @param {boolean} startAudioOnly - The new {@code startAudioOnly} value.+ * @returns {void}+ */+ _onStartAudioOnlyChangeFn(startAudioOnly) {+ return () => this._onStartAudioOnlyChange(startAudioOnly);+ }++ _onStartAudioOnlyFalse: boolean => void;++ _onStartAudioOnlyTrue: boolean => void;}/**diff --git a/react/features/welcome/components/WelcomePage.native.js b/react/features/welcome/components/WelcomePage.native.jsindex 10e2a8ef76..c89de75131 100644--- a/react/features/welcome/components/WelcomePage.native.js+++ b/react/features/welcome/components/WelcomePage.native.js@@ -13,7 +13,7 @@ import { connect } from 'react-redux';import { translate } from '../../base/i18n';import { Icon } from '../../base/font-icons';import { MEDIA_TYPE } from '../../base/media';-import { LoadingIndicator, Header, Text } from '../../base/react';+import { Header, LoadingIndicator, Text } from '../../base/react';import { ColorPalette } from '../../base/styles';import {createDesiredLocalTracks,@@ -24,9 +24,7 @@ import { SettingsView } from '../../settings';import { AbstractWelcomePage, _mapStateToProps } from './AbstractWelcomePage';import { setSideBarVisible } from '../actions';import LocalVideoTrackUnderlay from './LocalVideoTrackUnderlay';-import styles, {- PLACEHOLDER_TEXT_COLOR-} from './styles';+import styles, { PLACEHOLDER_TEXT_COLOR } from './styles';import VideoSwitch from './VideoSwitch';import WelcomePageLists from './WelcomePageLists';import WelcomePageSideBar from './WelcomePageSideBar';@@ -155,22 +153,23 @@ class WelcomePage extends AbstractWelcomePage {*/_onFieldFocusChange(focused) {return () => {- if (focused) {- this.setState({+ focused+ && this.setState({_fieldFocused: true});- }- Animated.timing(this.state.hintBoxAnimation, {- duration: 300,- toValue: focused ? 1 : 0- }).start(animationState => {- if (animationState.finished && !focused) {- this.setState({- _fieldFocused: false- });- }- });+ Animated.timing(+ this.state.hintBoxAnimation,+ {+ duration: 300,+ toValue: focused ? 1 : 0+ })+ .start(animationState =>+ animationState.finished+ && !focused+ && this.setState({+ _fieldFocused: false+ }));};}@@ -256,9 +255,7 @@ class WelcomePage extends AbstractWelcomePage {buttonDisabled ? styles.buttonDisabled : null] }underlayColor = { ColorPalette.white }>- {- children- }+ { children }</TouchableHighlight>);}diff --git a/react/features/welcome/components/styles.js b/react/features/welcome/components/styles.jsindex 92335af976..b952b85407 100644--- a/react/features/welcome/components/styles.js+++ b/react/features/welcome/components/styles.js@@ -1,14 +1,15 @@-import {- BoxModel,- ColorPalette,- createStyleSheet-} from '../../base/styles';+// @flow-const SIDEBAR_HEADER_HEIGHT = 150;+import { BoxModel, ColorPalette, createStyleSheet } from '../../base/styles';export const PLACEHOLDER_TEXT_COLOR = 'rgba(255, 255, 255, 0.3)';+export const SIDEBAR_AVATAR_SIZE = 100;++const SIDEBAR_HEADER_HEIGHT = 150;+export const SWITCH_THUMB_COLOR = ColorPalette.blueHighlight;+export const SWITCH_UNDER_COLOR = 'rgba(0, 0, 0, 0.4)';/**