瀏覽代碼

settings: enable settings buttons on permission grant

Some CSS fixes are also included.
master
vp8x8 5 年之前
父節點
當前提交
84714ba3bd
沒有連結到貢獻者的電子郵件帳戶。

+ 5
- 0
css/_audio-preview.css 查看文件

@@ -13,6 +13,7 @@
13 13
         padding: 16px;
14 14
 
15 15
         &-icon {
16
+            color: #A4B8D1;
16 17
             display: inline-block;
17 18
         }
18 19
 
@@ -66,6 +67,10 @@
66 67
             .audio-preview-test-button {
67 68
                 display: inline-block;
68 69
             }
70
+
71
+            .audio-preview-entry-text {
72
+                max-width: 196px;
73
+            }
69 74
         }
70 75
 
71 76
         .audio-preview-entry-text {

+ 1
- 0
css/_video-preview.css 查看文件

@@ -1,4 +1,5 @@
1 1
 .video-preview {
2
+    background: none;
2 3
     max-height: 290px;
3 4
     overflow: auto;
4 5
 

+ 10
- 0
react/features/overlay/functions.js 查看文件

@@ -21,3 +21,13 @@ export function getOverlayToRender(state: Object) {
21 21
 
22 22
     return undefined;
23 23
 }
24
+
25
+/**
26
+ * Returns the visibility of the media permissions prompt.
27
+ *
28
+ * @param {Object} state - The Redux state.
29
+ * @returns {boolean}
30
+ */
31
+export function getMediaPermissionPromptVisibility(state: Object) {
32
+    return state['features/overlay'].isMediaPermissionPromptVisible;
33
+}

+ 6
- 2
react/features/settings/actionTypes.js 查看文件

@@ -1,4 +1,6 @@
1
-// The type of (redux) action which sets the visibility of the audio settings popup.
1
+/**
2
+ * The type of (redux) action which sets the visibility of the audio settings popup.
3
+ */
2 4
 export const SET_AUDIO_SETTINGS_VISIBILITY = 'SET_AUDIO_SETTINGS_VISIBILITY';
3 5
 
4 6
 /**
@@ -12,5 +14,7 @@ export const SET_AUDIO_SETTINGS_VISIBILITY = 'SET_AUDIO_SETTINGS_VISIBILITY';
12 14
  */
13 15
 export const SET_SETTINGS_VIEW_VISIBLE = 'SET_SETTINGS_VIEW_VISIBLE';
14 16
 
15
-// The type of (redux) action which sets the visibility of the video settings popup.
17
+/**
18
+ * The type of (redux) action which sets the visibility of the video settings popup.
19
+ */
16 20
 export const SET_VIDEO_SETTINGS_VISIBILITY = 'SET_VIDEO_SETTINGS_VISIBILITY';

+ 0
- 1
react/features/settings/components/web/audio/AudioSettingsHeader.js 查看文件

@@ -29,7 +29,6 @@ export default function AudioSettingsHeader({ IconComponent, text }: Props) {
29 29
         <div className = 'audio-preview-header'>
30 30
             <div className = 'audio-preview-header-icon'>
31 31
                 { <Icon
32
-                    color = '#A4B8D1'
33 32
                     size = { 24 }
34 33
                     src = { IconComponent } />}
35 34
             </div>

+ 1
- 3
react/features/settings/components/web/audio/MicrophoneEntry.js 查看文件

@@ -107,9 +107,7 @@ export default class MicrophoneEntry extends Component<Props, State> {
107 107
      * @returns {void}
108 108
      */
109 109
     _stopListening(jitsiTrack) {
110
-        jitsiTrack && jitsiTrack.off(
111
-            JitsiTrackEvents.TRACK_AUDIO_LEVEL_CHANGED,
112
-            this._updateLevel);
110
+        jitsiTrack && jitsiTrack.off(JitsiTrackEvents.TRACK_AUDIO_LEVEL_CHANGED, this._updateLevel);
113 111
         this.setState({
114 112
             level: -1
115 113
         });

+ 20
- 2
react/features/toolbox/components/web/AudioSettingsButton.js 查看文件

@@ -8,7 +8,7 @@ import { IconArrowDown } from '../../../base/icons';
8 8
 import JitsiMeetJS from '../../../base/lib-jitsi-meet/_';
9 9
 import { ToolboxButtonWithIcon } from '../../../base/toolbox';
10 10
 import { connect } from '../../../base/redux';
11
-
11
+import { getMediaPermissionPromptVisibility } from '../../../overlay';
12 12
 import { AudioSettingsPopup, toggleAudioSettings } from '../../../settings';
13 13
 
14 14
 type Props = {
@@ -18,6 +18,12 @@ type Props = {
18 18
      */
19 19
     onAudioOptionsClick: Function,
20 20
 
21
+    /**
22
+     * Whether the permission prompt is visible or not.
23
+     * Useful for enabling the button on permission grant.
24
+     */
25
+    permissionPromptVisibility: boolean,
26
+
21 27
     /**
22 28
      * If the user has audio input or audio output devices.
23 29
      */
@@ -81,6 +87,17 @@ class AudioSettingsButton extends Component<Props, State> {
81 87
         this._updatePermissions();
82 88
     }
83 89
 
90
+    /**
91
+     * Implements React's {@link Component#componentDidUpdate}.
92
+     *
93
+     * @inheritdoc
94
+     */
95
+    componentDidUpdate(prevProps) {
96
+        if (this.props.permissionPromptVisibility !== prevProps.permissionPromptVisibility) {
97
+            this._updatePermissions();
98
+        }
99
+    }
100
+
84 101
     /**
85 102
      * Implements React's {@link Component#render}.
86 103
      *
@@ -113,7 +130,8 @@ function mapStateToProps(state) {
113 130
     return {
114 131
         hasDevices:
115 132
             hasAvailableDevices(state, 'audioInput')
116
-            || hasAvailableDevices(state, 'audioOutput')
133
+            || hasAvailableDevices(state, 'audioOutput'),
134
+        permissionPromptVisibility: getMediaPermissionPromptVisibility(state)
117 135
     };
118 136
 }
119 137
 

+ 20
- 1
react/features/toolbox/components/web/VideoSettingsButton.js 查看文件

@@ -9,6 +9,7 @@ import { hasAvailableDevices } from '../../../base/devices';
9 9
 import { IconArrowDown } from '../../../base/icons';
10 10
 import { connect } from '../../../base/redux';
11 11
 import { ToolboxButtonWithIcon } from '../../../base/toolbox';
12
+import { getMediaPermissionPromptVisibility } from '../../../overlay';
12 13
 
13 14
 type Props = {
14 15
 
@@ -17,6 +18,12 @@ type Props = {
17 18
      */
18 19
     onVideoOptionsClick: Function,
19 20
 
21
+    /**
22
+     * Whether the permission prompt is visible or not.
23
+     * Useful for enabling the button on initial permission grant.
24
+     */
25
+    permissionPromptVisibility: boolean,
26
+
20 27
     /**
21 28
      * If the user has any video devices.
22 29
      */
@@ -80,6 +87,17 @@ class VideoSettingsButton extends Component<Props, State> {
80 87
         this._updatePermissions();
81 88
     }
82 89
 
90
+    /**
91
+     * Implements React's {@link Component#componentDidUpdate}.
92
+     *
93
+     * @inheritdoc
94
+     */
95
+    componentDidUpdate(prevProps) {
96
+        if (this.props.permissionPromptVisibility !== prevProps.permissionPromptVisibility) {
97
+            this._updatePermissions();
98
+        }
99
+    }
100
+
83 101
     /**
84 102
      * Implements React's {@link Component#render}.
85 103
      *
@@ -110,7 +128,8 @@ class VideoSettingsButton extends Component<Props, State> {
110 128
  */
111 129
 function mapStateToProps(state) {
112 130
     return {
113
-        hasDevices: hasAvailableDevices(state, 'videoInput')
131
+        hasDevices: hasAvailableDevices(state, 'videoInput'),
132
+        permissionPromptVisibility: getMediaPermissionPromptVisibility(state)
114 133
     };
115 134
 }
116 135
 

Loading…
取消
儲存