|
@@ -18,7 +18,13 @@ type Props = {
|
18
|
18
|
/**
|
19
|
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
|
30
|
type State = {
|
|
@@ -58,6 +64,7 @@ class CopyMeetingUrl extends Component<Props, State> {
|
58
|
64
|
this._hideLinkCopied = this._hideLinkCopied.bind(this);
|
59
|
65
|
this._showCopyLink = this._showCopyLink.bind(this);
|
60
|
66
|
this._showLinkCopied = this._showLinkCopied.bind(this);
|
|
67
|
+ this._copyUrlAutomatically = this._copyUrlAutomatically.bind(this);
|
61
|
68
|
}
|
62
|
69
|
|
63
|
70
|
_copyUrl: () => void;
|
|
@@ -135,6 +142,37 @@ class CopyMeetingUrl extends Component<Props, State> {
|
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
|
177
|
* Implements React's {@link Component#render()}.
|
140
|
178
|
*
|
|
@@ -177,8 +215,11 @@ class CopyMeetingUrl extends Component<Props, State> {
|
177
|
215
|
* @returns {Object}
|
178
|
216
|
*/
|
179
|
217
|
function mapStateToProps(state) {
|
|
218
|
+ const { enableAutomaticUrlCopy } = state['features/base/config'];
|
|
219
|
+
|
180
|
220
|
return {
|
181
|
|
- url: getCurrentConferenceUrl(state)
|
|
221
|
+ url: getCurrentConferenceUrl(state),
|
|
222
|
+ _enableAutomaticUrlCopy: enableAutomaticUrlCopy || false
|
182
|
223
|
};
|
183
|
224
|
}
|
184
|
225
|
|