[RN] Naming
This commit is contained in:
parent
4687c1f465
commit
5f64ccb97d
|
@ -85,17 +85,17 @@ public class MainActivity extends AppCompatActivity {
|
|||
This class encapsulates a high level API in the form of an Android `Activity`
|
||||
which displays a single `JitsiMeetView`.
|
||||
|
||||
#### getWelcomePageDisabled()
|
||||
#### getWelcomePageEnabled()
|
||||
|
||||
See JitsiMeetView.getWelcomePageDisabled.
|
||||
See JitsiMeetView.getWelcomePageEnabled.
|
||||
|
||||
#### loadURL(url)
|
||||
#### loadURL(URL)
|
||||
|
||||
See JitsiMeetView.loadURL.
|
||||
|
||||
#### setWelcomePageDisabled(disabled)
|
||||
#### setWelcomePageEnabled(boolean)
|
||||
|
||||
See JitsiMeetView.setWelcomePageDisabled.
|
||||
See JitsiMeetView.setWelcomePageEnabled.
|
||||
|
||||
### JitsiMeetView
|
||||
|
||||
|
@ -106,12 +106,12 @@ display a Jitsi Meet conference (or a welcome page).
|
|||
|
||||
Returns the `JitsiMeetViewListener` instance attached to the view.
|
||||
|
||||
#### getWelcomePageDisabled()
|
||||
#### getWelcomePageEnabled()
|
||||
|
||||
Returns true if the welcome page is disable,d false if not. If the welcome page
|
||||
is disabled, a black empty view will be rendered when not in a conference.
|
||||
Returns true if the Welcome page is enabled; otherwise, false. If false, a black
|
||||
empty view will be rendered when not in a conference. Defaults to false.
|
||||
|
||||
#### loadURL(url)
|
||||
#### loadURL(URL)
|
||||
|
||||
Loads the given URL and joins the room. If `null` is specified, the welcome page
|
||||
is displayed instead.
|
||||
|
@ -121,12 +121,12 @@ is displayed instead.
|
|||
Sets the given listener (class implementing the `JitsiMeetViewListener`
|
||||
interface) on the view.
|
||||
|
||||
#### setWelcomePageDisabled(disabled)
|
||||
#### setWelcomePageEnabled(boolean)
|
||||
|
||||
Sets if the welcome page should be disabled or not. See `getWelcomePageDisabled`
|
||||
for more info.
|
||||
Sets whether the Welcome page is enabled. See `getWelcomePageEnabled` for more
|
||||
information.
|
||||
|
||||
NOTE: This function must be called before `loadURL` for it to take effect.
|
||||
NOTE: Must be called before `loadURL` for it to take effect.
|
||||
|
||||
#### onBackPressed()
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.jitsi.meet;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.jitsi.meet.sdk.JitsiMeetActivity;
|
||||
|
||||
/**
|
||||
|
@ -25,10 +27,23 @@ import org.jitsi.meet.sdk.JitsiMeetActivity;
|
|||
* of it. Further attempts at launching the application once it was already
|
||||
* launched will result in {@link Activity#onNewIntent(Intent)} being called.
|
||||
*
|
||||
* This {@code Activity} extends {@link JitsiMeetActivity} without adding
|
||||
* anything to it. It exists to merely keep the React Native CLI working, since
|
||||
* the latter always tries to launch an {@code Activity} named
|
||||
* {@code MainActivity} when doing {@code react-native run-android}.
|
||||
* This {@code Activity} extends {@link JitsiMeetActivity} to keep the React
|
||||
* Native CLI working, since the latter always tries to launch an
|
||||
* {@code Activity} named {@code MainActivity} when doing
|
||||
* {@code react-native run-android}.
|
||||
*/
|
||||
public class MainActivity extends JitsiMeetActivity {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// As this is the Jitsi Meet app (i.e. not the Jitsi Meet SDK), we do
|
||||
// want the Welcome page to be enabled. It defaults to disabled in the
|
||||
// SDK at the time of this writing but it is clearer to be explicit
|
||||
// about what we want anyway.
|
||||
setWelcomePageEnabled(true);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,10 +51,17 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
|||
private JitsiMeetView view;
|
||||
|
||||
/**
|
||||
* See {@JitsiMeetView.getWelcomePageDisabled}.
|
||||
* Whether the Welcome page is enabled. The value is used only while
|
||||
* {@link #view} equals {@code null}.
|
||||
*/
|
||||
public boolean getWelcomePageDisabled() {
|
||||
return view != null && view.getWelcomePageDisabled();
|
||||
private boolean welcomePageEnabled;
|
||||
|
||||
/**
|
||||
*
|
||||
* @see JitsiMeetView#getWelcomePageEnabled
|
||||
*/
|
||||
public boolean getWelcomePageEnabled() {
|
||||
return view == null ? welcomePageEnabled : view.getWelcomePageEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,15 +74,6 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
|||
view.loadURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* See {@JitsiMeetView.setWelcomePageDisabled}.
|
||||
*/
|
||||
public void setWelcomePageDisabled(boolean disabled) {
|
||||
if (view != null) {
|
||||
view.setWelcomePageDisabled(disabled);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -115,6 +113,11 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
|||
super.onCreate(savedInstanceState);
|
||||
|
||||
view = new JitsiMeetView(this);
|
||||
|
||||
// In order to have the desired effect
|
||||
// JitsiMeetView#setWelcomePageEnabled(boolean) must be invoked before
|
||||
// JitsiMeetView#loadURL(URL).
|
||||
view.setWelcomePageEnabled(welcomePageEnabled);
|
||||
view.loadURL(null);
|
||||
|
||||
// In debug mode React needs permission to write over other apps in
|
||||
|
@ -171,4 +174,16 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
|||
|
||||
JitsiMeetView.onHostResume(this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see JitsiMeetView#setWelcomePageEnabled
|
||||
*/
|
||||
public void setWelcomePageEnabled(boolean welcomePageEnabled) {
|
||||
if (view == null) {
|
||||
this.welcomePageEnabled = welcomePageEnabled;
|
||||
} else {
|
||||
view.setWelcomePageEnabled(welcomePageEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,16 +58,16 @@ public class JitsiMeetView extends FrameLayout {
|
|||
*/
|
||||
private JitsiMeetViewListener listener;
|
||||
|
||||
/**
|
||||
* Indicates if the welcome page should be disabled or not.
|
||||
*/
|
||||
private boolean welcomePageDisabled;
|
||||
|
||||
/**
|
||||
* React Native root view.
|
||||
*/
|
||||
private ReactRootView reactRootView;
|
||||
|
||||
/**
|
||||
* Whether the Welcome page is enabled.
|
||||
*/
|
||||
private boolean welcomePageEnabled;
|
||||
|
||||
public JitsiMeetView(@NonNull Context context) {
|
||||
super(context);
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class JitsiMeetView extends FrameLayout {
|
|||
/**
|
||||
* Returns the only instance of this class we currently allow creating.
|
||||
*
|
||||
* @returns The {@code JitsiMeetView} instance.
|
||||
* @return The {@code JitsiMeetView} instance.
|
||||
*/
|
||||
public static JitsiMeetView getInstance() {
|
||||
return instance;
|
||||
|
@ -103,7 +103,7 @@ public class JitsiMeetView extends FrameLayout {
|
|||
/**
|
||||
* Gets the {@link JitsiMeetViewListener} set on this {@code JitsiMeetView}.
|
||||
*
|
||||
* @returns The {@code JitsiMeetViewListener} set on this
|
||||
* @return The {@code JitsiMeetViewListener} set on this
|
||||
* {@code JitsiMeetView}.
|
||||
*/
|
||||
public JitsiMeetViewListener getListener() {
|
||||
|
@ -111,10 +111,14 @@ public class JitsiMeetView extends FrameLayout {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return - true if the welcome page is disabled, false if not.
|
||||
* Gets whether the Welcome page is enabled. If {@code true}, the Welcome
|
||||
* page is rendered when this {@code JitsiMeetView} is not at a URL
|
||||
* identifying a Jitsi Meet conference/room.
|
||||
*
|
||||
* @return {@true} if the Welcome page is enabled; otherwise, {@code false}.
|
||||
*/
|
||||
public boolean getWelcomePageDisabled() {
|
||||
return welcomePageDisabled;
|
||||
public boolean getWelcomePageEnabled() {
|
||||
return welcomePageEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,11 +157,12 @@ public class JitsiMeetView extends FrameLayout {
|
|||
public void loadURL(@Nullable URL url) {
|
||||
Bundle props = new Bundle();
|
||||
|
||||
// url
|
||||
if (url != null) {
|
||||
props.putString("url", url.toString());
|
||||
}
|
||||
|
||||
props.putBoolean("disableWelcomePage", welcomePageDisabled);
|
||||
// welcomePageEnabled
|
||||
props.putBoolean("welcomePageEnabled", welcomePageEnabled);
|
||||
|
||||
// TODO: ReactRootView#setAppProperties is only available on React
|
||||
// Native 0.45, so destroy the current root view and create a new one.
|
||||
|
@ -185,13 +190,14 @@ public class JitsiMeetView extends FrameLayout {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets if the welcome page should be enabled or not. Must be called before calling loadURL or
|
||||
* it won't take effect.
|
||||
* Sets whether the Welcome page is enabled. Must be called before
|
||||
* {@link #loadURL(URL)} for it to take effect.
|
||||
*
|
||||
* @param disabled - set to true for disabling the welcome page, false not to do so.
|
||||
* @param welcomePageEnabled {@code true} to enable the Welcome page;
|
||||
* otherwise, {@code false}.
|
||||
*/
|
||||
public void setWelcomePageDisabled(boolean disabled) {
|
||||
welcomePageDisabled = disabled;
|
||||
public void setWelcomePageEnabled(boolean welcomePageEnabled) {
|
||||
this.welcomePageEnabled = welcomePageEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,19 +34,16 @@ The `JitsiMeetView` class is the entry point to the SDK. It a subclass of
|
|||
|
||||
#### delegate
|
||||
|
||||
Property for getting / setting the delegate (instance of `JitsiMeetViewDelegate`
|
||||
in the view.
|
||||
Property for getting / setting the `JitsiMeetViewDelegate` on `JitsiMeetView`.
|
||||
|
||||
#### disableWelcomePage
|
||||
#### welcomePageEnabled
|
||||
|
||||
Property for setting the welcome page as disabled (or not). It default to NO, so
|
||||
a welcome page would be shown. When the welcome page is set to disabled, an
|
||||
empty black view is rendered.
|
||||
Property for getting / setting whether the Welcome page is enabled. If NO, a
|
||||
black empty view will be rendered when not in a conference. Defaults to NO.
|
||||
|
||||
NOTE: This property must be set before calling `loadURL` in order for it to take
|
||||
effect.
|
||||
NOTE: Must be set before calling `loadURL` for it to take effect.
|
||||
|
||||
#### loadURL(url)
|
||||
#### loadURL(URL)
|
||||
|
||||
```objc
|
||||
[meetView loadURL:[NSURL URLWithString:@"https://meet.jit.si/test123"]];
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
JitsiMeetView *view = (JitsiMeetView *) self.view;
|
||||
|
||||
view.delegate = self;
|
||||
// As this is the Jitsi Meet app (i.e. not the Jitsi Meet SDK), we do
|
||||
// want the Welcome page to be enabled. It defaults to disabled in the
|
||||
// SDK at the time of this writing but it is clearer to be explicit
|
||||
// about what we want anyway.
|
||||
view.welcomePageEnabled = YES;
|
||||
[view loadURL:nil];
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
@interface JitsiMeetView : UIView
|
||||
|
||||
@property (nonatomic, weak, nullable) id<JitsiMeetViewDelegate> delegate;
|
||||
@property (nonatomic) BOOL disableWelcomePage;
|
||||
|
||||
@property (nonatomic) BOOL welcomePageEnabled;
|
||||
|
||||
+ (BOOL)application:(UIApplication *)application
|
||||
continueUserActivity:(NSUserActivity *)userActivity
|
||||
|
|
|
@ -108,11 +108,12 @@ static JitsiMeetView *instance;
|
|||
- (void)loadURL:(NSURL *)url {
|
||||
NSMutableDictionary *props = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// url
|
||||
if (url) {
|
||||
[props setObject:url.absoluteString forKey:@"url"];
|
||||
}
|
||||
|
||||
[props setObject:@(self.disableWelcomePage) forKey:@"disableWelcomePage"];
|
||||
// welcomePageEnabled
|
||||
[props setObject:@(self.welcomePageEnabled) forKey:@"welcomePageEnabled"];
|
||||
|
||||
if (rootView == nil) {
|
||||
rootView
|
||||
|
|
|
@ -1,18 +1,5 @@
|
|||
/**
|
||||
* The type of (Redux) action which configures if the welcome page should be
|
||||
* disabled or not.
|
||||
*
|
||||
* {
|
||||
* type: APP_SET_WELCOME_PAGE_DISABLED,
|
||||
* app: App,
|
||||
* disabled: boolean
|
||||
* }
|
||||
*/
|
||||
export const APP_SET_WELCOME_PAGE_DISABLED
|
||||
= Symbol('APP_SET_WELCOME_PAGE_DISABLED');
|
||||
|
||||
/**
|
||||
* The type of (Redux) action which signals that a specific App will mount (in
|
||||
* The type of (redux) action which signals that a specific App will mount (in
|
||||
* React terms).
|
||||
*
|
||||
* {
|
||||
|
@ -23,7 +10,7 @@ export const APP_SET_WELCOME_PAGE_DISABLED
|
|||
export const APP_WILL_MOUNT = Symbol('APP_WILL_MOUNT');
|
||||
|
||||
/**
|
||||
* The type of (Redux) action which signals that a specific App will unmount (in
|
||||
* The type of (redux) action which signals that a specific App will unmount (in
|
||||
* React terms).
|
||||
*
|
||||
* {
|
||||
|
|
|
@ -3,11 +3,7 @@ import { setLocationURL } from '../base/connection';
|
|||
import { setConfig } from '../base/config';
|
||||
import { loadConfig } from '../base/lib-jitsi-meet';
|
||||
|
||||
import {
|
||||
APP_SET_WELCOME_PAGE_DISABLED,
|
||||
APP_WILL_MOUNT,
|
||||
APP_WILL_UNMOUNT
|
||||
} from './actionTypes';
|
||||
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from './actionTypes';
|
||||
import { _getRouteToRender, _parseURIString } from './functions';
|
||||
|
||||
declare var APP: Object;
|
||||
|
@ -160,26 +156,6 @@ function _appNavigateToOptionalLocation(
|
|||
_appNavigateToMandatoryLocation(dispatch, getState, location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the welcome page display for this app.
|
||||
*
|
||||
* @param {App} app - The App being configured.
|
||||
* @param {boolean} disabled - Set to true if the welcome page should be
|
||||
* disabled, false if it shouldn't.
|
||||
* @returns {{
|
||||
* type: APP_SET_WELCOME_PAGE_DISABLED,
|
||||
* app: App,
|
||||
* disabled: boolean
|
||||
* }}
|
||||
*/
|
||||
export function appSetWelcomePageDisabled(app, disabled) {
|
||||
return {
|
||||
type: APP_SET_WELCOME_PAGE_DISABLED,
|
||||
app,
|
||||
disabled
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Signals that a specific App will mount (in the terms of React).
|
||||
*
|
||||
|
|
|
@ -21,7 +21,8 @@ import {
|
|||
declare var APP: Object;
|
||||
|
||||
/**
|
||||
* Default URL to be loaded if no other was specified using props.
|
||||
* The default URL to open if no other was specified to {@code AbstractApp}
|
||||
* via props.
|
||||
*/
|
||||
const DEFAULT_URL = 'https://meet.jit.si';
|
||||
|
||||
|
@ -38,9 +39,10 @@ export class AbstractApp extends Component {
|
|||
*/
|
||||
static propTypes = {
|
||||
/**
|
||||
* Default URL to be loaded by the app when not in any room.
|
||||
* The default URL {@code AbstractApp} is to open when not in any
|
||||
* conference/room.
|
||||
*/
|
||||
defaultUrl: React.PropTypes.string,
|
||||
defaultURL: React.PropTypes.string,
|
||||
|
||||
/**
|
||||
* (Optional) Redux store for this app.
|
||||
|
@ -203,27 +205,31 @@ export class AbstractApp extends Component {
|
|||
* @protected
|
||||
*/
|
||||
_createElement(component, props) {
|
||||
/* eslint-disable no-unused-vars, lines-around-comment */
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const {
|
||||
// The defaultUrl property was introduced to be consumed entirely by
|
||||
// AbstractApp.
|
||||
defaultUrl,
|
||||
// Don't propagate the dispatch and store props because they usually
|
||||
// come from react-redux and programmers don't really expect them to
|
||||
// be inherited but rather explicitly connected.
|
||||
dispatch, // eslint-disable-line react/prop-types
|
||||
store,
|
||||
// The url property was introduced to be consumed entirely by
|
||||
// AbstractApp.
|
||||
|
||||
// The following props were introduced to be consumed entirely by
|
||||
// AbstractApp:
|
||||
defaultURL,
|
||||
url,
|
||||
|
||||
// The remaining props, if any, are considered suitable for
|
||||
// propagation to the children of this Component.
|
||||
...thisProps
|
||||
} = this.props;
|
||||
/* eslint-enable no-unused-vars, lines-around-comment */
|
||||
|
||||
// eslint-disable-next-line object-property-newline
|
||||
return React.createElement(component, { ...thisProps, ...props });
|
||||
/* eslint-enable no-unused-vars */
|
||||
|
||||
return React.createElement(component, {
|
||||
...thisProps,
|
||||
...props
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -276,7 +282,7 @@ export class AbstractApp extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
return this.props.defaultUrl || DEFAULT_URL;
|
||||
return this.props.defaultURL || DEFAULT_URL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -350,7 +356,7 @@ export class AbstractApp extends Component {
|
|||
// role of Router is now this AbstractApp, provide its nextState.
|
||||
// (2) A replace function would be provided to the Route in case it
|
||||
// chose to redirect to another path.
|
||||
this._onRouteEnter(route, nextState, pathname => {
|
||||
route && this._onRouteEnter(route, nextState, pathname => {
|
||||
this._openURL(pathname);
|
||||
|
||||
// Do not proceed with the route because it chose to redirect to
|
||||
|
@ -370,11 +376,9 @@ export class AbstractApp extends Component {
|
|||
*/
|
||||
_onRouteEnter(route, ...args) {
|
||||
// Notify the route that it is about to be entered.
|
||||
const onEnter = route && route.onEnter;
|
||||
const { onEnter } = route;
|
||||
|
||||
if (typeof onEnter === 'function') {
|
||||
onEnter(...args);
|
||||
}
|
||||
typeof onEnter === 'function' && onEnter(...args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,6 @@ import '../../mobile/proximity';
|
|||
import '../../mobile/wake-lock';
|
||||
|
||||
import { AbstractApp } from './AbstractApp';
|
||||
import { appSetWelcomePageDisabled } from '../actions';
|
||||
|
||||
/**
|
||||
* Root application component.
|
||||
|
@ -29,10 +28,11 @@ export class App extends AbstractApp {
|
|||
...AbstractApp.propTypes,
|
||||
|
||||
/**
|
||||
* Indicates if the welcome page should be shown when not in a
|
||||
* conference.
|
||||
* Whether the Welcome page is enabled. If {@code true}, the Welcome
|
||||
* page is rendered when the {@link App} is not at a location (URL)
|
||||
* identifying a Jitsi Meet conference/room.
|
||||
*/
|
||||
disableWelcomePage: React.PropTypes.bool
|
||||
welcomePageEnabled: React.PropTypes.bool
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -66,13 +66,6 @@ export class App extends AbstractApp {
|
|||
super.componentWillMount();
|
||||
|
||||
Linking.addEventListener('url', this._onLinkingURL);
|
||||
|
||||
// Store the desire to use the welcome page or not in the Redux store.
|
||||
const dispatch = this._getStore().dispatch;
|
||||
|
||||
dispatch(
|
||||
appSetWelcomePageDisabled(
|
||||
this, Boolean(this.props.disableWelcomePage)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -142,12 +142,19 @@ export function _getRouteToRender(stateOrGetState) {
|
|||
= typeof stateOrGetState === 'function'
|
||||
? stateOrGetState()
|
||||
: stateOrGetState;
|
||||
const { disableWelcomePage } = state['features/app'];
|
||||
const { room } = state['features/base/conference'];
|
||||
const component = isRoomValid(room) ? Conference : WelcomePage;
|
||||
let component;
|
||||
|
||||
if (component === WelcomePage && disableWelcomePage) {
|
||||
return null;
|
||||
if (isRoomValid(room)) {
|
||||
component = Conference;
|
||||
} else {
|
||||
// The value of the App prop welcomePageEnabled was stored in redux in
|
||||
// saghul's PR. But I removed the redux state, action, action type, etc.
|
||||
// because I didn't like the name. We are not using the prop is a
|
||||
// React-ive way anyway so it's all the same difference.
|
||||
const { app } = state['features/app'];
|
||||
|
||||
component = app && app.props.welcomePageEnabled ? WelcomePage : null;
|
||||
}
|
||||
|
||||
return RouteRegistry.getRouteByComponent(component);
|
||||
|
|
|
@ -1,23 +1,13 @@
|
|||
import { ReducerRegistry } from '../base/redux';
|
||||
|
||||
import {
|
||||
APP_SET_WELCOME_PAGE_DISABLED,
|
||||
APP_WILL_MOUNT,
|
||||
APP_WILL_UNMOUNT
|
||||
} from './actionTypes';
|
||||
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from './actionTypes';
|
||||
|
||||
ReducerRegistry.register('features/app', (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case APP_SET_WELCOME_PAGE_DISABLED:
|
||||
if (state.app === action.app) {
|
||||
return {
|
||||
...state,
|
||||
disableWelcomePage: action.disabled
|
||||
};
|
||||
}
|
||||
break;
|
||||
case APP_WILL_MOUNT:
|
||||
if (state.app !== action.app) {
|
||||
case APP_WILL_MOUNT: {
|
||||
const { app } = action;
|
||||
|
||||
if (state.app !== app) {
|
||||
return {
|
||||
...state,
|
||||
|
||||
|
@ -27,10 +17,11 @@ ReducerRegistry.register('features/app', (state = {}, action) => {
|
|||
*
|
||||
* @type {App}
|
||||
*/
|
||||
app: action.app
|
||||
app
|
||||
};
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case APP_WILL_UNMOUNT:
|
||||
if (state.app === action.app) {
|
||||
|
|
|
@ -13,25 +13,26 @@ import { App } from './features/app';
|
|||
*/
|
||||
class Root extends Component {
|
||||
/**
|
||||
* Root component's property types.
|
||||
* {@code Root} component's property types.
|
||||
*
|
||||
* @static
|
||||
*/
|
||||
static propTypes = {
|
||||
/**
|
||||
* Indicates if the welcome page should be shown when not in a
|
||||
* conference.
|
||||
*/
|
||||
disableWelcomePage: React.PropTypes.bool,
|
||||
|
||||
/**
|
||||
* The URL, if any, with which the app was launched.
|
||||
*/
|
||||
url: React.PropTypes.string
|
||||
url: React.PropTypes.string,
|
||||
|
||||
/**
|
||||
* Whether the Welcome page is enabled. If {@code true}, the Welcome
|
||||
* page is rendered when the {@link App} is not at a location (URL)
|
||||
* identifying a Jitsi Meet conference/room.
|
||||
*/
|
||||
welcomePageEnabled: React.PropTypes.bool
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes a new Root instance.
|
||||
* Initializes a new {@code Root} instance.
|
||||
*
|
||||
* @param {Object} props - The read-only properties with which the new
|
||||
* instance is to be initialized.
|
||||
|
@ -42,7 +43,9 @@ class Root extends Component {
|
|||
/**
|
||||
* The initial state of this Component.
|
||||
*
|
||||
* @type {{url: string}}
|
||||
* @type {{
|
||||
* url: string
|
||||
* }}
|
||||
*/
|
||||
this.state = {
|
||||
/**
|
||||
|
@ -74,19 +77,29 @@ class Root extends Component {
|
|||
* @returns {ReactElement}
|
||||
*/
|
||||
render() {
|
||||
// XXX We don't render the App component until we get the initial URL,
|
||||
// either it's null or some other non-null defined value;
|
||||
if (typeof this.state.url === 'undefined') {
|
||||
const { url } = this.state;
|
||||
|
||||
// XXX We don't render the App component until we get the initial URL.
|
||||
// Either it's null or some other non-null defined value.
|
||||
if (typeof url === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
const {
|
||||
// The following props are forked in state:
|
||||
url: _, // eslint-disable-line no-unused-vars
|
||||
|
||||
// The remaining props are passed through to App.
|
||||
...props
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<App
|
||||
disableWelcomePage = { this.props.disableWelcomePage }
|
||||
url = { this.state.url } />
|
||||
{ ...props }
|
||||
url = { url } />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Register the main Component.
|
||||
// Register the main/root Component.
|
||||
AppRegistry.registerComponent('App', () => Root);
|
||||
|
|
|
@ -18,7 +18,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
APP.connectionTimes['document.ready'] = now;
|
||||
logger.log('(TIME) document ready:\t', now);
|
||||
|
||||
// Render the main Component.
|
||||
// Render the main/root Component.
|
||||
ReactDOM.render(<App />, document.getElementById('react'));
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue