Browse Source

feat(HelpButton): Mobile support.

j8
Hristo Terezov 5 years ago
parent
commit
0a06e256b7

+ 4
- 0
config.js View File

@@ -419,6 +419,10 @@ var config = {
419 419
     // the menu has option to flip the locally seen video for local presentations
420 420
     // disableLocalVideoFlip: false
421 421
 
422
+    // If specified a 'Help' button will be displayed in the overflow menu with a link to the specified URL for
423
+    // user documentation.
424
+    // userDocumentationURL: 'https://docs.example.com/video-meetings.html'
425
+
422 426
     // List of undocumented settings used in jitsi-meet
423 427
     /**
424 428
      _immediateReloadThreshold

+ 0
- 6
interface_config.js View File

@@ -189,12 +189,6 @@ var interfaceConfig = {
189 189
      */
190 190
     AUTO_PIN_LATEST_SCREEN_SHARE: 'remote-only'
191 191
 
192
-    /**
193
-     * The link to the user documentation.
194
-     */
195
-    // HELP_LINK: 'https://docs.example.com/video-meetings.html',
196
-
197
-
198 192
     /**
199 193
      * How many columns the tile view can expand to. The respected range is
200 194
      * between 1 and 5.

+ 1
- 0
react/features/base/util/index.js View File

@@ -1,4 +1,5 @@
1 1
 export * from './helpers';
2 2
 export * from './httpUtils';
3 3
 export * from './loadScript';
4
+export * from './openURLInBrowser';
4 5
 export * from './uri';

+ 5
- 0
react/features/base/util/logger.js View File

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

+ 17
- 0
react/features/base/util/openURLInBrowser.native.js View File

@@ -0,0 +1,17 @@
1
+// @flow
2
+
3
+import { Linking } from 'react-native';
4
+
5
+import logger from './logger';
6
+
7
+/**
8
+ * Opens URL in the browser.
9
+ *
10
+ * @param {string} url - The URL to be opened.
11
+ * @returns {void}
12
+ */
13
+export function openURLInBrowser(url: string) {
14
+    Linking.openURL(url).catch(error => {
15
+        logger.error(`An error occurred while trying to open ${url}`, error);
16
+    });
17
+}

+ 11
- 0
react/features/base/util/openURLInBrowser.web.js View File

@@ -0,0 +1,11 @@
1
+// @flow
2
+
3
+/**
4
+ * Opens URL in the browser.
5
+ *
6
+ * @param {string} url - The URL to be opened.
7
+ * @returns {void}
8
+ */
9
+export function openURLInBrowser(url: string) {
10
+    window.open(url, '', 'noopener');
11
+}

+ 56
- 0
react/features/toolbox/components/HelpButton.js View File

@@ -0,0 +1,56 @@
1
+// @flow
2
+
3
+import { createToolbarEvent, sendAnalytics } from '../../analytics';
4
+import { translate } from '../../base/i18n';
5
+import { IconHelp } from '../../base/icons';
6
+import { connect } from '../../base/redux';
7
+import { openURLInBrowser } from '../../base/util';
8
+import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox';
9
+
10
+
11
+type Props = AbstractButtonProps & {
12
+
13
+    /**
14
+     * The URL to the user documenation.
15
+     */
16
+    _userDocumentationURL: string
17
+};
18
+
19
+/**
20
+ * Implements an {@link AbstractButton} to open the user documentation in a new window.
21
+ */
22
+class HelpButton extends AbstractButton<Props, *> {
23
+    accessibilityLabel = 'toolbar.accessibilityLabel.help';
24
+    icon = IconHelp;
25
+    label = 'toolbar.help';
26
+
27
+    /**
28
+     * Handles clicking / pressing the button, and opens a new window with the user documentation.
29
+     *
30
+     * @private
31
+     * @returns {void}
32
+     */
33
+    _handleClick() {
34
+        sendAnalytics(createToolbarEvent('help.pressed'));
35
+        openURLInBrowser(this.props._userDocumentationURL);
36
+    }
37
+}
38
+
39
+
40
+/**
41
+ * Maps part of the redux state to the component's props.
42
+ *
43
+ * @param {Object} state - The redux store/state.
44
+ * @returns {Object}
45
+ */
46
+function _mapStateToProps(state: Object) {
47
+    const { userDocumentationURL } = state['features/base/config'];
48
+    const visible = typeof userDocumentationURL === 'string';
49
+
50
+    return {
51
+        _userDocumentationURL: userDocumentationURL,
52
+        visible
53
+    };
54
+}
55
+
56
+export default translate(connect(_mapStateToProps)(HelpButton));

+ 2
- 0
react/features/toolbox/components/native/OverflowMenu.js View File

@@ -17,6 +17,7 @@ import { ClosedCaptionButton } from '../../../subtitles';
17 17
 import { TileViewButton } from '../../../video-layout';
18 18
 
19 19
 import AudioOnlyButton from './AudioOnlyButton';
20
+import HelpButton from '../HelpButton';
20 21
 import RaiseHandButton from './RaiseHandButton';
21 22
 import ToggleCameraButton from './ToggleCameraButton';
22 23
 
@@ -110,6 +111,7 @@ class OverflowMenu extends Component<Props> {
110 111
                 }
111 112
                 <RaiseHandButton { ...buttonProps } />
112 113
                 <SharedDocumentButton { ...buttonProps } />
114
+                <HelpButton { ...buttonProps } />
113 115
             </BottomSheet>
114 116
         );
115 117
     }

+ 0
- 44
react/features/toolbox/components/web/HelpButton.js View File

@@ -1,44 +0,0 @@
1
-// @flow
2
-
3
-import { createToolbarEvent, sendAnalytics } from '../../../analytics';
4
-import { translate } from '../../../base/i18n';
5
-import { IconHelp } from '../../../base/icons';
6
-import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox';
7
-
8
-declare var interfaceConfig: Object;
9
-
10
-/**
11
- * Implements an {@link AbstractButton} to open the user documentation in a new window.
12
- */
13
-class HelpButton extends AbstractButton<AbstractButtonProps, *> {
14
-    accessibilityLabel = 'toolbar.accessibilityLabel.help';
15
-    icon = IconHelp;
16
-    label = 'toolbar.help';
17
-
18
-    /**
19
-     * Handles clicking / pressing the button, and opens a new window with the user documentation.
20
-     *
21
-     * @private
22
-     * @returns {void}
23
-     */
24
-    _handleClick() {
25
-        sendAnalytics(createToolbarEvent('help.pressed'));
26
-        window.open(interfaceConfig.HELP_LINK);
27
-    }
28
-
29
-    /**
30
-     * Implements React's {@link Component#render()}.
31
-     *
32
-     * @inheritdoc
33
-     * @returns {React$Node}
34
-     */
35
-    render(): React$Node {
36
-        if (typeof interfaceConfig.HELP_LINK === 'string') {
37
-            return super.render();
38
-        }
39
-
40
-        return null;
41
-    }
42
-}
43
-
44
-export default translate(HelpButton);

+ 1
- 1
react/features/toolbox/components/web/Toolbox.js View File

@@ -71,7 +71,7 @@ import {
71 71
 import AudioMuteButton from '../AudioMuteButton';
72 72
 import { isToolboxVisible } from '../../functions';
73 73
 import HangupButton from '../HangupButton';
74
-import HelpButton from './HelpButton';
74
+import HelpButton from '../HelpButton';
75 75
 import OverflowMenuButton from './OverflowMenuButton';
76 76
 import OverflowMenuProfileItem from './OverflowMenuProfileItem';
77 77
 import ToolbarButton from './ToolbarButton';

Loading…
Cancel
Save