Sfoglia il codice sorgente

feat: add ability to toggle toolbox from tile view

master
Bettenbuk Zoltan 5 anni fa
parent
commit
4c3ed190f3

+ 2
- 21
react/features/conference/components/native/Conference.js Vedi File

@@ -111,13 +111,6 @@ type Props = AbstractProps & {
111 111
      */
112 112
     _toolboxVisible: boolean,
113 113
 
114
-    /**
115
-     * The indicator which determines whether the Toolbox is always visible.
116
-     *
117
-     * @private
118
-     */
119
-    _toolboxAlwaysVisible: boolean,
120
-
121 114
     /**
122 115
      * The redux {@code dispatch} function.
123 116
      */
@@ -298,10 +291,6 @@ class Conference extends AbstractConference<Props, *> {
298 291
      * @returns {void}
299 292
      */
300 293
     _onClick() {
301
-        if (this.props._toolboxAlwaysVisible) {
302
-            return;
303
-        }
304
-
305 294
         this._setToolboxVisible(!this.props._toolboxVisible);
306 295
     }
307 296
 
@@ -407,7 +396,7 @@ function _mapStateToProps(state) {
407 396
         leaving
408 397
     } = state['features/base/conference'];
409 398
     const { reducedUI } = state['features/base/responsive-ui'];
410
-    const { alwaysVisible, visible } = state['features/toolbox'];
399
+    const { visible } = state['features/toolbox'];
411 400
 
412 401
     // XXX There is a window of time between the successful establishment of the
413 402
     // XMPP connection and the subsequent commencement of joining the MUC during
@@ -484,15 +473,7 @@ function _mapStateToProps(state) {
484 473
          * @private
485 474
          * @type {boolean}
486 475
          */
487
-        _toolboxVisible: visible,
488
-
489
-        /**
490
-         * The indicator which determines whether the Toolbox is always visible.
491
-         *
492
-         * @private
493
-         * @type {boolean}
494
-         */
495
-        _toolboxAlwaysVisible: alwaysVisible
476
+        _toolboxVisible: visible
496 477
     };
497 478
 }
498 479
 

+ 17
- 14
react/features/filmstrip/components/native/Thumbnail.js Vedi File

@@ -21,6 +21,7 @@ import { getTrackByMediaTypeAndParticipant } from '../../../base/tracks';
21 21
 import { ConnectionIndicator } from '../../../connection-indicator';
22 22
 import { DisplayNameLabel } from '../../../display-name';
23 23
 import { RemoteVideoMenu } from '../../../remote-video-menu';
24
+import { toggleToolboxVisible } from '../../../toolbox';
24 25
 
25 26
 import AudioMutedIndicator from './AudioMutedIndicator';
26 27
 import DominantSpeakerIndicator from './DominantSpeakerIndicator';
@@ -74,12 +75,6 @@ type Props = {
74 75
      */
75 76
     _videoTrack: Object,
76 77
 
77
-    /**
78
-     * If true, tapping on the thumbnail will not pin the participant to large
79
-     * video. By default tapping does pin the participant.
80
-     */
81
-    disablePin?: boolean,
82
-
83 78
     /**
84 79
      * If true, there will be no color overlay (tint) on the thumbnail
85 80
      * indicating the participant associated with the thumbnail is displayed on
@@ -105,7 +100,12 @@ type Props = {
105 100
     /**
106 101
      * Optional styling to add or override on the Thumbnail component root.
107 102
      */
108
-    styleOverrides?: Object
103
+    styleOverrides?: Object,
104
+
105
+    /**
106
+     * If true, it tells the thumbnail that it needs to behave differently. E.g. react differently to a single tap.
107
+     */
108
+    tileView?: boolean
109 109
 };
110 110
 
111 111
 /**
@@ -130,10 +130,10 @@ class Thumbnail extends Component<Props> {
130 130
             _onShowRemoteVideoMenu,
131 131
             _styles,
132 132
             _videoTrack: videoTrack,
133
-            disablePin,
134 133
             disableTint,
135 134
             participant,
136
-            renderDisplayName
135
+            renderDisplayName,
136
+            tileView
137 137
         } = this.props;
138 138
 
139 139
         // We don't render audio in any of the following:
@@ -152,13 +152,13 @@ class Thumbnail extends Component<Props> {
152 152
 
153 153
         return (
154 154
             <Container
155
-                onClick = { disablePin ? undefined : _onClick }
155
+                onClick = { _onClick }
156 156
                 onLongPress = {
157 157
                     showRemoteVideoMenu
158 158
                         ? _onShowRemoteVideoMenu : undefined }
159 159
                 style = { [
160 160
                     styles.thumbnail,
161
-                    participant.pinned && !disablePin
161
+                    participant.pinned && !tileView
162 162
                         ? _styles.thumbnailPinned : null,
163 163
                     this.props.styleOverrides || null
164 164
                 ] }
@@ -234,10 +234,13 @@ function _mapDispatchToProps(dispatch: Function, ownProps): Object {
234 234
          * @returns {void}
235 235
          */
236 236
         _onClick() {
237
-            const { participant } = ownProps;
237
+            const { participant, tileView } = ownProps;
238 238
 
239
-            dispatch(
240
-                pinParticipant(participant.pinned ? null : participant.id));
239
+            if (tileView) {
240
+                dispatch(toggleToolboxVisible());
241
+            } else {
242
+                dispatch(pinParticipant(participant.pinned ? null : participant.id));
243
+            }
241 244
         },
242 245
 
243 246
         /**

+ 2
- 2
react/features/filmstrip/components/native/TileView.js Vedi File

@@ -298,12 +298,12 @@ class TileView extends Component<Props, State> {
298 298
         return this._getSortedParticipants()
299 299
             .map(participant => (
300 300
                 <Thumbnail
301
-                    disablePin = { true }
302 301
                     disableTint = { true }
303 302
                     key = { participant.id }
304 303
                     participant = { participant }
305 304
                     renderDisplayName = { true }
306
-                    styleOverrides = { styleOverrides } />));
305
+                    styleOverrides = { styleOverrides }
306
+                    tileView = { true } />));
307 307
     }
308 308
 
309 309
     /**

+ 9
- 0
react/features/toolbox/actionTypes.js Vedi File

@@ -102,3 +102,12 @@ export const SET_TOOLBOX_TIMEOUT_MS = 'SET_TOOLBOX_TIMEOUT_MS';
102 102
  * }
103 103
  */
104 104
 export const SET_TOOLBOX_VISIBLE = 'SET_TOOLBOX_VISIBLE';
105
+
106
+/**
107
+ * The type of the redux action which toggles the toolbox visibility regardless of it's current state.
108
+ *
109
+ * {
110
+ *     type: TOGGLE_TOOLBOX_VISIBLE
111
+ * }
112
+ */
113
+export const TOGGLE_TOOLBOX_VISIBLE = 'TOGGLE_TOOLBOX_VISIBLE';

+ 15
- 1
react/features/toolbox/actions.native.js Vedi File

@@ -8,7 +8,8 @@ import {
8 8
     SET_TOOLBOX_ENABLED,
9 9
     SET_TOOLBOX_TIMEOUT,
10 10
     SET_TOOLBOX_TIMEOUT_MS,
11
-    SET_TOOLBOX_VISIBLE
11
+    SET_TOOLBOX_VISIBLE,
12
+    TOGGLE_TOOLBOX_VISIBLE
12 13
 } from './actionTypes';
13 14
 
14 15
 
@@ -144,3 +145,16 @@ export function setToolboxVisible(visible: boolean): Object {
144 145
         visible
145 146
     };
146 147
 }
148
+
149
+/**
150
+ * Action to toggle the toolbox visibility.
151
+ *
152
+ * @returns {{
153
+ *     type: TOGGLE_TOOLBOX_VISIBLE
154
+ * }}
155
+ */
156
+export function toggleToolboxVisible() {
157
+    return {
158
+        type: TOGGLE_TOOLBOX_VISIBLE
159
+    };
160
+}

+ 6
- 2
react/features/toolbox/reducer.js Vedi File

@@ -11,7 +11,8 @@ import {
11 11
     SET_TOOLBOX_ENABLED,
12 12
     SET_TOOLBOX_TIMEOUT,
13 13
     SET_TOOLBOX_TIMEOUT_MS,
14
-    SET_TOOLBOX_VISIBLE
14
+    SET_TOOLBOX_VISIBLE,
15
+    TOGGLE_TOOLBOX_VISIBLE
15 16
 } from './actionTypes';
16 17
 
17 18
 declare var interfaceConfig: Object;
@@ -165,7 +166,10 @@ ReducerRegistry.register(
165 166
             };
166 167
 
167 168
         case SET_TOOLBOX_VISIBLE:
168
-            return set(state, 'visible', action.visible);
169
+            return set(state, 'visible', state.alwaysVisible || action.visible);
170
+
171
+        case TOGGLE_TOOLBOX_VISIBLE:
172
+            return set(state, 'visible', state.alwaysVisible || !state.visible);
169 173
         }
170 174
 
171 175
         return state;

Loading…
Annulla
Salva