Bläddra i källkod

FEAT: Automatically copy invite URL after creating a room (#7581)

* Resolves #7501
- Automatically copy invite URL after creating a room

* Resolves #7501
- Automatically copy invite URL after creating a room

* - Adding config flag to enable the feature
j8
RabeeAbuBaker 5 år sedan
förälder
incheckning
79c1358f4b
Inget konto är kopplat till bidragsgivarens mejladress

+ 4
- 0
config.js Visa fil

385
     // set or the lobby is not enabled.
385
     // set or the lobby is not enabled.
386
     // enableInsecureRoomNameWarning: false,
386
     // enableInsecureRoomNameWarning: false,
387
 
387
 
388
+    // Whether to automatically copy invitation URL after creating a room.
389
+    // Document should be focused for this option to work
390
+    // enableAutomaticUrlCopy: false,
391
+
388
     // Stats
392
     // Stats
389
     //
393
     //
390
 
394
 

+ 1
- 0
react/features/base/config/configWhitelist.js Visa fil

107
     'enableNoAudioDetection',
107
     'enableNoAudioDetection',
108
     'enableNoisyMicDetection',
108
     'enableNoisyMicDetection',
109
     'enableTcc',
109
     'enableTcc',
110
+    'enableAutomaticUrlCopy',
110
     'etherpad_base',
111
     'etherpad_base',
111
     'failICE',
112
     'failICE',
112
     'feedbackPercentage',
113
     'feedbackPercentage',

+ 43
- 2
react/features/base/premeeting/components/web/CopyMeetingUrl.js Visa fil

18
     /**
18
     /**
19
      * Used for translation.
19
      * Used for translation.
20
      */
20
      */
21
-    t: Function
21
+    t: Function,
22
+
23
+    /**
24
+     * Used to determine if invitation link should be automatically copied
25
+     * after creating a meeting.
26
+     */
27
+    _enableAutomaticUrlCopy: boolean,
22
 };
28
 };
23
 
29
 
24
 type State = {
30
 type State = {
58
         this._hideLinkCopied = this._hideLinkCopied.bind(this);
64
         this._hideLinkCopied = this._hideLinkCopied.bind(this);
59
         this._showCopyLink = this._showCopyLink.bind(this);
65
         this._showCopyLink = this._showCopyLink.bind(this);
60
         this._showLinkCopied = this._showLinkCopied.bind(this);
66
         this._showLinkCopied = this._showLinkCopied.bind(this);
67
+        this._copyUrlAutomatically = this._copyUrlAutomatically.bind(this);
61
     }
68
     }
62
 
69
 
63
     _copyUrl: () => void;
70
     _copyUrl: () => void;
135
         });
142
         });
136
     }
143
     }
137
 
144
 
145
+    _copyUrlAutomatically: () => void;
146
+
147
+    /**
148
+     * Attempts to automatically copy invitation URL.
149
+     * Document has to be focused in order for this to work.
150
+     *
151
+     * @private
152
+     * @returns {void}
153
+     */
154
+    _copyUrlAutomatically() {
155
+        navigator.clipboard.writeText(this.props.url)
156
+            .then(() => {
157
+                this._showLinkCopied();
158
+                window.setTimeout(this._hideLinkCopied, COPY_TIMEOUT);
159
+            });
160
+    }
161
+
162
+    /**
163
+     * Implements React's {@link Component#componentDidMount()}. Invoked
164
+     * immediately before mounting occurs.
165
+     *
166
+     * @inheritdoc
167
+     */
168
+    componentDidMount() {
169
+        const { _enableAutomaticUrlCopy } = this.props;
170
+
171
+        if (_enableAutomaticUrlCopy) {
172
+            setTimeout(this._copyUrlAutomatically, 2000);
173
+        }
174
+    }
175
+
138
     /**
176
     /**
139
      * Implements React's {@link Component#render()}.
177
      * Implements React's {@link Component#render()}.
140
      *
178
      *
177
  * @returns {Object}
215
  * @returns {Object}
178
  */
216
  */
179
 function mapStateToProps(state) {
217
 function mapStateToProps(state) {
218
+    const { enableAutomaticUrlCopy } = state['features/base/config'];
219
+
180
     return {
220
     return {
181
-        url: getCurrentConferenceUrl(state)
221
+        url: getCurrentConferenceUrl(state),
222
+        _enableAutomaticUrlCopy: enableAutomaticUrlCopy || false
182
     };
223
     };
183
 }
224
 }
184
 
225
 

Laddar…
Avbryt
Spara