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
This commit is contained in:
parent
5e85b5f63a
commit
79c1358f4b
|
@ -385,6 +385,10 @@ var config = {
|
||||||
// set or the lobby is not enabled.
|
// set or the lobby is not enabled.
|
||||||
// enableInsecureRoomNameWarning: false,
|
// enableInsecureRoomNameWarning: false,
|
||||||
|
|
||||||
|
// Whether to automatically copy invitation URL after creating a room.
|
||||||
|
// Document should be focused for this option to work
|
||||||
|
// enableAutomaticUrlCopy: false,
|
||||||
|
|
||||||
// Stats
|
// Stats
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,7 @@ export default [
|
||||||
'enableNoAudioDetection',
|
'enableNoAudioDetection',
|
||||||
'enableNoisyMicDetection',
|
'enableNoisyMicDetection',
|
||||||
'enableTcc',
|
'enableTcc',
|
||||||
|
'enableAutomaticUrlCopy',
|
||||||
'etherpad_base',
|
'etherpad_base',
|
||||||
'failICE',
|
'failICE',
|
||||||
'feedbackPercentage',
|
'feedbackPercentage',
|
||||||
|
|
|
@ -18,7 +18,13 @@ type Props = {
|
||||||
/**
|
/**
|
||||||
* Used for translation.
|
* Used for translation.
|
||||||
*/
|
*/
|
||||||
t: Function
|
t: Function,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to determine if invitation link should be automatically copied
|
||||||
|
* after creating a meeting.
|
||||||
|
*/
|
||||||
|
_enableAutomaticUrlCopy: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -58,6 +64,7 @@ class CopyMeetingUrl extends Component<Props, State> {
|
||||||
this._hideLinkCopied = this._hideLinkCopied.bind(this);
|
this._hideLinkCopied = this._hideLinkCopied.bind(this);
|
||||||
this._showCopyLink = this._showCopyLink.bind(this);
|
this._showCopyLink = this._showCopyLink.bind(this);
|
||||||
this._showLinkCopied = this._showLinkCopied.bind(this);
|
this._showLinkCopied = this._showLinkCopied.bind(this);
|
||||||
|
this._copyUrlAutomatically = this._copyUrlAutomatically.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
_copyUrl: () => void;
|
_copyUrl: () => void;
|
||||||
|
@ -135,6 +142,37 @@ class CopyMeetingUrl extends Component<Props, State> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_copyUrlAutomatically: () => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to automatically copy invitation URL.
|
||||||
|
* Document has to be focused in order for this to work.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
_copyUrlAutomatically() {
|
||||||
|
navigator.clipboard.writeText(this.props.url)
|
||||||
|
.then(() => {
|
||||||
|
this._showLinkCopied();
|
||||||
|
window.setTimeout(this._hideLinkCopied, COPY_TIMEOUT);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements React's {@link Component#componentDidMount()}. Invoked
|
||||||
|
* immediately before mounting occurs.
|
||||||
|
*
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
componentDidMount() {
|
||||||
|
const { _enableAutomaticUrlCopy } = this.props;
|
||||||
|
|
||||||
|
if (_enableAutomaticUrlCopy) {
|
||||||
|
setTimeout(this._copyUrlAutomatically, 2000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements React's {@link Component#render()}.
|
* Implements React's {@link Component#render()}.
|
||||||
*
|
*
|
||||||
|
@ -177,8 +215,11 @@ class CopyMeetingUrl extends Component<Props, State> {
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
|
const { enableAutomaticUrlCopy } = state['features/base/config'];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: getCurrentConferenceUrl(state)
|
url: getCurrentConferenceUrl(state),
|
||||||
|
_enableAutomaticUrlCopy: enableAutomaticUrlCopy || false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue