Skip to content

Commit

Permalink
feat(HelpButton): Mobile support.
Browse files Browse the repository at this point in the history
  • Loading branch information
hristoterezov committed Oct 14, 2019
1 parent f295f60 commit 0a06e25
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 51 deletions.
4 changes: 4 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ var config = {
// the menu has option to flip the locally seen video for local presentations
// disableLocalVideoFlip: false

// If specified a 'Help' button will be displayed in the overflow menu with a link to the specified URL for
// user documentation.
// userDocumentationURL: 'https://docs.example.com/video-meetings.html'

// List of undocumented settings used in jitsi-meet
/**
_immediateReloadThreshold
Expand Down
6 changes: 0 additions & 6 deletions interface_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,6 @@ var interfaceConfig = {
*/
AUTO_PIN_LATEST_SCREEN_SHARE: 'remote-only'

/**
* The link to the user documentation.
*/
// HELP_LINK: 'https://docs.example.com/video-meetings.html',


/**
* How many columns the tile view can expand to. The respected range is
* between 1 and 5.
Expand Down
1 change: 1 addition & 0 deletions react/features/base/util/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './helpers';
export * from './httpUtils';
export * from './loadScript';
export * from './openURLInBrowser';
export * from './uri';
5 changes: 5 additions & 0 deletions react/features/base/util/logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// @flow

import { getLogger } from '../logging/functions';

export default getLogger('features/base/util');
17 changes: 17 additions & 0 deletions react/features/base/util/openURLInBrowser.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// @flow

import { Linking } from 'react-native';

import logger from './logger';

/**
* Opens URL in the browser.
*
* @param {string} url - The URL to be opened.
* @returns {void}
*/
export function openURLInBrowser(url: string) {
Linking.openURL(url).catch(error => {
logger.error(`An error occurred while trying to open ${url}`, error);
});
}
11 changes: 11 additions & 0 deletions react/features/base/util/openURLInBrowser.web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @flow

/**
* Opens URL in the browser.
*
* @param {string} url - The URL to be opened.
* @returns {void}
*/
export function openURLInBrowser(url: string) {
window.open(url, '', 'noopener');
}
56 changes: 56 additions & 0 deletions react/features/toolbox/components/HelpButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// @flow

import { createToolbarEvent, sendAnalytics } from '../../analytics';
import { translate } from '../../base/i18n';
import { IconHelp } from '../../base/icons';
import { connect } from '../../base/redux';
import { openURLInBrowser } from '../../base/util';
import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox';


type Props = AbstractButtonProps & {

/**
* The URL to the user documenation.
*/
_userDocumentationURL: string
};

/**
* Implements an {@link AbstractButton} to open the user documentation in a new window.
*/
class HelpButton extends AbstractButton<Props, *> {
accessibilityLabel = 'toolbar.accessibilityLabel.help';
icon = IconHelp;
label = 'toolbar.help';

/**
* Handles clicking / pressing the button, and opens a new window with the user documentation.
*
* @private
* @returns {void}
*/
_handleClick() {
sendAnalytics(createToolbarEvent('help.pressed'));
openURLInBrowser(this.props._userDocumentationURL);
}
}


/**
* Maps part of the redux state to the component's props.
*
* @param {Object} state - The redux store/state.
* @returns {Object}
*/
function _mapStateToProps(state: Object) {
const { userDocumentationURL } = state['features/base/config'];
const visible = typeof userDocumentationURL === 'string';

return {
_userDocumentationURL: userDocumentationURL,
visible
};
}

export default translate(connect(_mapStateToProps)(HelpButton));
2 changes: 2 additions & 0 deletions react/features/toolbox/components/native/OverflowMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ClosedCaptionButton } from '../../../subtitles';
import { TileViewButton } from '../../../video-layout';

import AudioOnlyButton from './AudioOnlyButton';
import HelpButton from '../HelpButton';
import RaiseHandButton from './RaiseHandButton';
import ToggleCameraButton from './ToggleCameraButton';

Expand Down Expand Up @@ -110,6 +111,7 @@ class OverflowMenu extends Component<Props> {
}
<RaiseHandButton { ...buttonProps } />
<SharedDocumentButton { ...buttonProps } />
<HelpButton { ...buttonProps } />
</BottomSheet>
);
}
Expand Down
44 changes: 0 additions & 44 deletions react/features/toolbox/components/web/HelpButton.js

This file was deleted.

2 changes: 1 addition & 1 deletion react/features/toolbox/components/web/Toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import {
import AudioMuteButton from '../AudioMuteButton';
import { isToolboxVisible } from '../../functions';
import HangupButton from '../HangupButton';
import HelpButton from './HelpButton';
import HelpButton from '../HelpButton';
import OverflowMenuButton from './OverflowMenuButton';
import OverflowMenuProfileItem from './OverflowMenuProfileItem';
import ToolbarButton from './ToolbarButton';
Expand Down

0 comments on commit 0a06e25

Please sign in to comment.